@atlaskit/editor-plugin-media 18.1.0 → 18.1.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,24 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 18.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 18.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`08bf773f7599a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08bf773f7599a) -
14
+ Migrate experiments to use the new platform experiment API. This major release removes the
15
+ migrated experiment entries from `@atlaskit/tmp-editor-statsig`'s `editorExperimentsConfig` and
16
+ test overrides. Consumers must replace legacy `expVal`/`expValEquals` calls with
17
+ `@atlaskit/platform-feature-experiments` APIs, using `isExperimentEnabled` for boolean `isEnabled`
18
+ experiments and `expVal` for parameterized experiments; use `mockExpEnabled`/`mockExpDisabled` in
19
+ tests.
20
+ - Updated dependencies
21
+
3
22
  ## 18.1.0
4
23
 
5
24
  ### Minor Changes
@@ -25,6 +25,7 @@ var _utils = require("@atlaskit/editor-common/utils");
25
25
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
26
26
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
27
27
  var _mediaCard = require("@atlaskit/media-card");
28
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
28
29
  var _fg = require("@atlaskit/platform-feature-flags/fg");
29
30
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
30
31
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
@@ -119,7 +120,7 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
119
120
  };
120
121
  }));
121
122
  (0, _defineProperty2.default)(_this, "onPreviewRender", function (fileId) {
122
- if ((0, _expValEquals.expValEquals)('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true)) {
123
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('aifc_page_create_with_rovo_include_infographics')) {
123
124
  var _this$props$pluginInj2;
124
125
  (_this$props$pluginInj2 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 || (_this$props$pluginInj2 = _this$props$pluginInj2.core) === null || _this$props$pluginInj2 === void 0 || _this$props$pluginInj2.actions.execute(function (_ref3) {
125
126
  var tr = _ref3.tr;
@@ -386,7 +387,7 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
386
387
  // CWR (create-with-Rovo) infographics get a distinct loading treatment so the
387
388
  // generic media type icon isn't shown while the image streams in. Gated on the
388
389
  // existing infographics experiment.
389
- var isCWR = !!this.props.isCwrAIGenerating && (0, _expValEquals.expValEquals)('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true);
390
+ var isCWR = !!this.props.isCwrAIGenerating && (0, _isExperimentEnabled.isExperimentEnabled)('aifc_page_create_with_rovo_include_infographics');
390
391
  return /*#__PURE__*/_react.default.createElement(_styles.MediaCardWrapper, {
391
392
  dimensions: originalDimensions,
392
393
  onContextMenu: this.selectMediaSingle,
@@ -15,6 +15,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
15
15
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
16
16
  var _state = require("@atlaskit/editor-prosemirror/state");
17
17
  var _view = require("@atlaskit/editor-prosemirror/view");
18
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
18
19
  var _fg = require("@atlaskit/platform-feature-flags/fg");
19
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
21
  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; }
@@ -160,7 +161,7 @@ function createAIGeneratingDecorationPlugin() {
160
161
  var _meta$source;
161
162
  var ids = new Map(pluginState.generatingMediaIds);
162
163
  ids.set(meta.mediaId, (_meta$source = meta.source) !== null && _meta$source !== void 0 ? _meta$source : 'maui');
163
- var _hasCwrIds = (0, _expValEquals.expValEquals)('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && (0, _toConsumableArray2.default)(ids.values()).some(function (s) {
164
+ var _hasCwrIds = (0, _isExperimentEnabled.isExperimentEnabled)('aifc_page_create_with_rovo_include_infographics') && (0, _toConsumableArray2.default)(ids.values()).some(function (s) {
164
165
  return s === 'cwr';
165
166
  });
166
167
  var newDecoSet = buildDecorationSet(newState.doc, ids);
@@ -180,7 +181,7 @@ function createAIGeneratingDecorationPlugin() {
180
181
  {
181
182
  var _ids = new Map(pluginState.generatingMediaIds);
182
183
  _ids.delete(meta.mediaId);
183
- var _hasCwrIds2 = (0, _expValEquals.expValEquals)('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && (0, _toConsumableArray2.default)(_ids.values()).some(function (s) {
184
+ var _hasCwrIds2 = (0, _isExperimentEnabled.isExperimentEnabled)('aifc_page_create_with_rovo_include_infographics') && (0, _toConsumableArray2.default)(_ids.values()).some(function (s) {
184
185
  return s === 'cwr';
185
186
  });
186
187
  var _newDecoSet = buildDecorationSet(newState.doc, _ids);
@@ -208,7 +209,7 @@ function createAIGeneratingDecorationPlugin() {
208
209
  // Rebuild decorations from scratch because CWR streaming replaces the
209
210
  // entire document on every chunk and map() drops decorations whose
210
211
  // positions can't be mapped.
211
- var hasCwrIds = (0, _expValEquals.expValEquals)('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && (0, _toConsumableArray2.default)(pluginState.generatingMediaIds.values()).some(function (s) {
212
+ var hasCwrIds = (0, _isExperimentEnabled.isExperimentEnabled)('aifc_page_create_with_rovo_include_infographics') && (0, _toConsumableArray2.default)(pluginState.generatingMediaIds.values()).some(function (s) {
212
213
  return s === 'cwr';
213
214
  });
214
215
  if (tr.docChanged && hasCwrIds) {
@@ -10,6 +10,7 @@ import { setNodeSelection, setTextSelection, withImageLoader } from '@atlaskit/e
10
10
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
11
11
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
12
12
  import { Card, CardLoading } from '@atlaskit/media-card';
13
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
13
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
14
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
@@ -89,7 +90,7 @@ export class MediaNode extends Component {
89
90
  };
90
91
  }));
91
92
  _defineProperty(this, "onPreviewRender", fileId => {
92
- if (expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true)) {
93
+ if (isExperimentEnabled('aifc_page_create_with_rovo_include_infographics')) {
93
94
  var _this$props$pluginInj2, _this$props$pluginInj3;
94
95
  (_this$props$pluginInj2 = this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.core) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.actions.execute(({
95
96
  tr
@@ -328,7 +329,7 @@ export class MediaNode extends Component {
328
329
  // CWR (create-with-Rovo) infographics get a distinct loading treatment so the
329
330
  // generic media type icon isn't shown while the image streams in. Gated on the
330
331
  // existing infographics experiment.
331
- const isCWR = !!this.props.isCwrAIGenerating && expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true);
332
+ const isCWR = !!this.props.isCwrAIGenerating && isExperimentEnabled('aifc_page_create_with_rovo_include_infographics');
332
333
  return /*#__PURE__*/React.createElement(MediaCardWrapper, {
333
334
  dimensions: originalDimensions,
334
335
  onContextMenu: this.selectMediaSingle,
@@ -1,6 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
5
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
 
@@ -141,7 +142,7 @@ export function createAIGeneratingDecorationPlugin() {
141
142
  var _meta$source;
142
143
  const ids = new Map(pluginState.generatingMediaIds);
143
144
  ids.set(meta.mediaId, (_meta$source = meta.source) !== null && _meta$source !== void 0 ? _meta$source : 'maui');
144
- const hasCwrIds = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && [...ids.values()].some(s => s === 'cwr');
145
+ const hasCwrIds = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && [...ids.values()].some(s => s === 'cwr');
145
146
  const newDecoSet = buildDecorationSet(newState.doc, ids);
146
147
  if (hasCwrIds && newDecoSet.find().length === 0 && ids.size > 0) {
147
148
  // CWR fallback — keep existing decorations during transient doc absence
@@ -159,7 +160,7 @@ export function createAIGeneratingDecorationPlugin() {
159
160
  {
160
161
  const ids = new Map(pluginState.generatingMediaIds);
161
162
  ids.delete(meta.mediaId);
162
- const hasCwrIds = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && [...ids.values()].some(s => s === 'cwr');
163
+ const hasCwrIds = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && [...ids.values()].some(s => s === 'cwr');
163
164
  const newDecoSet = buildDecorationSet(newState.doc, ids);
164
165
  if (hasCwrIds && newDecoSet.find().length === 0) {
165
166
  // CWR fallback — keep existing decorations during transient doc absence
@@ -185,7 +186,7 @@ export function createAIGeneratingDecorationPlugin() {
185
186
  // Rebuild decorations from scratch because CWR streaming replaces the
186
187
  // entire document on every chunk and map() drops decorations whose
187
188
  // positions can't be mapped.
188
- const hasCwrIds = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && [...pluginState.generatingMediaIds.values()].some(s => s === 'cwr');
189
+ const hasCwrIds = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && [...pluginState.generatingMediaIds.values()].some(s => s === 'cwr');
189
190
  if (tr.docChanged && hasCwrIds) {
190
191
  const rebuilt = buildDecorationSet(newState.doc, pluginState.generatingMediaIds);
191
192
  const prevCount = pluginState.decorationSet.find().length;
@@ -19,6 +19,7 @@ import { setNodeSelection, setTextSelection, withImageLoader } from '@atlaskit/e
19
19
  import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
20
20
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
21
21
  import { Card, CardLoading } from '@atlaskit/media-card';
22
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
22
23
  import { fg } from '@atlaskit/platform-feature-flags/fg';
23
24
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
24
25
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
@@ -111,7 +112,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
111
112
  };
112
113
  }));
113
114
  _defineProperty(_this, "onPreviewRender", function (fileId) {
114
- if (expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true)) {
115
+ if (isExperimentEnabled('aifc_page_create_with_rovo_include_infographics')) {
115
116
  var _this$props$pluginInj2;
116
117
  (_this$props$pluginInj2 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 || (_this$props$pluginInj2 = _this$props$pluginInj2.core) === null || _this$props$pluginInj2 === void 0 || _this$props$pluginInj2.actions.execute(function (_ref3) {
117
118
  var tr = _ref3.tr;
@@ -378,7 +379,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
378
379
  // CWR (create-with-Rovo) infographics get a distinct loading treatment so the
379
380
  // generic media type icon isn't shown while the image streams in. Gated on the
380
381
  // existing infographics experiment.
381
- var isCWR = !!this.props.isCwrAIGenerating && expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true);
382
+ var isCWR = !!this.props.isCwrAIGenerating && isExperimentEnabled('aifc_page_create_with_rovo_include_infographics');
382
383
  return /*#__PURE__*/React.createElement(MediaCardWrapper, {
383
384
  dimensions: originalDimensions,
384
385
  onContextMenu: this.selectMediaSingle,
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
9
  import { fg } from '@atlaskit/platform-feature-flags/fg';
9
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
 
@@ -149,7 +150,7 @@ export function createAIGeneratingDecorationPlugin() {
149
150
  var _meta$source;
150
151
  var ids = new Map(pluginState.generatingMediaIds);
151
152
  ids.set(meta.mediaId, (_meta$source = meta.source) !== null && _meta$source !== void 0 ? _meta$source : 'maui');
152
- var _hasCwrIds = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && _toConsumableArray(ids.values()).some(function (s) {
153
+ var _hasCwrIds = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && _toConsumableArray(ids.values()).some(function (s) {
153
154
  return s === 'cwr';
154
155
  });
155
156
  var newDecoSet = buildDecorationSet(newState.doc, ids);
@@ -169,7 +170,7 @@ export function createAIGeneratingDecorationPlugin() {
169
170
  {
170
171
  var _ids = new Map(pluginState.generatingMediaIds);
171
172
  _ids.delete(meta.mediaId);
172
- var _hasCwrIds2 = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && _toConsumableArray(_ids.values()).some(function (s) {
173
+ var _hasCwrIds2 = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && _toConsumableArray(_ids.values()).some(function (s) {
173
174
  return s === 'cwr';
174
175
  });
175
176
  var _newDecoSet = buildDecorationSet(newState.doc, _ids);
@@ -197,7 +198,7 @@ export function createAIGeneratingDecorationPlugin() {
197
198
  // Rebuild decorations from scratch because CWR streaming replaces the
198
199
  // entire document on every chunk and map() drops decorations whose
199
200
  // positions can't be mapped.
200
- var hasCwrIds = expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true) && _toConsumableArray(pluginState.generatingMediaIds.values()).some(function (s) {
201
+ var hasCwrIds = isExperimentEnabled('aifc_page_create_with_rovo_include_infographics') && _toConsumableArray(pluginState.generatingMediaIds.values()).some(function (s) {
201
202
  return s === 'cwr';
202
203
  });
203
204
  if (tr.docChanged && hasCwrIds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "18.1.0",
3
+ "version": "18.1.2",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/icon-lab": "^7.7.0",
51
51
  "@atlaskit/media-card": "^81.9.0",
52
52
  "@atlaskit/media-client": "^37.6.0",
53
- "@atlaskit/media-client-react": "^6.3.0",
53
+ "@atlaskit/media-client-react": "^6.4.0",
54
54
  "@atlaskit/media-common": "^14.6.0",
55
55
  "@atlaskit/media-filmstrip": "^52.4.0",
56
56
  "@atlaskit/media-picker": "^72.4.0",
@@ -60,8 +60,8 @@
60
60
  "@atlaskit/platform-feature-flags": "^2.2.0",
61
61
  "@atlaskit/primitives": "^22.5.0",
62
62
  "@atlaskit/textfield": "^10.2.0",
63
- "@atlaskit/tmp-editor-statsig": "^168.0.0",
64
- "@atlaskit/tokens": "^16.10.0",
63
+ "@atlaskit/tmp-editor-statsig": "^170.0.0",
64
+ "@atlaskit/tokens": "^16.11.0",
65
65
  "@atlaskit/tooltip": "^24.3.0",
66
66
  "@babel/runtime": "^7.0.0",
67
67
  "@emotion/react": "^11.7.1",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^120.9.0",
75
+ "@atlaskit/editor-common": "^120.10.0",
76
76
  "@atlaskit/media-core": "^38.2.0",
77
77
  "react": "^18.2.0 || ^19.2.0",
78
78
  "react-dom": "^18.2.0 || ^19.2.0",