@atlaskit/editor-plugin-media 9.8.1 → 9.9.1

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,25 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 9.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`31ee998a097db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/31ee998a097db) -
8
+ Replace expValEquals/expValEqualsNoExposure with editorExperiment for platform_synced_block
9
+ experiment checks
10
+ - Updated dependencies
11
+
12
+ ## 9.9.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`528cef02f2f27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/528cef02f2f27) -
17
+ EDITOR-5532 improve duplicate media error handling in editor
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 9.8.1
4
24
 
5
25
  ### Patch Changes
@@ -18,6 +18,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
18
18
  var _mediaCommon = require("@atlaskit/media-common");
19
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
22
  var _lazyMediaGroup = require("./nodeviews/lazy-media-group");
22
23
  var _lazyMediaInline = require("./nodeviews/lazy-media-inline");
23
24
  var _mediaNodeView = require("./nodeviews/mediaNodeView");
@@ -128,23 +129,36 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
128
129
  actions: {
129
130
  handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason, nestedUnder) {
130
131
  var _api$analytics;
131
- if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
132
+ if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') && !(0, _expValEquals.expValEquals)('platform_editor_media_reliability_observability', 'isEnabled', true)) {
132
133
  // Only fire the errored event once per media node
133
134
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
134
135
  return;
135
136
  }
136
137
  mediaErrorLocalIds.add(node.attrs.localId);
137
138
  }
139
+ var isDuplicateError = false;
140
+ if ((0, _expValEquals.expValEquals)('platform_editor_media_reliability_observability', 'isEnabled', true)) {
141
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
142
+ // we mark duplicate errors in the case of nested media nodes
143
+ // renderering to avoid firing multiple errored events for the same underlying issue,
144
+ // which can happen more often with nested media nodes
145
+ isDuplicateError = true;
146
+ } else {
147
+ mediaErrorLocalIds.add(node.attrs.localId);
148
+ }
149
+ }
138
150
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
139
151
  action: _analytics.ACTION.ERRORED,
140
152
  actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
141
153
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
142
154
  eventType: _analytics.EVENT_TYPE.UI,
143
- attributes: _objectSpread({
155
+ attributes: _objectSpread(_objectSpread({
144
156
  reason: reason,
145
157
  external: node.attrs.__external
146
- }, nestedUnder && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? {
158
+ }, nestedUnder && (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? {
147
159
  nestedUnder: nestedUnder
160
+ } : {}), (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? {
161
+ isDuplicateError: isDuplicateError
148
162
  } : {})
149
163
  });
150
164
  },
@@ -9,6 +9,7 @@ import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
9
9
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
13
  import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
13
14
  import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
14
15
  import { ReactMediaNode } from './nodeviews/mediaNodeView';
@@ -120,13 +121,24 @@ export const mediaPlugin = ({
120
121
  actions: {
121
122
  handleMediaNodeRenderError: (node, reason, nestedUnder) => {
122
123
  var _api$analytics;
123
- if (!fg('platform_synced_block_patch_5')) {
124
+ if (!fg('platform_synced_block_patch_5') && !expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
124
125
  // Only fire the errored event once per media node
125
126
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
126
127
  return;
127
128
  }
128
129
  mediaErrorLocalIds.add(node.attrs.localId);
129
130
  }
131
+ let isDuplicateError = false;
132
+ if (expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
133
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
134
+ // we mark duplicate errors in the case of nested media nodes
135
+ // renderering to avoid firing multiple errored events for the same underlying issue,
136
+ // which can happen more often with nested media nodes
137
+ isDuplicateError = true;
138
+ } else {
139
+ mediaErrorLocalIds.add(node.attrs.localId);
140
+ }
141
+ }
130
142
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
131
143
  action: ACTION.ERRORED,
132
144
  actionSubject: ACTION_SUBJECT.EDITOR,
@@ -135,8 +147,11 @@ export const mediaPlugin = ({
135
147
  attributes: {
136
148
  reason,
137
149
  external: node.attrs.__external,
138
- ...(nestedUnder && expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
150
+ ...(nestedUnder && editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_5') ? {
139
151
  nestedUnder
152
+ } : {}),
153
+ ...(editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_5') ? {
154
+ isDuplicateError
140
155
  } : {})
141
156
  }
142
157
  });
@@ -12,6 +12,7 @@ import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
12
12
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
16
  import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
16
17
  import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
17
18
  import { ReactMediaNode } from './nodeviews/mediaNodeView';
@@ -119,23 +120,36 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
119
120
  actions: {
120
121
  handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason, nestedUnder) {
121
122
  var _api$analytics;
122
- if (!fg('platform_synced_block_patch_5')) {
123
+ if (!fg('platform_synced_block_patch_5') && !expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
123
124
  // Only fire the errored event once per media node
124
125
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
125
126
  return;
126
127
  }
127
128
  mediaErrorLocalIds.add(node.attrs.localId);
128
129
  }
130
+ var isDuplicateError = false;
131
+ if (expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
132
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
133
+ // we mark duplicate errors in the case of nested media nodes
134
+ // renderering to avoid firing multiple errored events for the same underlying issue,
135
+ // which can happen more often with nested media nodes
136
+ isDuplicateError = true;
137
+ } else {
138
+ mediaErrorLocalIds.add(node.attrs.localId);
139
+ }
140
+ }
129
141
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
130
142
  action: ACTION.ERRORED,
131
143
  actionSubject: ACTION_SUBJECT.EDITOR,
132
144
  actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
133
145
  eventType: EVENT_TYPE.UI,
134
- attributes: _objectSpread({
146
+ attributes: _objectSpread(_objectSpread({
135
147
  reason: reason,
136
148
  external: node.attrs.__external
137
- }, nestedUnder && expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
149
+ }, nestedUnder && editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_5') ? {
138
150
  nestedUnder: nestedUnder
151
+ } : {}), editorExperiment('platform_synced_block', true) && fg('platform_synced_block_patch_5') ? {
152
+ isDuplicateError: isDuplicateError
139
153
  } : {})
140
154
  });
141
155
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "9.8.1",
3
+ "version": "9.9.1",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^18.0.0",
67
67
  "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^22.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^34.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^35.0.0",
70
70
  "@atlaskit/tokens": "^11.0.0",
71
71
  "@atlaskit/tooltip": "^20.14.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^111.28.0",
81
+ "@atlaskit/editor-common": "^111.30.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",