@atlaskit/media-viewer 46.2.2 → 46.5.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,39 @@
1
1
  # @atlaskit/media-viewer
2
2
 
3
+ ## 46.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1a76e2839e6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1a76e2839e6) - Default value for mediaUploadApiV2 Media feature flag set to true.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 46.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [`bfde909c9b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bfde909c9b4) - Add new feature flag mediaUploadApiV2
18
+ - [`35e43fcc798`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35e43fcc798) - Add ufo feature flag logging
19
+ - [`31cf1fff440`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31cf1fff440) - Flagged events with file states processing and uploading for UFO payload
20
+
21
+ ### Patch Changes
22
+
23
+ - [`0ea419d2739`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0ea419d2739) - Enabled UFO logger for all the examples in Media-viewer
24
+ - [`c2ede50a80a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2ede50a80a) - Add media region and environment returned from media API response into failed analytic events.
25
+ - Updated dependencies
26
+
27
+ ## 46.3.0
28
+
29
+ ### Minor Changes
30
+
31
+ - [`d2e212a2676`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2e212a2676) - Added media environment to UFO payload
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+
3
37
  ## 46.2.2
4
38
 
5
39
  ### Patch Changes
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/classnames.js",
4
4
  "module": "../dist/esm/classnames.js",
5
5
  "module:es2019": "../dist/es2019/classnames.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/classnames.d.ts"
7
8
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.componentName = exports.component = void 0;
6
+ exports.componentName = exports.component = exports.LOGGED_FEATURE_FLAG_KEYS = exports.LOGGED_FEATURE_FLAGS = void 0;
7
7
  exports.fireAnalytics = fireAnalytics;
8
8
  exports.getFileAttributes = getFileAttributes;
9
9
  Object.defineProperty(exports, "packageName", {
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "packageVersion", {
18
18
  return _version.version;
19
19
  }
20
20
  });
21
+ exports.relevantFlags = void 0;
21
22
 
22
23
  var _mediaCommon = require("@atlaskit/media-common");
23
24
 
@@ -25,6 +26,20 @@ var _version = require("../version.json");
25
26
 
26
27
  var componentName = 'mediaViewer';
27
28
  exports.component = exports.componentName = componentName;
29
+ var relevantFlags = {
30
+ newCardExperience: false,
31
+ captions: false,
32
+ timestampOnVideo: false,
33
+ observedWidth: false,
34
+ mediaInline: false,
35
+ folderUploads: false,
36
+ mediaUploadApiV2: true
37
+ };
38
+ exports.relevantFlags = relevantFlags;
39
+ var LOGGED_FEATURE_FLAGS = (0, _mediaCommon.filterFeatureFlagNames)(relevantFlags);
40
+ exports.LOGGED_FEATURE_FLAGS = LOGGED_FEATURE_FLAGS;
41
+ var LOGGED_FEATURE_FLAG_KEYS = (0, _mediaCommon.filterFeatureFlagKeysAllProducts)(relevantFlags);
42
+ exports.LOGGED_FEATURE_FLAG_KEYS = LOGGED_FEATURE_FLAG_KEYS;
28
43
 
29
44
  function getFileAttributes(fileState) {
30
45
  if (!fileState) {
@@ -11,8 +11,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
 
12
12
  var _ufo = require("@atlaskit/ufo");
13
13
 
14
+ var _mediaClient = require("@atlaskit/media-client");
15
+
14
16
  var _version = require("../version.json");
15
17
 
18
+ var _ = require(".");
19
+
16
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
21
 
18
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -26,7 +30,8 @@ var getExperience = function getExperience() {
26
30
  component: 'media-viewer'
27
31
  },
28
32
  type: _ufo.ExperienceTypes.Experience,
29
- performanceType: _ufo.ExperiencePerformanceTypes.InlineResult
33
+ performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
34
+ featureFlags: _.LOGGED_FEATURE_FLAG_KEYS
30
35
  };
31
36
  ufoExperience = new _ufo.UFOExperience('media-file', inlineExperience);
32
37
  }
@@ -42,11 +47,12 @@ exports.startMediaFileUfoExperience = startMediaFileUfoExperience;
42
47
 
43
48
  var succeedMediaFileUfoExperience = function succeedMediaFileUfoExperience(properties) {
44
49
  getExperience().success({
45
- metadata: {
46
- fileAttributes: properties,
50
+ metadata: _objectSpread(_objectSpread({}, properties), {}, {
47
51
  packageName: _version.name,
48
- packageVersion: _version.version
49
- }
52
+ packageVersion: _version.version,
53
+ mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
54
+ mediaRegion: (0, _mediaClient.getMediaRegion)()
55
+ })
50
56
  });
51
57
  };
52
58
 
@@ -55,7 +61,9 @@ exports.succeedMediaFileUfoExperience = succeedMediaFileUfoExperience;
55
61
  var failMediaFileUfoExperience = function failMediaFileUfoExperience(properties) {
56
62
  var refinedMetadata = _objectSpread(_objectSpread({}, properties), {}, {
57
63
  packageName: _version.name,
58
- packageVersion: _version.version
64
+ packageVersion: _version.version,
65
+ mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
66
+ mediaRegion: (0, _mediaClient.getMediaRegion)()
59
67
  });
60
68
 
61
69
  getExperience().failure({
@@ -109,7 +109,9 @@ var ErrorMessage = /*#__PURE__*/function (_React$Component) {
109
109
  var payload = ErrorMessage.getEventPayload(error, fileId, fileState);
110
110
  (0, _analytics.fireAnalytics)(payload, props);
111
111
 
112
- var rawPayload = _objectSpread({}, payload === null || payload === void 0 ? void 0 : payload.attributes);
112
+ var rawPayload = _objectSpread(_objectSpread({}, payload === null || payload === void 0 ? void 0 : payload.attributes), {}, {
113
+ fileStateFlags: props.fileStateFlags
114
+ });
113
115
 
114
116
  if (Object.keys(rawPayload).includes('status')) {
115
117
  delete rawPayload['status'];
@@ -163,13 +163,20 @@ var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
163
163
 
164
164
  _this = _super.call.apply(_super, [this].concat(args));
165
165
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", initialState);
166
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fileStateFlags", {
167
+ wasStatusUploading: false,
168
+ wasStatusProcessing: false
169
+ });
166
170
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSuccess", function () {
167
171
  var item = _this.state.item;
168
172
  item.whenSuccessful(function (fileItem) {
169
173
  if (isFileStateItem(fileItem)) {
170
174
  var fileAttributes = (0, _analytics.getFileAttributes)(fileItem);
171
175
  (0, _analytics.fireAnalytics)((0, _loadSucceeded.createLoadSucceededEvent)(fileAttributes), _this.props);
172
- (0, _ufoExperiences.succeedMediaFileUfoExperience)(fileAttributes);
176
+ (0, _ufoExperiences.succeedMediaFileUfoExperience)({
177
+ fileAttributes: fileAttributes,
178
+ fileStateFlags: _this.fileStateFlags
179
+ });
173
180
  }
174
181
  });
175
182
  });
@@ -183,7 +190,10 @@ var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
183
190
  fileId: 'external-image'
184
191
  }), _this.props);
185
192
  (0, _ufoExperiences.succeedMediaFileUfoExperience)({
186
- fileId: 'external-image'
193
+ fileAttributes: {
194
+ fileId: 'external-image'
195
+ },
196
+ fileStateFlags: _this.fileStateFlags
187
197
  });
188
198
  });
189
199
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onExternalImgError", function () {
@@ -304,12 +314,14 @@ var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
304
314
  return /*#__PURE__*/_react.default.createElement(_errorMessage.default, {
305
315
  fileId: (0, _mediaClient.isFileIdentifier)(identifier) ? identifier.id : 'undefined',
306
316
  error: error,
307
- fileState: fileState
317
+ fileState: fileState,
318
+ fileStateFlags: this.fileStateFlags
308
319
  }, /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _mediaUi.messages.try_downloading_file)), this.renderDownloadButton(fileState, error));
309
320
  } else {
310
321
  return /*#__PURE__*/_react.default.createElement(_errorMessage.default, {
311
322
  fileId: (0, _mediaClient.isFileIdentifier)(identifier) ? identifier.id : 'undefined',
312
- error: error
323
+ error: error,
324
+ fileStateFlags: this.fileStateFlags
313
325
  });
314
326
  }
315
327
  }
@@ -371,6 +383,21 @@ var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
371
383
  collectionName: collectionName
372
384
  });
373
385
  }
386
+ }, {
387
+ key: "updateFileStateFlag",
388
+ value: function updateFileStateFlag(fileState) {
389
+ if (!fileState) {
390
+ return;
391
+ }
392
+
393
+ var status = fileState.status;
394
+
395
+ if (status === 'processing') {
396
+ this.fileStateFlags.wasStatusProcessing = true;
397
+ } else if (status === 'uploading') {
398
+ this.fileStateFlags.wasStatusUploading = true;
399
+ }
400
+ }
374
401
  }, {
375
402
  key: "init",
376
403
  value: function init(props) {
@@ -396,6 +423,8 @@ var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
396
423
  collectionName: identifier.collectionName
397
424
  }).subscribe({
398
425
  next: function next(file) {
426
+ _this3.updateFileStateFlag(file);
427
+
399
428
  _this3.setState({
400
429
  item: _domain.Outcome.successful(file)
401
430
  });
@@ -212,14 +212,7 @@ var MediaViewer = (0, _mediaCommon.withMediaAnalyticsContext)({
212
212
  component: _analytics.component,
213
213
  componentName: _analytics.componentName
214
214
  }, {
215
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
216
- newCardExperience: false,
217
- captions: false,
218
- timestampOnVideo: false,
219
- observedWidth: false,
220
- mediaInline: false,
221
- folderUploads: false
222
- })
215
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
223
216
  })((0, _analyticsNext.withAnalyticsEvents)()((0, _reactIntlNext.injectIntl)(MediaViewerComponent, {
224
217
  enforceContext: false
225
218
  })));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "46.2.2",
3
+ "version": "46.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,18 @@
1
- import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
1
+ import { filterFeatureFlagNames, filterFeatureFlagKeysAllProducts, ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
2
2
  import { name as packageName, version as packageVersion } from '../version.json';
3
3
  const componentName = 'mediaViewer';
4
4
  export { packageName, packageVersion, componentName, componentName as component };
5
+ export const relevantFlags = {
6
+ newCardExperience: false,
7
+ captions: false,
8
+ timestampOnVideo: false,
9
+ observedWidth: false,
10
+ mediaInline: false,
11
+ folderUploads: false,
12
+ mediaUploadApiV2: true
13
+ };
14
+ export const LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
15
+ export const LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
5
16
  export function getFileAttributes(fileState) {
6
17
  if (!fileState) {
7
18
  return {
@@ -1,5 +1,7 @@
1
1
  import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
2
+ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
2
3
  import { name as packageName, version as packageVersion } from '../version.json';
4
+ import { LOGGED_FEATURE_FLAG_KEYS } from '.';
3
5
  let ufoExperience;
4
6
 
5
7
  const getExperience = () => {
@@ -9,7 +11,8 @@ const getExperience = () => {
9
11
  component: 'media-viewer'
10
12
  },
11
13
  type: ExperienceTypes.Experience,
12
- performanceType: ExperiencePerformanceTypes.InlineResult
14
+ performanceType: ExperiencePerformanceTypes.InlineResult,
15
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
13
16
  };
14
17
  ufoExperience = new UFOExperience('media-file', inlineExperience);
15
18
  }
@@ -22,17 +25,20 @@ export const startMediaFileUfoExperience = () => {
22
25
  };
23
26
  export const succeedMediaFileUfoExperience = properties => {
24
27
  getExperience().success({
25
- metadata: {
26
- fileAttributes: properties,
28
+ metadata: { ...properties,
27
29
  packageName,
28
- packageVersion
30
+ packageVersion,
31
+ mediaEnvironment: getMediaEnvironment(),
32
+ mediaRegion: getMediaRegion()
29
33
  }
30
34
  });
31
35
  };
32
36
  export const failMediaFileUfoExperience = properties => {
33
37
  const refinedMetadata = { ...properties,
34
38
  packageName,
35
- packageVersion
39
+ packageVersion,
40
+ mediaEnvironment: getMediaEnvironment(),
41
+ mediaRegion: getMediaRegion()
36
42
  };
37
43
  getExperience().failure({
38
44
  metadata: refinedMetadata
@@ -55,7 +55,8 @@ export class ErrorMessage extends React.Component {
55
55
  if (supressAnalytics !== true) {
56
56
  const payload = ErrorMessage.getEventPayload(error, fileId, fileState);
57
57
  fireAnalytics(payload, props);
58
- const rawPayload = { ...(payload === null || payload === void 0 ? void 0 : payload.attributes)
58
+ const rawPayload = { ...(payload === null || payload === void 0 ? void 0 : payload.attributes),
59
+ fileStateFlags: props.fileStateFlags
59
60
  };
60
61
 
61
62
  if (Object.keys(rawPayload).includes('status')) {
@@ -50,6 +50,11 @@ export class ItemViewerBase extends React.Component {
50
50
 
51
51
  _defineProperty(this, "state", initialState);
52
52
 
53
+ _defineProperty(this, "fileStateFlags", {
54
+ wasStatusUploading: false,
55
+ wasStatusProcessing: false
56
+ });
57
+
53
58
  _defineProperty(this, "onSuccess", () => {
54
59
  const {
55
60
  item
@@ -58,7 +63,10 @@ export class ItemViewerBase extends React.Component {
58
63
  if (isFileStateItem(fileItem)) {
59
64
  const fileAttributes = getFileAttributes(fileItem);
60
65
  fireAnalytics(createLoadSucceededEvent(fileAttributes), this.props);
61
- succeedMediaFileUfoExperience(fileAttributes);
66
+ succeedMediaFileUfoExperience({
67
+ fileAttributes,
68
+ fileStateFlags: this.fileStateFlags
69
+ });
62
70
  }
63
71
  });
64
72
  });
@@ -74,7 +82,10 @@ export class ItemViewerBase extends React.Component {
74
82
  fileId: 'external-image'
75
83
  }), this.props);
76
84
  succeedMediaFileUfoExperience({
77
- fileId: 'external-image'
85
+ fileAttributes: {
86
+ fileId: 'external-image'
87
+ },
88
+ fileStateFlags: this.fileStateFlags
78
89
  });
79
90
  });
80
91
 
@@ -191,12 +202,14 @@ export class ItemViewerBase extends React.Component {
191
202
  return /*#__PURE__*/React.createElement(ErrorMessage, {
192
203
  fileId: isFileIdentifier(identifier) ? identifier.id : 'undefined',
193
204
  error: error,
194
- fileState: fileState
205
+ fileState: fileState,
206
+ fileStateFlags: this.fileStateFlags
195
207
  }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_downloading_file)), this.renderDownloadButton(fileState, error));
196
208
  } else {
197
209
  return /*#__PURE__*/React.createElement(ErrorMessage, {
198
210
  fileId: isFileIdentifier(identifier) ? identifier.id : 'undefined',
199
- error: error
211
+ error: error,
212
+ fileStateFlags: this.fileStateFlags
200
213
  });
201
214
  }
202
215
  }
@@ -257,6 +270,22 @@ export class ItemViewerBase extends React.Component {
257
270
  });
258
271
  }
259
272
 
273
+ updateFileStateFlag(fileState) {
274
+ if (!fileState) {
275
+ return;
276
+ }
277
+
278
+ const {
279
+ status
280
+ } = fileState;
281
+
282
+ if (status === 'processing') {
283
+ this.fileStateFlags.wasStatusProcessing = true;
284
+ } else if (status === 'uploading') {
285
+ this.fileStateFlags.wasStatusUploading = true;
286
+ }
287
+ }
288
+
260
289
  init(props) {
261
290
  const {
262
291
  mediaClient,
@@ -282,6 +311,7 @@ export class ItemViewerBase extends React.Component {
282
311
  collectionName: identifier.collectionName
283
312
  }).subscribe({
284
313
  next: file => {
314
+ this.updateFileStateFlag(file);
285
315
  this.setState({
286
316
  item: Outcome.successful(file)
287
317
  });
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
3
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { IntlProvider, injectIntl } from 'react-intl-next';
5
5
  import { Shortcut } from '@atlaskit/media-ui';
6
6
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
7
- import { packageName, packageVersion, component, componentName, fireAnalytics } from './analytics';
7
+ import { packageName, packageVersion, component, componentName, fireAnalytics, LOGGED_FEATURE_FLAGS } from './analytics';
8
8
  import { createModalEvent } from './analytics/events/screen/modal';
9
9
  import { createClosedEvent } from './analytics/events/ui/closed';
10
10
  import { List } from './list';
@@ -172,14 +172,7 @@ export const MediaViewer = withMediaAnalyticsContext({
172
172
  component,
173
173
  componentName
174
174
  }, {
175
- filterFeatureFlags: filterFeatureFlagNames({
176
- newCardExperience: false,
177
- captions: false,
178
- timestampOnVideo: false,
179
- observedWidth: false,
180
- mediaInline: false,
181
- folderUploads: false
182
- })
175
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
183
176
  })(withAnalyticsEvents()(injectIntl(MediaViewerComponent, {
184
177
  enforceContext: false
185
178
  })));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "46.2.2",
3
+ "version": "46.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,18 @@
1
- import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
1
+ import { filterFeatureFlagNames, filterFeatureFlagKeysAllProducts, ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
2
2
  import { name as packageName, version as packageVersion } from '../version.json';
3
3
  var componentName = 'mediaViewer';
4
4
  export { packageName, packageVersion, componentName, componentName as component };
5
+ export var relevantFlags = {
6
+ newCardExperience: false,
7
+ captions: false,
8
+ timestampOnVideo: false,
9
+ observedWidth: false,
10
+ mediaInline: false,
11
+ folderUploads: false,
12
+ mediaUploadApiV2: true
13
+ };
14
+ export var LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
15
+ export var LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
5
16
  export function getFileAttributes(fileState) {
6
17
  if (!fileState) {
7
18
  return {
@@ -5,7 +5,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
7
  import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
8
+ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
8
9
  import { name as packageName, version as packageVersion } from '../version.json';
10
+ import { LOGGED_FEATURE_FLAG_KEYS } from '.';
9
11
  var ufoExperience;
10
12
 
11
13
  var getExperience = function getExperience() {
@@ -15,7 +17,8 @@ var getExperience = function getExperience() {
15
17
  component: 'media-viewer'
16
18
  },
17
19
  type: ExperienceTypes.Experience,
18
- performanceType: ExperiencePerformanceTypes.InlineResult
20
+ performanceType: ExperiencePerformanceTypes.InlineResult,
21
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
19
22
  };
20
23
  ufoExperience = new UFOExperience('media-file', inlineExperience);
21
24
  }
@@ -28,17 +31,20 @@ export var startMediaFileUfoExperience = function startMediaFileUfoExperience()
28
31
  };
29
32
  export var succeedMediaFileUfoExperience = function succeedMediaFileUfoExperience(properties) {
30
33
  getExperience().success({
31
- metadata: {
32
- fileAttributes: properties,
34
+ metadata: _objectSpread(_objectSpread({}, properties), {}, {
33
35
  packageName: packageName,
34
- packageVersion: packageVersion
35
- }
36
+ packageVersion: packageVersion,
37
+ mediaEnvironment: getMediaEnvironment(),
38
+ mediaRegion: getMediaRegion()
39
+ })
36
40
  });
37
41
  };
38
42
  export var failMediaFileUfoExperience = function failMediaFileUfoExperience(properties) {
39
43
  var refinedMetadata = _objectSpread(_objectSpread({}, properties), {}, {
40
44
  packageName: packageName,
41
- packageVersion: packageVersion
45
+ packageVersion: packageVersion,
46
+ mediaEnvironment: getMediaEnvironment(),
47
+ mediaRegion: getMediaRegion()
42
48
  });
43
49
 
44
50
  getExperience().failure({
@@ -81,7 +81,9 @@ export var ErrorMessage = /*#__PURE__*/function (_React$Component) {
81
81
  var payload = ErrorMessage.getEventPayload(error, fileId, fileState);
82
82
  fireAnalytics(payload, props);
83
83
 
84
- var rawPayload = _objectSpread({}, payload === null || payload === void 0 ? void 0 : payload.attributes);
84
+ var rawPayload = _objectSpread(_objectSpread({}, payload === null || payload === void 0 ? void 0 : payload.attributes), {}, {
85
+ fileStateFlags: props.fileStateFlags
86
+ });
85
87
 
86
88
  if (Object.keys(rawPayload).includes('status')) {
87
89
  delete rawPayload['status'];
@@ -107,13 +107,21 @@ export var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
107
107
 
108
108
  _defineProperty(_assertThisInitialized(_this), "state", initialState);
109
109
 
110
+ _defineProperty(_assertThisInitialized(_this), "fileStateFlags", {
111
+ wasStatusUploading: false,
112
+ wasStatusProcessing: false
113
+ });
114
+
110
115
  _defineProperty(_assertThisInitialized(_this), "onSuccess", function () {
111
116
  var item = _this.state.item;
112
117
  item.whenSuccessful(function (fileItem) {
113
118
  if (isFileStateItem(fileItem)) {
114
119
  var fileAttributes = getFileAttributes(fileItem);
115
120
  fireAnalytics(createLoadSucceededEvent(fileAttributes), _this.props);
116
- succeedMediaFileUfoExperience(fileAttributes);
121
+ succeedMediaFileUfoExperience({
122
+ fileAttributes: fileAttributes,
123
+ fileStateFlags: _this.fileStateFlags
124
+ });
117
125
  }
118
126
  });
119
127
  });
@@ -129,7 +137,10 @@ export var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
129
137
  fileId: 'external-image'
130
138
  }), _this.props);
131
139
  succeedMediaFileUfoExperience({
132
- fileId: 'external-image'
140
+ fileAttributes: {
141
+ fileId: 'external-image'
142
+ },
143
+ fileStateFlags: _this.fileStateFlags
133
144
  });
134
145
  });
135
146
 
@@ -252,12 +263,14 @@ export var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
252
263
  return /*#__PURE__*/React.createElement(ErrorMessage, {
253
264
  fileId: isFileIdentifier(identifier) ? identifier.id : 'undefined',
254
265
  error: error,
255
- fileState: fileState
266
+ fileState: fileState,
267
+ fileStateFlags: this.fileStateFlags
256
268
  }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_downloading_file)), this.renderDownloadButton(fileState, error));
257
269
  } else {
258
270
  return /*#__PURE__*/React.createElement(ErrorMessage, {
259
271
  fileId: isFileIdentifier(identifier) ? identifier.id : 'undefined',
260
- error: error
272
+ error: error,
273
+ fileStateFlags: this.fileStateFlags
261
274
  });
262
275
  }
263
276
  }
@@ -319,6 +332,21 @@ export var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
319
332
  collectionName: collectionName
320
333
  });
321
334
  }
335
+ }, {
336
+ key: "updateFileStateFlag",
337
+ value: function updateFileStateFlag(fileState) {
338
+ if (!fileState) {
339
+ return;
340
+ }
341
+
342
+ var status = fileState.status;
343
+
344
+ if (status === 'processing') {
345
+ this.fileStateFlags.wasStatusProcessing = true;
346
+ } else if (status === 'uploading') {
347
+ this.fileStateFlags.wasStatusUploading = true;
348
+ }
349
+ }
322
350
  }, {
323
351
  key: "init",
324
352
  value: function init(props) {
@@ -344,6 +372,8 @@ export var ItemViewerBase = /*#__PURE__*/function (_React$Component) {
344
372
  collectionName: identifier.collectionName
345
373
  }).subscribe({
346
374
  next: function next(file) {
375
+ _this3.updateFileStateFlag(file);
376
+
347
377
  _this3.setState({
348
378
  item: Outcome.successful(file)
349
379
  });
@@ -11,11 +11,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
 
13
13
  import React from 'react';
14
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
14
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
15
15
  import { IntlProvider, injectIntl } from 'react-intl-next';
16
16
  import { Shortcut } from '@atlaskit/media-ui';
17
17
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
18
- import { packageName, packageVersion, component, componentName, fireAnalytics } from './analytics';
18
+ import { packageName, packageVersion, component, componentName, fireAnalytics, LOGGED_FEATURE_FLAGS } from './analytics';
19
19
  import { createModalEvent } from './analytics/events/screen/modal';
20
20
  import { createClosedEvent } from './analytics/events/ui/closed';
21
21
  import { List } from './list';
@@ -187,14 +187,7 @@ export var MediaViewer = withMediaAnalyticsContext({
187
187
  component: component,
188
188
  componentName: componentName
189
189
  }, {
190
- filterFeatureFlags: filterFeatureFlagNames({
191
- newCardExperience: false,
192
- captions: false,
193
- timestampOnVideo: false,
194
- observedWidth: false,
195
- mediaInline: false,
196
- folderUploads: false
197
- })
190
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
198
191
  })(withAnalyticsEvents()(injectIntl(MediaViewerComponent, {
199
192
  enforceContext: false
200
193
  })));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "46.2.2",
3
+ "version": "46.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,17 @@ import { name as packageName, version as packageVersion } from '../version.json'
6
6
  import { MediaViewerEventPayload } from './events';
7
7
  declare const componentName = "mediaViewer";
8
8
  export { packageName, packageVersion, componentName, componentName as component, };
9
+ export declare const relevantFlags: {
10
+ newCardExperience: boolean;
11
+ captions: boolean;
12
+ timestampOnVideo: boolean;
13
+ observedWidth: boolean;
14
+ mediaInline: boolean;
15
+ folderUploads: boolean;
16
+ mediaUploadApiV2: boolean;
17
+ };
18
+ export declare const LOGGED_FEATURE_FLAGS: (keyof import("@atlaskit/media-common").MediaFeatureFlags)[];
19
+ export declare const LOGGED_FEATURE_FLAG_KEYS: string[];
9
20
  export declare function getFileAttributes(fileState?: FileState): FileAttributes;
10
21
  /** This type takes FailureAttributes and redefines `failReason` to be the strong media-viewer type */
11
22
  export declare type MediaViewerFailureAttributes = Omit<FailureAttributes, 'failReason'> & {
@@ -1,13 +1,19 @@
1
1
  import { FileAttributes } from '@atlaskit/media-common';
2
2
  import { RequestMetadata } from '@atlaskit/media-client';
3
3
  import { PrimaryErrorReason } from '../errors';
4
+ import { FileStateFlags } from '../components/types';
4
5
  export declare type UFOFailedEventPayload = {
5
6
  failReason?: PrimaryErrorReason;
6
7
  error?: string;
7
8
  errorDetail?: string;
8
9
  request?: RequestMetadata;
9
10
  fileAttributes: FileAttributes;
11
+ fileStateFlags?: FileStateFlags;
12
+ };
13
+ export declare type UFOSucceedEventPayload = {
14
+ fileAttributes: FileAttributes;
15
+ fileStateFlags?: FileStateFlags;
10
16
  };
11
17
  export declare const startMediaFileUfoExperience: () => void;
12
- export declare const succeedMediaFileUfoExperience: (properties?: FileAttributes | undefined) => void;
18
+ export declare const succeedMediaFileUfoExperience: (properties?: UFOSucceedEventPayload | undefined) => void;
13
19
  export declare const failMediaFileUfoExperience: (properties?: UFOFailedEventPayload | undefined) => void;
@@ -5,6 +5,10 @@ export interface MediaViewerDataSource {
5
5
  list?: Array<Identifier>;
6
6
  collectionName?: string;
7
7
  }
8
+ export declare type FileStateFlags = {
9
+ wasStatusProcessing: boolean;
10
+ wasStatusUploading: boolean;
11
+ };
8
12
  export interface MediaViewerExtensionsActions {
9
13
  close: () => void;
10
14
  }
@@ -4,12 +4,14 @@ import { MessageDescriptor, WrappedComponentProps } from 'react-intl-next';
4
4
  import { FileState } from '@atlaskit/media-client';
5
5
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
6
6
  import { PrimaryErrorReason, SecondaryErrorReason, MediaViewerError } from './errors';
7
+ import { FileStateFlags } from './components/types';
7
8
  export declare type Props = Readonly<{
8
9
  error: MediaViewerError;
9
10
  supressAnalytics?: boolean;
10
11
  fileId: string;
11
12
  fileState?: FileState;
12
13
  children?: ReactNode;
14
+ fileStateFlags?: FileStateFlags;
13
15
  }>;
14
16
  export declare type FormatMessageFn = (messageDescriptor: MessageDescriptor) => string;
15
17
  export declare const errorReasonToMessages: Array<[
@@ -22,6 +22,7 @@ export declare type State = {
22
22
  export declare class ItemViewerBase extends React.Component<Props, State> {
23
23
  state: State;
24
24
  private subscription?;
25
+ private fileStateFlags;
25
26
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
26
27
  componentDidUpdate(oldProps: Props): void;
27
28
  componentWillUnmount(): void;
@@ -34,6 +35,7 @@ export declare class ItemViewerBase extends React.Component<Props, State> {
34
35
  private renderError;
35
36
  render(): JSX.Element;
36
37
  private renderDownloadButton;
38
+ updateFileStateFlag(fileState?: FileState): void;
37
39
  private init;
38
40
  private needsReset;
39
41
  private release;
@@ -0,0 +1,13 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { enableMediaUfoLogger } from '@atlaskit/media-test-helpers';
3
+ import { payloadPublisher } from '@atlassian/ufo';
4
+ import { Container } from './styled';
5
+
6
+ type Props = {
7
+ children: ReactNode;
8
+ };
9
+
10
+ export const MainWrapper: React.FC<Props> = ({ children }) => {
11
+ enableMediaUfoLogger(payloadPublisher);
12
+ return <Container>{children}</Container>;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "46.2.2",
3
+ "version": "46.5.0",
4
4
  "description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,9 +32,9 @@
32
32
  "@atlaskit/code": "^14.3.0",
33
33
  "@atlaskit/icon": "^21.10.0",
34
34
  "@atlaskit/icon-file-type": "^6.3.0",
35
- "@atlaskit/media-client": "^15.1.0",
36
- "@atlaskit/media-common": "^2.12.0",
37
- "@atlaskit/media-ui": "^21.1.0",
35
+ "@atlaskit/media-client": "^17.0.0",
36
+ "@atlaskit/media-common": "^2.15.0",
37
+ "@atlaskit/media-ui": "^22.1.0",
38
38
  "@atlaskit/side-navigation": "^1.2.3",
39
39
  "@atlaskit/spinner": "^15.0.0",
40
40
  "@atlaskit/theme": "^12.1.0",
@@ -56,10 +56,10 @@
56
56
  "devDependencies": {
57
57
  "@atlaskit/button": "^16.3.0",
58
58
  "@atlaskit/docs": "*",
59
- "@atlaskit/media-card": "^73.5.0",
60
- "@atlaskit/media-core": "^32.3.0",
59
+ "@atlaskit/media-card": "^73.8.0",
60
+ "@atlaskit/media-core": "^33.0.0",
61
61
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
62
- "@atlaskit/media-test-helpers": "^29.4.0",
62
+ "@atlaskit/media-test-helpers": "^30.0.0",
63
63
  "@atlaskit/modal-dialog": "^12.2.0",
64
64
  "@atlaskit/ssr": "*",
65
65
  "@atlaskit/visual-regression": "*",