@atlaskit/editor-plugin-media 9.8.1 → 9.9.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,16 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 9.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`528cef02f2f27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/528cef02f2f27) -
8
+ EDITOR-5532 improve duplicate media error handling in editor
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 9.8.1
4
15
 
5
16
  ### Patch Changes
@@ -128,23 +128,36 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
128
128
  actions: {
129
129
  handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason, nestedUnder) {
130
130
  var _api$analytics;
131
- if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_5')) {
131
+ if (!(0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') && !(0, _expValEquals.expValEquals)('platform_editor_media_reliability_observability', 'isEnabled', true)) {
132
132
  // Only fire the errored event once per media node
133
133
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
134
134
  return;
135
135
  }
136
136
  mediaErrorLocalIds.add(node.attrs.localId);
137
137
  }
138
+ var isDuplicateError = false;
139
+ if ((0, _expValEquals.expValEquals)('platform_editor_media_reliability_observability', 'isEnabled', true)) {
140
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
141
+ // we mark duplicate errors in the case of nested media nodes
142
+ // renderering to avoid firing multiple errored events for the same underlying issue,
143
+ // which can happen more often with nested media nodes
144
+ isDuplicateError = true;
145
+ } else {
146
+ mediaErrorLocalIds.add(node.attrs.localId);
147
+ }
148
+ }
138
149
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
139
150
  action: _analytics.ACTION.ERRORED,
140
151
  actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
141
152
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
142
153
  eventType: _analytics.EVENT_TYPE.UI,
143
- attributes: _objectSpread({
154
+ attributes: _objectSpread(_objectSpread({
144
155
  reason: reason,
145
156
  external: node.attrs.__external
146
157
  }, nestedUnder && (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? {
147
158
  nestedUnder: nestedUnder
159
+ } : {}), (0, _expValEquals.expValEquals)('platform_synced_block', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_5') ? {
160
+ isDuplicateError: isDuplicateError
148
161
  } : {})
149
162
  });
150
163
  },
@@ -120,13 +120,24 @@ export const mediaPlugin = ({
120
120
  actions: {
121
121
  handleMediaNodeRenderError: (node, reason, nestedUnder) => {
122
122
  var _api$analytics;
123
- if (!fg('platform_synced_block_patch_5')) {
123
+ if (!fg('platform_synced_block_patch_5') && !expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
124
124
  // Only fire the errored event once per media node
125
125
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
126
126
  return;
127
127
  }
128
128
  mediaErrorLocalIds.add(node.attrs.localId);
129
129
  }
130
+ let 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
+ }
130
141
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
131
142
  action: ACTION.ERRORED,
132
143
  actionSubject: ACTION_SUBJECT.EDITOR,
@@ -137,6 +148,9 @@ export const mediaPlugin = ({
137
148
  external: node.attrs.__external,
138
149
  ...(nestedUnder && expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
139
150
  nestedUnder
151
+ } : {}),
152
+ ...(expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
153
+ isDuplicateError
140
154
  } : {})
141
155
  }
142
156
  });
@@ -119,23 +119,36 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
119
119
  actions: {
120
120
  handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason, nestedUnder) {
121
121
  var _api$analytics;
122
- if (!fg('platform_synced_block_patch_5')) {
122
+ if (!fg('platform_synced_block_patch_5') && !expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
123
123
  // Only fire the errored event once per media node
124
124
  if (mediaErrorLocalIds.has(node.attrs.localId)) {
125
125
  return;
126
126
  }
127
127
  mediaErrorLocalIds.add(node.attrs.localId);
128
128
  }
129
+ var isDuplicateError = false;
130
+ if (expValEquals('platform_editor_media_reliability_observability', 'isEnabled', true)) {
131
+ if (mediaErrorLocalIds.has(node.attrs.localId)) {
132
+ // we mark duplicate errors in the case of nested media nodes
133
+ // renderering to avoid firing multiple errored events for the same underlying issue,
134
+ // which can happen more often with nested media nodes
135
+ isDuplicateError = true;
136
+ } else {
137
+ mediaErrorLocalIds.add(node.attrs.localId);
138
+ }
139
+ }
129
140
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
130
141
  action: ACTION.ERRORED,
131
142
  actionSubject: ACTION_SUBJECT.EDITOR,
132
143
  actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
133
144
  eventType: EVENT_TYPE.UI,
134
- attributes: _objectSpread({
145
+ attributes: _objectSpread(_objectSpread({
135
146
  reason: reason,
136
147
  external: node.attrs.__external
137
148
  }, nestedUnder && expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
138
149
  nestedUnder: nestedUnder
150
+ } : {}), expValEquals('platform_synced_block', 'isEnabled', true) && fg('platform_synced_block_patch_5') ? {
151
+ isDuplicateError: isDuplicateError
139
152
  } : {})
140
153
  });
141
154
  },
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.0",
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": "^34.3.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.29.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",