@atlaskit/editor-plugin-insert-block 1.9.0 → 1.9.2

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
+ ## 1.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.9.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#131878](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131878)
14
+ [`705fe39cae267`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/705fe39cae267) -
15
+ [ED-24597] Update to log `platform_editor_basic_text_transformations` exposure event only for
16
+ users meet all of 3 checks:
17
+
18
+ - Are enrolled to the experiment
19
+ - Have AI disabled
20
+ - Make top level text selection
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 1.9.0
4
25
 
5
26
  ### Minor Changes
@@ -13,6 +13,7 @@ var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
14
14
  var _types = require("@atlaskit/editor-common/types");
15
15
  var _consts = require("@atlaskit/editor-plugin-block-type/consts");
16
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
17
  var _switch = _interopRequireDefault(require("./assets/switch"));
17
18
  var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
18
19
  var _transformOptions = require("./ui/transformOptions");
@@ -126,33 +127,40 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
126
127
  selectionToolbar: function selectionToolbar(state, intl) {
127
128
  var _api$featureFlags;
128
129
  var $from = state.selection.$from;
129
- if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags !== void 0 && _api$featureFlags.basicTextTransformations) || $from.depth !== 1) {
130
+ var isEligible =
131
+ // basicTextTransformations is used to present AI enablement status to avoid adding editor props
132
+ (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.basicTextTransformations) && $from.depth === 1;
133
+ if (!isEligible) {
130
134
  return;
131
135
  }
132
- var formatMessage = intl.formatMessage;
133
- var options = (0, _transformOptions.transformationOptions)(api).map(function (option) {
134
- var IconBefore = option.icon;
136
+ if ((0, _experiments.editorExperiment)('basic-text-transformations', true, {
137
+ exposure: true
138
+ })) {
139
+ var formatMessage = intl.formatMessage;
140
+ var _options = (0, _transformOptions.transformationOptions)(api).map(function (option) {
141
+ var IconBefore = option.icon;
142
+ return {
143
+ title: formatMessage(option.title),
144
+ icon: /*#__PURE__*/_react.default.createElement(IconBefore, {
145
+ label: ""
146
+ }),
147
+ onClick: function onClick(state, dispatch) {
148
+ var _option$command;
149
+ (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, _analytics.INPUT_METHOD.FLOATING_TB)(state, dispatch);
150
+ return true;
151
+ }
152
+ };
153
+ });
135
154
  return {
136
- title: formatMessage(option.title),
137
- icon: /*#__PURE__*/_react.default.createElement(IconBefore, {
138
- label: ""
139
- }),
140
- onClick: function onClick(state, dispatch) {
141
- var _option$command;
142
- (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, _analytics.INPUT_METHOD.FLOATING_TB)(state, dispatch);
143
- return true;
144
- }
155
+ items: [{
156
+ type: 'dropdown',
157
+ title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
158
+ iconBefore: _switch.default,
159
+ options: _options
160
+ }],
161
+ rank: -9
145
162
  };
146
- });
147
- return {
148
- items: [{
149
- type: 'dropdown',
150
- title: formatMessage(_messages.toolbarInsertBlockMessages.turnInto),
151
- iconBefore: _switch.default,
152
- options: options
153
- }],
154
- rank: -9
155
- };
163
+ }
156
164
  }
157
165
  },
158
166
  usePluginHook: function usePluginHook() {
@@ -5,6 +5,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
6
  import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import SwitchIcon from './assets/switch';
9
10
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
10
11
  import { transformationOptions } from './ui/transformOptions';
@@ -119,35 +120,42 @@ export const insertBlockPlugin = ({
119
120
  $from
120
121
  }
121
122
  } = state;
122
- if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags$sha !== void 0 && _api$featureFlags$sha.basicTextTransformations) || $from.depth !== 1) {
123
+ const isEligible =
124
+ // basicTextTransformations is used to present AI enablement status to avoid adding editor props
125
+ (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.basicTextTransformations) && $from.depth === 1;
126
+ if (!isEligible) {
123
127
  return;
124
128
  }
125
- const {
126
- formatMessage
127
- } = intl;
128
- const options = transformationOptions(api).map(option => {
129
- const IconBefore = option.icon;
129
+ if (editorExperiment('basic-text-transformations', true, {
130
+ exposure: true
131
+ })) {
132
+ const {
133
+ formatMessage
134
+ } = intl;
135
+ const options = transformationOptions(api).map(option => {
136
+ const IconBefore = option.icon;
137
+ return {
138
+ title: formatMessage(option.title),
139
+ icon: /*#__PURE__*/React.createElement(IconBefore, {
140
+ label: ""
141
+ }),
142
+ onClick: (state, dispatch) => {
143
+ var _option$command;
144
+ (_option$command = option.command) === null || _option$command === void 0 ? void 0 : _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
145
+ return true;
146
+ }
147
+ };
148
+ });
130
149
  return {
131
- title: formatMessage(option.title),
132
- icon: /*#__PURE__*/React.createElement(IconBefore, {
133
- label: ""
134
- }),
135
- onClick: (state, dispatch) => {
136
- var _option$command;
137
- (_option$command = option.command) === null || _option$command === void 0 ? void 0 : _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
138
- return true;
139
- }
150
+ items: [{
151
+ type: 'dropdown',
152
+ title: formatMessage(messages.turnInto),
153
+ iconBefore: SwitchIcon,
154
+ options
155
+ }],
156
+ rank: -9
140
157
  };
141
- });
142
- return {
143
- items: [{
144
- type: 'dropdown',
145
- title: formatMessage(messages.turnInto),
146
- iconBefore: SwitchIcon,
147
- options
148
- }],
149
- rank: -9
150
- };
158
+ }
151
159
  }
