@atlaskit/editor-plugin-insert-block 3.2.17 → 3.3.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,18 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#174924](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/174924)
8
+ [`5dfbb5e243380`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5dfbb5e243380) -
9
+ adding initial functionality to run experiment to pin whiteboards at the top of the quick insert
10
+ menu
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 3.2.17
4
17
 
5
18
  ### Patch Changes
@@ -22,6 +22,7 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
22
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
23
  var _theme = require("@atlaskit/theme");
24
24
  var _colors = require("@atlaskit/theme/colors");
25
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
26
  var _excluded = ["children"];
26
27
  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; }
27
28
  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; } /**
@@ -145,11 +146,32 @@ var InsertMenu = function InsertMenu(_ref) {
145
146
  isDisabled: true
146
147
  }) : item;
147
148
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
148
- result = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
149
+ var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
150
+ // need to filter on the concatenated list so whiteboards are at the top
151
+ result = filterForPinWhiteboardsExperiment(unfilteredResult);
149
152
  }
150
153
  setItemCount(result.length);
151
154
  return result;
152
155
  }, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode]);
156
+ var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
157
+ // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
158
+ // Need to check if whiteboard options are available, and filter for the cohort
159
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
160
+ if ((0, _platformFeatureFlags.fg)('confluence-whiteboards-quick-insert-eligible')) {
161
+ var featuredWhiteboards = ['Create diagram', 'Create whiteboard'];
162
+ var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
163
+ return featuredWhiteboards.includes(item.title);
164
+ }).length === 2;
165
+ if (featuredWhiteboardsPresent) {
166
+ (0, _expValEquals.expValEquals)('confluence_whiteboards_quick_insert_aa', 'cohort', 'control');
167
+ }
168
+ // removing all whiteboards for now since they aren't present by default, will add more specific logic later.
169
+ return featuredItems.filter(function (item) {
170
+ return !featuredWhiteboards.includes(item.title);
171
+ });
172
+ }
173
+ return featuredItems;
174
+ };
153
175
  var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
154
176
  var onViewMore = (0, _react.useCallback)(function () {
155
177
  var _pluginInjectionApi$c, _pluginInjectionApi$q8;
@@ -18,6 +18,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
18
18
  import { fg } from '@atlaskit/platform-feature-flags';
19
19
  import { borderRadius } from '@atlaskit/theme';
20
20
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
21
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
22
  export const DEFAULT_HEIGHT = 560;
22
23
  const useSharedState = sharedPluginStateHookMigratorFactory(api => {
23
24
  const connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
@@ -122,11 +123,28 @@ const InsertMenu = ({
122
123
  ...item,
123
124
  isDisabled: true
124
125
  } : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
125
- result = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
126
+ const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
127
+ // need to filter on the concatenated list so whiteboards are at the top
128
+ result = filterForPinWhiteboardsExperiment(unfilteredResult);
126
129
  }
127
130
  setItemCount(result.length);
128
131
  return result;
129
132
  }, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.actions, quickInsertDropdownItems, connectivityMode]);
133
+ const filterForPinWhiteboardsExperiment = featuredItems => {
134
+ // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
135
+ // Need to check if whiteboard options are available, and filter for the cohort
136
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
137
+ if (fg('confluence-whiteboards-quick-insert-eligible')) {
138
+ const featuredWhiteboards = ['Create diagram', 'Create whiteboard'];
139
+ const featuredWhiteboardsPresent = featuredItems.filter(item => featuredWhiteboards.includes(item.title)).length === 2;
140
+ if (featuredWhiteboardsPresent) {
141
+ expValEquals('confluence_whiteboards_quick_insert_aa', 'cohort', 'control');
142
+ }
143
+ // removing all whiteboards for now since they aren't present by default, will add more specific logic later.
144
+ return featuredItems.filter(item => !featuredWhiteboards.includes(item.title));
145
+ }
146
+ return featuredItems;
147
+ };
130
148
  const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q9 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q9 === void 0 ? void 0 : (_pluginInjectionApi$q0 = _pluginInjectionApi$q9.sharedState.currentState()) === null || _pluginInjectionApi$q0 === void 0 ? void 0 : _pluginInjectionApi$q0.emptyStateHandler;
131
149
  const onViewMore = useCallback(() => {
132
150
  var _pluginInjectionApi$c, _pluginInjectionApi$q1;
@@ -25,6 +25,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
25
25
  import { fg } from '@atlaskit/platform-feature-flags';
26
26
  import { borderRadius } from '@atlaskit/theme';
27
27
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
28
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
28
29
  export var DEFAULT_HEIGHT = 560;
29
30
  var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
30
31
  var connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
@@ -142,11 +143,32 @@ var InsertMenu = function InsertMenu(_ref) {
142
143
  isDisabled: true
143
144
  }) : item;
144
145
  })) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
145
- result = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
146
+ var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
147
+ // need to filter on the concatenated list so whiteboards are at the top
148
+ result = filterForPinWhiteboardsExperiment(unfilteredResult);
146
149
  }
147
150
  setItemCount(result.length);
148
151
  return result;
149
152
  }, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode]);
153
+ var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
154
+ // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
155
+ // Need to check if whiteboard options are available, and filter for the cohort
156
+ // Takes the original featuredItems list and returns one with the right whiteboard option at the top
157
+ if (fg('confluence-whiteboards-quick-insert-eligible')) {
158
+ var featuredWhiteboards = ['Create diagram', 'Create whiteboard'];
159
+ var featuredWhiteboardsPresent = featuredItems.filter(function (item) {
160
+ return featuredWhiteboards.includes(item.title);
161
+ }).length === 2;
162
+ if (featuredWhiteboardsPresent) {
163
+ expValEquals('confluence_whiteboards_quick_insert_aa', 'cohort', 'control');
164
+ }
165
+ // removing all whiteboards for now since they aren't present by default, will add more specific logic later.
166
+ return featuredItems.filter(function (item) {
167
+ return !featuredWhiteboards.includes(item.title);
168
+ });
169
+ }
170
+ return featuredItems;
171
+ };
150
172
  var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
151
173
  var onViewMore = useCallback(function () {
152
174
  var _pluginInjectionApi$c, _pluginInjectionApi$q8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "3.2.17",
3
+ "version": "3.3.0",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/button": "^23.2.0",
37
- "@atlaskit/editor-common": "^107.0.0",
37
+ "@atlaskit/editor-common": "^107.2.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
39
39
  "@atlaskit/editor-plugin-block-type": "^5.2.0",
40
40
  "@atlaskit/editor-plugin-code-block": "^4.4.0",
@@ -64,13 +64,13 @@
64
64
  "@atlaskit/editor-shared-styles": "^3.4.0",
65
65
  "@atlaskit/emoji": "^69.3.0",
66
66
  "@atlaskit/heading": "^5.2.0",
67
- "@atlaskit/icon": "^27.0.0",
67
+ "@atlaskit/icon": "^27.1.0",
68
68
  "@atlaskit/icon-lab": "^5.0.0",
69
69
  "@atlaskit/platform-feature-flags": "^1.1.0",
70
70
  "@atlaskit/primitives": "^14.9.0",
71
71
  "@atlaskit/theme": "^18.0.0",
72
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
73
- "@atlaskit/tokens": "^5.3.0",
72
+ "@atlaskit/tmp-editor-statsig": "^8.1.0",
73
+ "@atlaskit/tokens": "^5.4.0",
74
74
  "@atlaskit/tooltip": "^20.3.0",
75
75
  "@babel/runtime": "^7.0.0",
76
76
  "@emotion/react": "^11.7.1",
@@ -147,6 +147,9 @@
147
147
  },
148
148
  "platform_editor_refactor_view_more": {
149
149
  "type": "boolean"
150
+ },
151
+ "confluence-whiteboards-quick-insert-eligible": {
152
+ "type": "boolean"
150
153
  }
151
154
  }
152
155
  }