@atlaskit/editor-plugin-insert-block 7.0.13 → 7.0.15

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-plugin-insert-block
2
2
 
3
+ ## 7.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c1691aca7fb1d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c1691aca7fb1d) -
8
+ [ux] Update and standardise insert menu ordering behaviour to support localisation
9
+ - Updated dependencies
10
+
11
+ ## 7.0.14
12
+
13
+ ### Patch Changes
14
+
15
+ - [`2bdec5e9ec1c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2bdec5e9ec1c9) -
16
+ [EDITOR-442] Cleans up FG platform_editor_add_media_from_url_rollout
17
+ - Updated dependencies
18
+
3
19
  ## 7.0.13
4
20
 
5
21
  ### Patch Changes
@@ -294,15 +294,11 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
294
294
  exposure: true
295
295
  }) ? emojiProviderPromise : getEmojiProvider();
296
296
  var onShowMediaPicker = function onShowMediaPicker(mountInfo) {
297
+ var _pluginInjectionApi$c, _pluginInjectionApi$m;
297
298
  if (!showMediaPicker) {
298
299
  return;
299
300
  }
300
- if ((0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout')) {
301
- var _pluginInjectionApi$c, _pluginInjectionApi$m;
302
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
303
- } else {
304
- showMediaPicker();
305
- }
301
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
306
302
  };
307
303
  return /*#__PURE__*/_react.default.createElement(_ToolbarInsertBlock.default, {
308
304
  showElementBrowser: showElementBrowser || false,
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = exports.DEFAULT_HEIGHT = void 0;
7
+ exports.filterForPinWhiteboardsExperiment = 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
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = require("react");
14
14
  var _react2 = require("@emotion/react");
15
15
  var _reactIntlNext = require("react-intl-next");
@@ -29,6 +29,113 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
29
29
  * @jsx jsx
30
30
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
31
31
  var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
32
+
33
+ /**
34
+ * Exported helper to allow testing of InsertMenu whiteboard pinning logic. NOTE: this is
35
+ *not* the ideal way to approach this, quickinsert plugin provides a `getSuggestions`
36
+ method that can be used to get suggestions -> once all experiments are cleaned up,
37
+ they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
38
+ */
39
+ var filterForPinWhiteboardsExperiment = exports.filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems, formatMessage) {
40
+ // Legacy path fallback -- prior comments as follows:
41
+ /**
42
+ * // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
43
+ // Need to check if whiteboard options are available, and filter for the cohort
44
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
45
+ */
46
+ if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-eligible')) {
47
+ var DIAGRAM_TITLE = 'Create diagram',
48
+ BLANK_TITLE = 'Create whiteboard';
49
+ var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
50
+ return [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
51
+ }).length === 2;
52
+ if (featuredWhiteboardsPresent) {
53
+ var pinWhiteboardActionToTop = function pinWhiteboardActionToTop(items, title) {
54
+ // find the requested item by title, give it the appropriate description, and bring it to the top of the list
55
+ var index = items.findIndex(function (item) {
56
+ return item.title === title;
57
+ });
58
+ var filteredList = items.filter(function (item) {
59
+ return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
60
+ });
61
+ if (index === -1) {
62
+ return filteredList;
63
+ }
64
+ var featuredItem = _objectSpread({}, items[index]);
65
+ featuredItem.description = formatMessage(_quickInsert.messages.featuredWhiteboardDescription);
66
+ return [featuredItem].concat((0, _toConsumableArray2.default)(filteredList));
67
+ };
68
+ if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
69
+ return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
70
+ }
71
+ if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
72
+ return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
73
+ }
74
+ // NOTE this is not desirable/the OG behaviour, but given we've shipped the test_diagram variant,
75
+ return featuredItems.filter(function (item) {
76
+ return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
77
+ });
78
+ } else {
79
+ if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-l10n-eligible')) {
80
+ /** BEGIN locale agnostic path */
81
+
82
+ /**
83
+ * EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
84
+ * the 'insert diagram to the top' treatment.
85
+ *
86
+ * Our heuristic to check that this is only targeting users where they haven't
87
+ * gotten the experience, is if we _cannot_ find the blank board experience in
88
+ * the list, matching purely on title.
89
+ *
90
+ * e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
91
+ *
92
+ * The side-effect of this, is that there's a small chance/edge case of users
93
+ * who toggle between locales, and receive different experiences.
94
+ *
95
+ * Hopefully we can make a call early on this experiment, and eliminate this
96
+ * code path.
97
+ */
98
+ var WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
99
+ var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
100
+ var isBlank = function isBlank(item) {
101
+ return item.key === WHITEBOARD_KEY;
102
+ };
103
+ var isDiagram = function isDiagram(item) {
104
+ return item.key === DIAGRAM_KEY;
105
+ };
106
+ var hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
107
+ if (hasBoth) {
108
+ var pin = function pin(key) {
109
+ var idx = featuredItems.findIndex(function (item) {
110
+ return item.key === key;
111
+ });
112
+ var filtered = featuredItems.filter(function (item) {
113
+ return !isBlank(item) && !isDiagram(item);
114
+ });
115
+ if (idx === -1) {
116
+ return filtered;
117
+ }
118
+ var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
119
+ description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
120
+ });
121
+ return [picked].concat((0, _toConsumableArray2.default)(filtered));
122
+ };
123
+ if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
124
+ return pin(WHITEBOARD_KEY);
125
+ }
126
+ if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
127
+ return pin(DIAGRAM_KEY);
128
+ }
129
+ if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
130
+ return featuredItems;
131
+ }
132
+ }
133
+ }
134
+ /** END locale agnostic path */
135
+ }
136
+ }
137
+ return featuredItems;
138
+ };
32
139
  var selector = function selector(states) {
33
140
  var _states$connectivityS;
34
141
  return {
@@ -114,45 +221,6 @@ var InsertMenu = function InsertMenu(_ref) {
114
221
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['connectivity'], selector),
115
222
  connectivityMode = _useSharedPluginState.connectivityMode;
116
223
  var getItems = (0, _react.useCallback)(function (query, category) {
117
- var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
118
- // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
119
- // Need to check if whiteboard options are available, and filter for the cohort
120
- // Takes the original featuredItems list and returns one with the right whiteboard option at the top
121
- if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-eligible')) {
122
- var DIAGRAM_TITLE = 'Create diagram',
123
- BLANK_TITLE = 'Create whiteboard';
124
- var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
125
- return [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
126
- }).length === 2;
127
- if (featuredWhiteboardsPresent) {
128
- var pinWhiteboardActionToTop = function pinWhiteboardActionToTop(featuredItems, title) {
129
- // find the requested item by title, give it the appropriate description, and bring it to the top of the list
130
- var index = featuredItems.findIndex(function (item) {
131
- return item.title === title;
132
- });
133
- var filteredList = featuredItems.filter(function (item) {
134
- return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
135
- });
136
- if (index === -1) {
137
- return filteredList;
138
- }
139
- var featuredItem = _objectSpread({}, featuredItems[index]);
140
- featuredItem.description = formatMessage(_quickInsert.messages.featuredWhiteboardDescription);
141
- return [featuredItem].concat((0, _toConsumableArray2.default)(filteredList));
142
- };
143
- if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
144
- return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
145
- } else if ((0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
146
- return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
147
- } else {
148
- return featuredItems.filter(function (item) {
149
- return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
150
- });
151
- }
152
- }
153
- }
154
- return featuredItems;
155
- };
156
224
  var result;
157
225
  /**
158
226
  * @warning The results if there is a query are not the same as the results if there is no query.
@@ -182,7 +250,7 @@ var InsertMenu = function InsertMenu(_ref) {
182
250
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
183
251
  var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
184
252
  // need to filter on the concatenated list so whiteboards are at the top
185
- result = filterForPinWhiteboardsExperiment(unfilteredResult);
253
+ result = filterForPinWhiteboardsExperiment(unfilteredResult, formatMessage);
186
254
  }
187
255
  setItemCount(result.length);
188
256
  return result;
@@ -367,7 +367,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
367
367
  dispatchAnalyticsEvent({
368
368
  action: _analytics.ACTION.OPENED,
369
369
  actionSubject: _analytics.ACTION_SUBJECT.PICKER,
370
- actionSubjectId: (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout') ? _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA : _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
370
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA,
371
371
  attributes: {
372
372
  inputMethod: inputMethod
373
373
  },
@@ -136,12 +136,8 @@ var InsertButton = exports.InsertButton = function InsertButton(_ref) {
136
136
  break;
137
137
  case 'media':
138
138
  if (showMediaPicker) {
139
- if ((0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout')) {
140
- var _api$core2, _api$mediaInsert;
141
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
142
- } else {
143
- showMediaPicker();
144
- }
139
+ var _api$core2, _api$mediaInsert;
140
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
145
141
  }
146
142
  break;
147
143
  case 'mention':
@@ -11,7 +11,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _editorToolbar = require("@atlaskit/editor-toolbar");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
15
  var MediaButton = exports.MediaButton = function MediaButton(_ref) {
17
16
  var api = _ref.api;
@@ -37,7 +36,7 @@ var MediaButton = exports.MediaButton = function MediaButton(_ref) {
37
36
  if (!showMediaPicker) {
38
37
  return;
39
38
  }
40
- if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert = _api$mediaInsert.commands) !== null && _api$mediaInsert !== void 0 && _api$mediaInsert.showMediaInsertPopup && (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout')) {
39
+ if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert = _api$mediaInsert.commands) !== null && _api$mediaInsert !== void 0 && _api$mediaInsert.showMediaInsertPopup) {
41
40
  var _api$core, _api$mediaInsert2;
42
41
  var mountInfo = mediaButtonRef.current ? {
43
42
  ref: mediaButtonRef.current,
@@ -50,7 +49,7 @@ var MediaButton = exports.MediaButton = function MediaButton(_ref) {
50
49
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
51
50
  action: _analytics.ACTION.OPENED,
52
51
  actionSubject: _analytics.ACTION_SUBJECT.PICKER,
53
- actionSubjectId: (0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout') ? _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA : _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
52
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA,
54
53
  attributes: {
55
54
  inputMethod: _analytics.INPUT_METHOD.TOOLBAR
56
55
  },
@@ -280,15 +280,11 @@ function ToolbarInsertBlockWithInjectionApi({
280
280
  exposure: true
281
281
  }) ? emojiProviderPromise : getEmojiProvider();
282
282
  const onShowMediaPicker = mountInfo => {
283
+ var _pluginInjectionApi$c, _pluginInjectionApi$m;
283
284
  if (!showMediaPicker) {
284
285
  return;
285
286
  }
286
- if (fg('platform_editor_add_media_from_url_rollout')) {
287
- var _pluginInjectionApi$c, _pluginInjectionApi$m;
288
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
289
- } else {
290
- showMediaPicker();
291
- }
287
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
292
288
  };
293
289
  return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
294
290
  showElementBrowser: showElementBrowser || false,
@@ -19,6 +19,99 @@ import { fg } from '@atlaskit/platform-feature-flags';
19
19
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
20
20
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
21
  export const DEFAULT_HEIGHT = 560;
22
+
23
+ /**
24
+ * Exported helper to allow testing of InsertMenu whiteboard pinning logic. NOTE: this is
25
+ *not* the ideal way to approach this, quickinsert plugin provides a `getSuggestions`
26
+ method that can be used to get suggestions -> once all experiments are cleaned up,
27
+ they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
28
+ */
29
+ export const filterForPinWhiteboardsExperiment = (featuredItems, formatMessage) => {
30
+ // Legacy path fallback -- prior comments as follows:
31
+ /**
32
+ * // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
33
+ // Need to check if whiteboard options are available, and filter for the cohort
34
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
35
+ */
36
+ if (fg('confluence-whiteboards-quick-insert-eligible')) {
37
+ const [DIAGRAM_TITLE, BLANK_TITLE] = ['Create diagram', 'Create whiteboard'];
38
+ const featuredWhiteboardsPresent = featuredItems.filter(item => [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title)).length === 2;
39
+ if (featuredWhiteboardsPresent) {
40
+ const pinWhiteboardActionToTop = (items, title) => {
41
+ // find the requested item by title, give it the appropriate description, and bring it to the top of the list
42
+ const index = items.findIndex(item => item.title === title);
43
+ const filteredList = items.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
44
+ if (index === -1) {
45
+ return filteredList;
46
+ }
47
+ const featuredItem = {
48
+ ...items[index]
49
+ };
50
+ featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
51
+ return [featuredItem, ...filteredList];
52
+ };
53
+ if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
54
+ return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
55
+ }
56
+ if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
57
+ return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
58
+ }
59
+ // NOTE this is not desirable/the OG behaviour, but given we've shipped the test_diagram variant,
60
+ return featuredItems.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
61
+ } else {
62
+ if (fg('confluence-whiteboards-quick-insert-l10n-eligible')) {
63
+ /** BEGIN locale agnostic path */
64
+
65
+ /**
66
+ * EXTREMELY IMPORTANT: we must not drop diagram for those who already receive
67
+ * the 'insert diagram to the top' treatment.
68
+ *
69
+ * Our heuristic to check that this is only targeting users where they haven't
70
+ * gotten the experience, is if we _cannot_ find the blank board experience in
71
+ * the list, matching purely on title.
72
+ *
73
+ * e.g. `featuredWhiteboardsPresent` = false, given it matches on title.
74
+ *
75
+ * The side-effect of this, is that there's a small chance/edge case of users
76
+ * who toggle between locales, and receive different experiences.
77
+ *
78
+ * Hopefully we can make a call early on this experiment, and eliminate this
79
+ * code path.
80
+ */
81
+ const WHITEBOARD_KEY = 'whiteboard-extension:create-whiteboard';
82
+ const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
83
+ const isBlank = item => item.key === WHITEBOARD_KEY;
84
+ const isDiagram = item => item.key === DIAGRAM_KEY;
85
+ const hasBoth = featuredItems.some(isBlank) && featuredItems.some(isDiagram);
86
+ if (hasBoth) {
87
+ const pin = key => {
88
+ const idx = featuredItems.findIndex(item => item.key === key);
89
+ const filtered = featuredItems.filter(item => !isBlank(item) && !isDiagram(item));
90
+ if (idx === -1) {
91
+ return filtered;
92
+ }
93
+ const picked = {
94
+ ...featuredItems[idx],
95
+ description: formatMessage(messages.featuredWhiteboardDescription)
96
+ };
97
+ return [picked, ...filtered];
98
+ };
99
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
100
+ return pin(WHITEBOARD_KEY);
101
+ }
102
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
103
+ return pin(DIAGRAM_KEY);
104
+ }
105
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
106
+ return featuredItems;
107
+ }
108
+ }
109
+ }
110
+ /** END locale agnostic path */
111
+ }
112
+ }
113
+ return featuredItems;
114
+ };
22
115
  const selector = states => {
23
116
  var _states$connectivityS;
24
117
  return {
@@ -93,38 +186,6 @@ const InsertMenu = ({
93
186
  connectivityMode
94
187
  } = useSharedPluginStateWithSelector(pluginInjectionApi, ['connectivity'], selector);
95
188
  const getItems = useCallback((query, category) => {
96
- const filterForPinWhiteboardsExperiment = featuredItems => {
97
- // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
98
- // Need to check if whiteboard options are available, and filter for the cohort
99
- // Takes the original featuredItems list and returns one with the right whiteboard option at the top
100
- if (fg('confluence-whiteboards-quick-insert-eligible')) {
101
- const [DIAGRAM_TITLE, BLANK_TITLE] = ['Create diagram', 'Create whiteboard'];
102
- const featuredWhiteboardsPresent = featuredItems.filter(item => [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title)).length === 2;
103
- if (featuredWhiteboardsPresent) {
104
- const pinWhiteboardActionToTop = (featuredItems, title) => {
105
- // find the requested item by title, give it the appropriate description, and bring it to the top of the list
106
- const index = featuredItems.findIndex(item => item.title === title);
107
- const filteredList = featuredItems.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
108
- if (index === -1) {
109
- return filteredList;
110
- }
111
- const featuredItem = {
112
- ...featuredItems[index]
113
- };
114
- featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
115
- return [featuredItem, ...filteredList];
116
- };
117
- if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
118
- return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
119
- } else if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
120
- return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
121
- } else {
122
- return featuredItems.filter(item => ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title));
123
- }
124
- }
125
- }
126
- return featuredItems;
127
- };
128
189
  let result;
129
190
  /**
130
191
  * @warning The results if there is a query are not the same as the results if there is no query.
@@ -152,7 +213,7 @@ const InsertMenu = ({
152
213
  } : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
153
214
  const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
154
215
  // need to filter on the concatenated list so whiteboards are at the top
155
- result = filterForPinWhiteboardsExperiment(unfilteredResult);
216
+ result = filterForPinWhiteboardsExperiment(unfilteredResult, formatMessage);
156
217
  }
157
218
  setItemCount(result.length);
158
219
  return result;
@@ -386,7 +386,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
386
386
  dispatchAnalyticsEvent({
387
387
  action: ACTION.OPENED,
388
388
  actionSubject: ACTION_SUBJECT.PICKER,
389
- actionSubjectId: fg('platform_editor_add_media_from_url_rollout') ? ACTION_SUBJECT_ID.PICKER_MEDIA : ACTION_SUBJECT_ID.PICKER_CLOUD,
389
+ actionSubjectId: ACTION_SUBJECT_ID.PICKER_MEDIA,
390
390
  attributes: {
391
391
  inputMethod
392
392
  },
@@ -128,12 +128,8 @@ export const InsertButton = ({
128
128
  break;
129
129
  case 'media':
130
130
  if (showMediaPicker) {
131
- if (fg('platform_editor_add_media_from_url_rollout')) {
132
- var _api$core2, _api$mediaInsert;
133
- api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
134
- } else {
135
- showMediaPicker();
136
- }
131
+ var _api$core2, _api$mediaInsert;
132
+ api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
137
133
  }
138
134
  break;
139
135
  case 'mention':
@@ -4,7 +4,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { ToolbarButton, ToolbarTooltip, ImageIcon } from '@atlaskit/editor-toolbar';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  export const MediaButton = ({
9
8
  api
10
9
  }) => {
@@ -32,7 +31,7 @@ export const MediaButton = ({
32
31
  if (!showMediaPicker) {
33
32
  return;
34
33
  }
35
- if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert$comm = _api$mediaInsert.commands) !== null && _api$mediaInsert$comm !== void 0 && _api$mediaInsert$comm.showMediaInsertPopup && fg('platform_editor_add_media_from_url_rollout')) {
34
+ if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert$comm = _api$mediaInsert.commands) !== null && _api$mediaInsert$comm !== void 0 && _api$mediaInsert$comm.showMediaInsertPopup) {
36
35
  var _api$core, _api$mediaInsert2;
37
36
  const mountInfo = mediaButtonRef.current ? {
38
37
  ref: mediaButtonRef.current,
@@ -45,7 +44,7 @@ export const MediaButton = ({
45
44
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
46
45
  action: ACTION.OPENED,
47
46
  actionSubject: ACTION_SUBJECT.PICKER,
48
- actionSubjectId: fg('platform_editor_add_media_from_url_rollout') ? ACTION_SUBJECT_ID.PICKER_MEDIA : ACTION_SUBJECT_ID.PICKER_CLOUD,
47
+ actionSubjectId: ACTION_SUBJECT_ID.PICKER_MEDIA,
49
48
  attributes: {
50
49
  inputMethod: INPUT_METHOD.TOOLBAR
51
50
  },
@@ -284,15 +284,11 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
284
284
  exposure: true
285
285
  }) ? emojiProviderPromise : getEmojiProvider();
286
286
  var onShowMediaPicker = function onShowMediaPicker(mountInfo) {
287
+ var _pluginInjectionApi$c, _pluginInjectionApi$m;
287
288
  if (!showMediaPicker) {
288
289
  return;
289
290
  }
290
- if (fg('platform_editor_add_media_from_url_rollout')) {
291
- var _pluginInjectionApi$c, _pluginInjectionApi$m;
292
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
293
- } else {
294
- showMediaPicker();
295
- }
291
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
296
292
  };
297
293
  return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
298
294
  showElementBrowser: showElementBrowser || false,
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  var _excluded = ["children"];
7
7
  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; }
8
8
  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) { _defineProperty(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; }
@@ -26,6 +26,113 @@ import { fg } from '@atlaskit/platform-feature-flags';
26
26
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
27
27
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
28
28
  export var DEFAULT_HEIGHT = 560;
29
+
30
+ /**
31
+ * Exported helper to allow testing of InsertMenu whiteboard pinning logic. NOTE: this is
32
+ *not* the ideal way to approach this, quickinsert plugin provides a `getSuggestions`
33
+ method that can be used to get suggestions -> once all experiments are cleaned up,
34
+ they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
35
+ */
36
+ export var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems, formatMessage) {
37
+ // Legacy path fallback -- prior comments as follows:
38
+ /**
39
+ * // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
40
+ // Need to check if whiteboard options are available, and filter for the cohort
41
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
42
+ */
43
+ if (fg('confluence-whiteboards-quick-insert-eligible')) {
44
+ var DIAGRAM_TITLE = 'Create diagram',
45
+ BLANK_TITLE = 'Create whiteboard';
46
+ var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
47
+ return [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
48
+ }).length === 2;
49
+ if (featuredWhiteboardsPresent) {
50
+ var pinWhiteboardActionToTop = function pinWhiteboardActionToTop(items, title) {
51
+ // find the requested item by title, give it the appropriate description, and bring it to the top of the list
52
+ var index = items.findIndex(function (item) {
53
+ return item.title === title;
54
+ });
55
+ var filteredList = items.filter(function (item) {
56
+ return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
57
+ });
58
+ if (index === -1) {
59
+ return filteredList;
60
+ }
61
+ var featuredItem = _objectSpread({}, items[index]);
62
+ featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
63
+ return [featuredItem].concat(_toConsumableArray(filteredList));
64
+ };
65
+ if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
66
+ return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
67
+ }
68
+ if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
69
+ return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
70
+ }
71
+ // NOTE this is not desirable/the OG behaviour, but given we've shipped the test_diagram variant,
72
+ return featuredItems.filter(function (item) {
73
+ return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
74
+ });
75
+ } else {
76
+ if (fg('confluence-whiteboards-quick-insert-l10n-eligible')) {
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(messages.featuredWhiteboardDescription)
117
+ });
118
+ return [picked].concat(_toConsumableArray(filtered));
119
+ };
120
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_blank')) {
121
+ return pin(WHITEBOARD_KEY);
122
+ }
123
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'test_diagram')) {
124
+ return pin(DIAGRAM_KEY);
125
+ }
126
+ if (expValEquals('confluence_whiteboards_quick_insert_localised', 'cohort', 'control')) {
127
+ return featuredItems;
128
+ }
129
+ }
130
+ }
131
+ /** END locale agnostic path */
132
+ }
133
+ }
134
+ return featuredItems;
135
+ };
29
136
  var selector = function selector(states) {
30
137
  var _states$connectivityS;
31
138
  return {
@@ -111,45 +218,6 @@ var InsertMenu = function InsertMenu(_ref) {
111
218
  var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['connectivity'], selector),
112
219
  connectivityMode = _useSharedPluginState.connectivityMode;
113
220
  var getItems = useCallback(function (query, category) {
114
- var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
115
- // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
116
- // Need to check if whiteboard options are available, and filter for the cohort
117
- // Takes the original featuredItems list and returns one with the right whiteboard option at the top
118
- if (fg('confluence-whiteboards-quick-insert-eligible')) {
119
- var DIAGRAM_TITLE = 'Create diagram',
120
- BLANK_TITLE = 'Create whiteboard';
121
- var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
122
- return [DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
123
- }).length === 2;
124
- if (featuredWhiteboardsPresent) {
125
- var pinWhiteboardActionToTop = function pinWhiteboardActionToTop(featuredItems, title) {
126
- // find the requested item by title, give it the appropriate description, and bring it to the top of the list
127
- var index = featuredItems.findIndex(function (item) {
128
- return item.title === title;
129
- });
130
- var filteredList = featuredItems.filter(function (item) {
131
- return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
132
- });
133
- if (index === -1) {
134
- return filteredList;
135
- }
136
- var featuredItem = _objectSpread({}, featuredItems[index]);
137
- featuredItem.description = formatMessage(messages.featuredWhiteboardDescription);
138
- return [featuredItem].concat(_toConsumableArray(filteredList));
139
- };
140
- if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_blank')) {
141
- return pinWhiteboardActionToTop(featuredItems, BLANK_TITLE);
142
- } else if (expValEquals('confluence_whiteboards_quick_insert', 'cohort', 'test_diagram')) {
143
- return pinWhiteboardActionToTop(featuredItems, DIAGRAM_TITLE);
144
- } else {
145
- return featuredItems.filter(function (item) {
146
- return ![DIAGRAM_TITLE, BLANK_TITLE].includes(item.title);
147
- });
148
- }
149
- }
150
- }
151
- return featuredItems;
152
- };
153
221
  var result;
154
222
  /**
155
223
  * @warning The results if there is a query are not the same as the results if there is no query.
@@ -179,7 +247,7 @@ var InsertMenu = function InsertMenu(_ref) {
179
247
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
180
248
  var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
181
249
  // need to filter on the concatenated list so whiteboards are at the top
182
- result = filterForPinWhiteboardsExperiment(unfilteredResult);
250
+ result = filterForPinWhiteboardsExperiment(unfilteredResult, formatMessage);
183
251
  }
184
252
  setItemCount(result.length);
185
253
  return result;
@@ -361,7 +361,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
361
361
  dispatchAnalyticsEvent({
362
362
  action: ACTION.OPENED,
363
363
  actionSubject: ACTION_SUBJECT.PICKER,
364
- actionSubjectId: fg('platform_editor_add_media_from_url_rollout') ? ACTION_SUBJECT_ID.PICKER_MEDIA : ACTION_SUBJECT_ID.PICKER_CLOUD,
364
+ actionSubjectId: ACTION_SUBJECT_ID.PICKER_MEDIA,
365
365
  attributes: {
366
366
  inputMethod: inputMethod
367
367
  },
@@ -128,12 +128,8 @@ export var InsertButton = function InsertButton(_ref) {
128
128
  break;
129
129
  case 'media':
130
130
  if (showMediaPicker) {
131
- if (fg('platform_editor_add_media_from_url_rollout')) {
132
- var _api$core2, _api$mediaInsert;
133
- api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
134
- } else {
135
- showMediaPicker();
136
- }
131
+ var _api$core2, _api$mediaInsert;
132
+ api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 ? void 0 : _api$mediaInsert.commands.showMediaInsertPopup());
137
133
  }
138
134
  break;
139
135
  case 'mention':
@@ -4,7 +4,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { ToolbarButton, ToolbarTooltip, ImageIcon } from '@atlaskit/editor-toolbar';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  export var MediaButton = function MediaButton(_ref) {
9
8
  var api = _ref.api;
10
9
  var _useIntl = useIntl(),
@@ -29,7 +28,7 @@ export var MediaButton = function MediaButton(_ref) {
29
28
  if (!showMediaPicker) {
30
29
  return;
31
30
  }
32
- if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert = _api$mediaInsert.commands) !== null && _api$mediaInsert !== void 0 && _api$mediaInsert.showMediaInsertPopup && fg('platform_editor_add_media_from_url_rollout')) {
31
+ if (api !== null && api !== void 0 && (_api$mediaInsert = api.mediaInsert) !== null && _api$mediaInsert !== void 0 && (_api$mediaInsert = _api$mediaInsert.commands) !== null && _api$mediaInsert !== void 0 && _api$mediaInsert.showMediaInsertPopup) {
33
32
  var _api$core, _api$mediaInsert2;
34
33
  var mountInfo = mediaButtonRef.current ? {
35
34
  ref: mediaButtonRef.current,
@@ -42,7 +41,7 @@ export var MediaButton = function MediaButton(_ref) {
42
41
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
43
42
  action: ACTION.OPENED,
44
43
  actionSubject: ACTION_SUBJECT.PICKER,
45
- actionSubjectId: fg('platform_editor_add_media_from_url_rollout') ? ACTION_SUBJECT_ID.PICKER_MEDIA : ACTION_SUBJECT_ID.PICKER_CLOUD,
44
+ actionSubjectId: ACTION_SUBJECT_ID.PICKER_MEDIA,
46
45
  attributes: {
47
46
  inputMethod: INPUT_METHOD.TOOLBAR
48
47
  },
@@ -1,5 +1,14 @@
1
1
  import { jsx } from '@emotion/react';
2
+ import { type MessageDescriptor } from 'react-intl-next';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
2
4
  import type { InsertMenuProps } from './types';
3
5
  export declare const DEFAULT_HEIGHT = 560;
6
+ /**
7
+ * Exported helper to allow testing of InsertMenu whiteboard pinning logic. NOTE: this is
8
+ *not* the ideal way to approach this, quickinsert plugin provides a `getSuggestions`
9
+ method that can be used to get suggestions -> once all experiments are cleaned up,
10
+ they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
11
+ */
12
+ export declare const filterForPinWhiteboardsExperiment: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
4
13
  declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
5
14
  export default InsertMenu;
@@ -1,5 +1,14 @@
1
1
  import { jsx } from '@emotion/react';
2
+ import { type MessageDescriptor } from 'react-intl-next';
3
+ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
2
4
  import type { InsertMenuProps } from './types';
3
5
  export declare const DEFAULT_HEIGHT = 560;
6
+ /**
7
+ * Exported helper to allow testing of InsertMenu whiteboard pinning logic. NOTE: this is
8
+ *not* the ideal way to approach this, quickinsert plugin provides a `getSuggestions`
9
+ method that can be used to get suggestions -> once all experiments are cleaned up,
10
+ they should be unified through `pluginInjectionApi?.quickInsert?.actions.getSuggestions`
11
+ */
12
+ export declare const filterForPinWhiteboardsExperiment: (featuredItems: QuickInsertItem[], formatMessage: (msg: MessageDescriptor) => string) => QuickInsertItem[];
4
13
  declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
5
14
  export default InsertMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "7.0.13",
3
+ "version": "7.0.15",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,34 +30,34 @@
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
32
  "@atlaskit/button": "^23.5.0",
33
- "@atlaskit/editor-plugin-analytics": "^6.1.0",
34
- "@atlaskit/editor-plugin-block-type": "^10.1.0",
35
- "@atlaskit/editor-plugin-code-block": "^8.0.0",
33
+ "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
+ "@atlaskit/editor-plugin-block-type": "^10.2.0",
35
+ "@atlaskit/editor-plugin-code-block": "^8.1.0",
36
36
  "@atlaskit/editor-plugin-connectivity": "^6.0.0",
37
- "@atlaskit/editor-plugin-date": "^8.0.0",
38
- "@atlaskit/editor-plugin-emoji": "^7.3.0",
39
- "@atlaskit/editor-plugin-expand": "^7.1.0",
40
- "@atlaskit/editor-plugin-extension": "^9.0.0",
37
+ "@atlaskit/editor-plugin-date": "^8.1.0",
38
+ "@atlaskit/editor-plugin-emoji": "^7.4.0",
39
+ "@atlaskit/editor-plugin-expand": "^7.2.0",
40
+ "@atlaskit/editor-plugin-extension": "^9.1.0",
41
41
  "@atlaskit/editor-plugin-feature-flags": "^5.0.0",
42
- "@atlaskit/editor-plugin-hyperlink": "^8.0.0",
42
+ "@atlaskit/editor-plugin-hyperlink": "^8.1.0",
43
43
  "@atlaskit/editor-plugin-image-upload": "^6.0.0",
44
- "@atlaskit/editor-plugin-layout": "^6.0.0",
45
- "@atlaskit/editor-plugin-media": "^8.1.0",
46
- "@atlaskit/editor-plugin-media-insert": "^13.0.0",
47
- "@atlaskit/editor-plugin-mentions": "^8.0.0",
48
- "@atlaskit/editor-plugin-metrics": "^7.0.0",
49
- "@atlaskit/editor-plugin-panel": "^8.0.0",
50
- "@atlaskit/editor-plugin-placeholder-text": "^7.0.0",
44
+ "@atlaskit/editor-plugin-layout": "^6.1.0",
45
+ "@atlaskit/editor-plugin-media": "^8.2.0",
46
+ "@atlaskit/editor-plugin-media-insert": "^13.1.0",
47
+ "@atlaskit/editor-plugin-mentions": "^8.2.0",
48
+ "@atlaskit/editor-plugin-metrics": "^7.1.0",
49
+ "@atlaskit/editor-plugin-panel": "^8.1.0",
50
+ "@atlaskit/editor-plugin-placeholder-text": "^7.1.0",
51
51
  "@atlaskit/editor-plugin-primary-toolbar": "^7.0.0",
52
52
  "@atlaskit/editor-plugin-quick-insert": "^6.0.0",
53
- "@atlaskit/editor-plugin-rule": "^6.0.0",
54
- "@atlaskit/editor-plugin-status": "^7.0.0",
55
- "@atlaskit/editor-plugin-table": "^15.1.0",
56
- "@atlaskit/editor-plugin-tasks-and-decisions": "^9.0.0",
53
+ "@atlaskit/editor-plugin-rule": "^6.1.0",
54
+ "@atlaskit/editor-plugin-status": "^7.1.0",
55
+ "@atlaskit/editor-plugin-table": "^15.2.0",
56
+ "@atlaskit/editor-plugin-tasks-and-decisions": "^9.1.0",
57
57
  "@atlaskit/editor-plugin-toolbar": "^3.3.0",
58
- "@atlaskit/editor-plugin-type-ahead": "^6.4.0",
58
+ "@atlaskit/editor-plugin-type-ahead": "^6.5.0",
59
59
  "@atlaskit/editor-prosemirror": "7.0.0",
60
- "@atlaskit/editor-shared-styles": "^3.7.0",
60
+ "@atlaskit/editor-shared-styles": "^3.8.0",
61
61
  "@atlaskit/editor-toolbar": "^0.15.0",
62
62
  "@atlaskit/editor-toolbar-model": "^0.2.0",
63
63
  "@atlaskit/emoji": "^69.6.0",
@@ -65,11 +65,11 @@
65
65
  "@atlaskit/icon": "^28.5.0",
66
66
  "@atlaskit/icon-lab": "^5.10.0",
67
67
  "@atlaskit/platform-feature-flags": "^1.1.0",
68
- "@atlaskit/primitives": "^15.0.0",
68
+ "@atlaskit/primitives": "^16.0.0",
69
69
  "@atlaskit/theme": "^21.0.0",
70
- "@atlaskit/tmp-editor-statsig": "^13.13.0",
70
+ "@atlaskit/tmp-editor-statsig": "^13.16.0",
71
71
  "@atlaskit/tokens": "^7.0.0",
72
- "@atlaskit/tooltip": "^20.5.0",
72
+ "@atlaskit/tooltip": "^20.6.0",
73
73
  "@babel/runtime": "^7.0.0",
74
74
  "@emotion/react": "^11.7.1",
75
75
  "bind-event-listener": "^3.0.0",
@@ -78,7 +78,7 @@
78
78
  "react-virtualized": "^9.22.6"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^110.13.0",
81
+ "@atlaskit/editor-common": "^110.15.0",
82
82
  "react": "^18.2.0",
83
83
  "react-dom": "^18.2.0",
84
84
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -133,15 +133,15 @@
133
133
  "platform_editor_ease_of_use_metrics": {
134
134
  "type": "boolean"
135
135
  },
136
- "platform_editor_add_media_from_url_rollout": {
137
- "type": "boolean"
138
- },
139
136
  "platform_editor_refactor_view_more": {
140
137
  "type": "boolean"
141
138
  },
142
139
  "confluence-whiteboards-quick-insert-eligible": {
143
140
  "type": "boolean"
144
141
  },
142
+ "confluence-whiteboards-quick-insert-l10n-eligible": {
143
+ "type": "boolean"
144
+ },
145
145
  "platform_editor_remove_unused_block_insert_props": {
146
146
  "type": "boolean"
147
147
  }