152
160
  },
153
161
  usePluginHook: () => {
@@ -5,6 +5,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
6
  import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
9
  import SwitchIcon from './assets/switch';
9
10
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
10
11
  import { transformationOptions } from './ui/transformOptions';
@@ -116,33 +117,40 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
116
117
  selectionToolbar: function selectionToolbar(state, intl) {
117
118
  var _api$featureFlags;
118
119
  var $from = state.selection.$from;
119
- if (!(api !== null && api !== void 0 && (_api$featureFlags = api.featureFlags) !== null && _api$featureFlags !== void 0 && (_api$featureFlags = _api$featureFlags.sharedState.currentState()) !== null && _api$featureFlags !== void 0 && _api$featureFlags.basicTextTransformations) || $from.depth !== 1) {
120
+ var isEligible =
121
+ // basicTextTransformations is used to present AI enablement status to avoid adding editor props
122
+ (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.basicTextTransformations) && $from.depth === 1;
123
+ if (!isEligible) {
120
124
  return;
121
125
  }
122
- var formatMessage = intl.formatMessage;
123
- var options = transformationOptions(api).map(function (option) {
124
- var IconBefore = option.icon;
126
+ if (editorExperiment('basic-text-transformations', true, {
127
+ exposure: true
128
+ })) {
129
+ var formatMessage = intl.formatMessage;
130
+ var _options = transformationOptions(api).map(function (option) {
131
+ var IconBefore = option.icon;
132
+ return {
133
+ title: formatMessage(option.title),
134
+ icon: /*#__PURE__*/React.createElement(IconBefore, {
135
+ label: ""
136
+ }),
137
+ onClick: function onClick(state, dispatch) {
138
+ var _option$command;
139
+ (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
140
+ return true;
141
+ }
142
+ };
143
+ });
125
144
  return {
126
- title: formatMessage(option.title),
127
- icon: /*#__PURE__*/React.createElement(IconBefore, {
128
- label: ""
129
- }),
130
- onClick: function onClick(state, dispatch) {
131
- var _option$command;
132
- (_option$command = option.command) === null || _option$command === void 0 || _option$command.call(option, INPUT_METHOD.FLOATING_TB)(state, dispatch);
133
- return true;
134
- }
145
+ items: [{
146
+ type: 'dropdown',
147
+ title: formatMessage(messages.turnInto),
148
+ iconBefore: SwitchIcon,
149
+ options: _options
150
+ }],
151
+ rank: -9
135
152
  };
136
- });
137
- return {
138
- items: [{
139
- type: 'dropdown',
140
- title: formatMessage(messages.turnInto),
141
- iconBefore: SwitchIcon,
142
- options: options
143
- }],
144
- rank: -9
145
- };
153
+ }
146
154
  }
147
155
  },
148
156
  usePluginHook: function usePluginHook() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,8 +33,8 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^87.12.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.7.0",
36
+ "@atlaskit/editor-common": "^88.0.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.8.0",
38
38
  "@atlaskit/editor-plugin-block-type": "^3.13.0",
39
39
  "@atlaskit/editor-plugin-code-block": "^3.3.0",
40
40
  "@atlaskit/editor-plugin-date": "^2.3.0",
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/editor-plugin-image-upload": "^1.2.0",
47
47
  "@atlaskit/editor-plugin-layout": "^1.7.0",
48
48
  "@atlaskit/editor-plugin-media": "^1.29.0",
49
- "@atlaskit/editor-plugin-mentions": "^2.3.0",
49
+ "@atlaskit/editor-plugin-mentions": "^2.4.0",
50
50
  "@atlaskit/editor-plugin-panel": "^2.3.0",
51
51
  "@atlaskit/editor-plugin-placeholder-text": "^1.7.0",
52
52
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
@@ -59,11 +59,12 @@
59
59
  "@atlaskit/editor-prosemirror": "5.0.1",
60
60
  "@atlaskit/editor-shared-styles": "^2.13.0",
61
61
  "@atlaskit/emoji": "^67.7.0",
62
- "@atlaskit/icon": "^22.13.0",
62
+ "@atlaskit/icon": "^22.14.0",
63
63
  "@atlaskit/platform-feature-flags": "^0.3.0",
64
64
  "@atlaskit/primitives": "^12.0.0",
65
65
  "@atlaskit/theme": "^13.0.0",
66
- "@atlaskit/tokens": "^1.58.0",
66
+ "@atlaskit/tmp-editor-statsig": "^1.2.0",
67
+ "@atlaskit/tokens": "^1.59.0",
67
68
  "@babel/runtime": "^7.0.0",
68
69
  "@emotion/react": "^11.7.1",
69
70
  "bind-event-listener": "^3.0.0",