@atlaskit/media-card 77.4.4 → 77.4.5

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,12 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 77.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#43072](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43072) [`4c4278b7415`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c4278b7415) - [ux] CXP-2744 Bug fix preventing an infinite loop from occurring when an error occurs in inline player
8
+ - Updated dependencies
9
+
3
10
  ## 77.4.4
4
11
 
5
12
  ### Patch Changes
@@ -49,7 +49,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
49
49
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
50
50
  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; } }
51
51
  var packageName = "@atlaskit/media-card";
52
- var packageVersion = "77.4.4";
52
+ var packageVersion = "77.4.5";
53
53
  var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
54
54
  (0, _inherits2.default)(CardBase, _Component);
55
55
  var _super = _createSuper(CardBase);
@@ -400,7 +400,9 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
400
400
  identifier = _this$props5.identifier,
401
401
  useInlinePlayer = _this$props5.useInlinePlayer,
402
402
  shouldOpenMediaViewer = _this$props5.shouldOpenMediaViewer;
403
- var cardPreview = _this.state.cardPreview;
403
+ var _this$state = _this.state,
404
+ status = _this$state.status,
405
+ cardPreview = _this$state.cardPreview;
404
406
  var _assertThisInitialize2 = (0, _assertThisInitialized2.default)(_this),
405
407
  metadata = _assertThisInitialize2.metadata;
406
408
  _this.onClick(event, analyticsEvent);
@@ -408,7 +410,7 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
408
410
  return;
409
411
  }
410
412
  var isVideo = metadata && metadata.mediaType === 'video';
411
- if (useInlinePlayer && isVideo && !!cardPreview) {
413
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
412
414
  _this.setState({
413
415
  isPlayingFile: true,
414
416
  shouldAutoplay: true
@@ -434,8 +436,10 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
434
436
  });
435
437
  }
436
438
  });
437
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInlinePlayerError", function () {
439
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInlinePlayerError", function (e) {
438
440
  _this.setState({
441
+ error: new _errors.MediaCardError('error-file-state', e),
442
+ status: 'error',
439
443
  isPlayingFile: false
440
444
  });
441
445
  });
@@ -453,9 +457,9 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
453
457
  testId = _this$props6.testId,
454
458
  originalDimensions = _this$props6.originalDimensions,
455
459
  onFullscreenChange = _this$props6.onFullscreenChange;
456
- var _this$state = _this.state,
457
- shouldAutoplay = _this$state.shouldAutoplay,
458
- cardPreview = _this$state.cardPreview;
460
+ var _this$state2 = _this.state,
461
+ shouldAutoplay = _this$state2.shouldAutoplay,
462
+ cardPreview = _this$state2.cardPreview;
459
463
  var card = _this.renderCard(false, 'loading', false);
460
464
  return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
461
465
  fallback: card
@@ -542,13 +546,13 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
542
546
  shouldOpenMediaViewer = _this$props8.shouldOpenMediaViewer,
543
547
  shouldHideTooltip = _this$props8.shouldHideTooltip;
544
548
  var mediaItemType = identifier.mediaItemType;
545
- var _this$state2 = _this.state,
546
- status = _this$state2.status,
547
- progress = _this$state2.progress,
548
- cardPreview = _this$state2.cardPreview,
549
- error = _this$state2.error,
550
- cardRef = _this$state2.cardRef,
551
- isCardVisible = _this$state2.isCardVisible;
549
+ var _this$state3 = _this.state,
550
+ status = _this$state3.status,
551
+ progress = _this$state3.progress,
552
+ cardPreview = _this$state3.cardPreview,
553
+ error = _this$state3.error,
554
+ cardRef = _this$state3.cardRef,
555
+ isCardVisible = _this$state3.isCardVisible;
552
556
  var _assertThisInitialize3 = (0, _assertThisInitialized2.default)(_this),
553
557
  metadata = _assertThisInitialize3.metadata;
554
558
  var _assertThisInitialize4 = (0, _assertThisInitialized2.default)(_this),
@@ -718,9 +722,9 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
718
722
  value: function componentDidMount() {
719
723
  var _getDocument;
720
724
  this.hasBeenMounted = true;
721
- var _this$state3 = this.state,
722
- isCardVisible = _this$state3.isCardVisible,
723
- cardPreview = _this$state3.cardPreview;
725
+ var _this$state4 = this.state,
726
+ isCardVisible = _this$state4.isCardVisible,
727
+ cardPreview = _this$state4.cardPreview;
724
728
  var _this$props11 = this.props,
725
729
  identifier = _this$props11.identifier,
726
730
  ssr = _this$props11.ssr,
@@ -768,15 +772,15 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
768
772
  useInlinePlayer = _this$props12.useInlinePlayer,
769
773
  disableOverlay = _this$props12.disableOverlay,
770
774
  ssr = _this$props12.ssr;
771
- var _this$state4 = this.state,
772
- isCardVisible = _this$state4.isCardVisible,
773
- cardPreview = _this$state4.cardPreview,
774
- status = _this$state4.status,
775
- fileState = _this$state4.fileState,
776
- isBannedLocalPreview = _this$state4.isBannedLocalPreview,
777
- previewDidRender = _this$state4.previewDidRender,
778
- isPlayingFile = _this$state4.isPlayingFile,
779
- wasResolvedUpfrontPreview = _this$state4.wasResolvedUpfrontPreview;
775
+ var _this$state5 = this.state,
776
+ isCardVisible = _this$state5.isCardVisible,
777
+ cardPreview = _this$state5.cardPreview,
778
+ status = _this$state5.status,
779
+ fileState = _this$state5.fileState,
780
+ isBannedLocalPreview = _this$state5.isBannedLocalPreview,
781
+ previewDidRender = _this$state5.previewDidRender,
782
+ isPlayingFile = _this$state5.isPlayingFile,
783
+ wasResolvedUpfrontPreview = _this$state5.wasResolvedUpfrontPreview;
780
784
  var isDiffIdentifier = (0, _mediaClient2.isDifferentIdentifier)(prevIdentifier, identifier);
781
785
  /**
782
786
  * Variable turnedVisible should only be true when media card
@@ -854,7 +858,7 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
854
858
  var _getFileDetails2 = (0, _metadata.getFileDetails)(identifier, fileState),
855
859
  mimeType = _getFileDetails2.mimeType;
856
860
  var isVideoPlayable = (0, _videoIsPlayable.videoIsPlayable)(isBannedLocalPreview, fileState, mimeType);
857
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
861
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
858
862
  this.setState({
859
863
  isPlayingFile: true
860
864
  });
@@ -930,22 +934,22 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
930
934
  }, {
931
935
  key: "metadata",
932
936
  get: function get() {
933
- var _this$state5;
934
- return (0, _metadata.getFileDetails)(this.props.identifier, (_this$state5 = this.state) === null || _this$state5 === void 0 ? void 0 : _this$state5.fileState);
937
+ var _this$state6;
938
+ return (0, _metadata.getFileDetails)(this.props.identifier, (_this$state6 = this.state) === null || _this$state6 === void 0 ? void 0 : _this$state6.fileState);
935
939
  }
936
940
  }, {
937
941
  key: "fileAttributes",
938
942
  get: function get() {
939
- var _this$state6;
940
- return (0, _analytics.getFileAttributes)(this.metadata, (_this$state6 = this.state) === null || _this$state6 === void 0 || (_this$state6 = _this$state6.fileState) === null || _this$state6 === void 0 ? void 0 : _this$state6.status);
943
+ var _this$state7;
944
+ return (0, _analytics.getFileAttributes)(this.metadata, (_this$state7 = this.state) === null || _this$state7 === void 0 || (_this$state7 = _this$state7.fileState) === null || _this$state7 === void 0 ? void 0 : _this$state7.status);
941
945
  }
942
946
  }, {
943
947
  key: "fireOperationalEvent",
944
948
  value: function fireOperationalEvent() {
945
- var _this$state7 = this.state,
946
- status = _this$state7.status,
947
- error = _this$state7.error,
948
- fileState = _this$state7.fileState;
949
+ var _this$state8 = this.state,
950
+ status = _this$state8.status,
951
+ error = _this$state8.error,
952
+ fileState = _this$state8.fileState;
949
953
  var createAnalyticsEvent = this.props.createAnalyticsEvent;
950
954
  createAnalyticsEvent && (0, _cardAnalytics.fireOperationalEvent)(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
951
955
  (0, _ufoExperiences.completeUfoExperience)(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
@@ -1004,9 +1008,9 @@ var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
1004
1008
  }, {
1005
1009
  key: "render",
1006
1010
  value: function render() {
1007
- var _this$state8 = this.state,
1008
- isPlayingFile = _this$state8.isPlayingFile,
1009
- mediaViewerSelectedItem = _this$state8.mediaViewerSelectedItem;
1011
+ var _this$state9 = this.state,
1012
+ isPlayingFile = _this$state9.isPlayingFile,
1013
+ mediaViewerSelectedItem = _this$state9.mediaViewerSelectedItem;
1010
1014
  var innerContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null, this.storeSSRData());
1011
1015
  return this.props.intl ? innerContent : /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
1012
1016
  locale: "en"
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
90
90
  }(_react.default.Component);
91
91
  (0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
92
92
  var packageName = "@atlaskit/media-card";
93
- var packageVersion = "77.4.4";
93
+ var packageVersion = "77.4.5";
94
94
  var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
95
95
  packageVersion: packageVersion,
96
96
  packageName: packageName,
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
16
16
  var _fileCard = require("./fileCard");
17
17
  var _excluded = ["identifier"];
18
18
  var packageName = "@atlaskit/media-card";
19
- var packageVersion = "77.4.4";
19
+ var packageVersion = "77.4.5";
20
20
  var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
21
21
  var identifier = _ref.identifier,
22
22
  otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -368,7 +368,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
368
368
  fireNonCriticalErrorEventRef.current && fireNonCriticalErrorEventRef.current(error);
369
369
  }
370
370
  var fileImageMode = (0, _mediaClient.imageResizeModeToFileImageMode)(resizeMode);
371
- (0, _mediaClient.isFileIdentifier)(identifier) && (0, _getCardPreview.removeCardPreviewFromCache)(identifier.id, fileImageMode);
371
+ (0, _getCardPreview.removeCardPreviewFromCache)(identifier.id, fileImageMode);
372
372
  setCardPreview(undefined);
373
373
  } else {
374
374
  if (!['complete', 'error', 'failed-processing'].includes(status)) {
@@ -420,7 +420,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
420
420
  return;
421
421
  }
422
422
  var isVideo = metadata && metadata.mediaType === 'video';
423
- if (useInlinePlayer && isVideo && !!cardPreview) {
423
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
424
424
  setIsPlayingFile(true);
425
425
  setShouldAutoplay(true);
426
426
  } else if (shouldOpenMediaViewer) {
@@ -816,10 +816,10 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
816
816
  * in order to avoid race conditions of the ViewportDector being unmounted before
817
817
  * it is able to set isCardVisible to true.
818
818
  */
819
- isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
819
+ isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
820
820
  setIsPlayingFile(true);
821
821
  }
822
- }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, useInlinePlayer]);
822
+ }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, status, useInlinePlayer]);
823
823
 
824
824
  //----------------------------------------------------------------//
825
825
  //----------------- fireScreenEvent ------------------------------//
@@ -976,7 +976,9 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
976
976
  identifier: identifier,
977
977
  autoplay: !!shouldAutoplay,
978
978
  onFullscreenChange: onFullscreenChange,
979
- onError: function onError() {
979
+ onError: function onError(e) {
980
+ setError(new _errors.MediaCardError('error-file-state', e));
981
+ setStatus('error');
980
982
  setIsPlayingFile(false);
981
983
  },
982
984
  onClick: onCardClick,
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
119
119
  ErrorBoundary = _this$state.ErrorBoundary;
120
120
  var analyticsContext = {
121
121
  packageVersion: "@atlaskit/media-card",
122
- packageName: "77.4.4",
122
+ packageName: "77.4.5",
123
123
  componentName: 'mediaInlineCard',
124
124
  component: 'mediaInlineCard'
125
125
  };
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
14
14
  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; }
15
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
16
  var packageName = "@atlaskit/media-card";
17
- var packageVersion = "77.4.4";
17
+ var packageVersion = "77.4.5";
18
18
  var concurrentExperience;
19
19
  var getExperience = function getExperience(id) {
20
20
  if (!concurrentExperience) {
@@ -27,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
27
27
  import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
28
28
  import { generateUniqueId } from '../utils/generateUniqueId';
29
29
  const packageName = "@atlaskit/media-card";
30
- const packageVersion = "77.4.4";
30
+ const packageVersion = "77.4.5";
31
31
  export class CardBase extends Component {
32
32
  constructor(props) {
33
33
  super(props);
@@ -347,6 +347,7 @@ export class CardBase extends Component {
347
347
  shouldOpenMediaViewer
348
348
  } = this.props;
349
349
  const {
350
+ status,
350
351
  cardPreview
351
352
  } = this.state;
352
353
  const {
@@ -357,7 +358,7 @@ export class CardBase extends Component {
357
358
  return;
358
359
  }
359
360
  const isVideo = metadata && metadata.mediaType === 'video';
360
- if (useInlinePlayer && isVideo && !!cardPreview) {
361
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
361
362
  this.setState({
362
363
  isPlayingFile: true,
363
364
  shouldAutoplay: true
@@ -383,8 +384,10 @@ export class CardBase extends Component {
383
384
  });
384
385
  }
385
386
  });
386
- _defineProperty(this, "onInlinePlayerError", () => {
387
+ _defineProperty(this, "onInlinePlayerError", e => {
387
388
  this.setState({
389
+ error: new MediaCardError('error-file-state', e),
390
+ status: 'error',
388
391
  isPlayingFile: false
389
392
  });
390
393
  });
@@ -834,7 +837,7 @@ export class CardBase extends Component {
834
837
  mimeType
835
838
  } = getFileDetails(identifier, fileState);
836
839
  const isVideoPlayable = videoIsPlayable(isBannedLocalPreview, fileState, mimeType);
837
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
840
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
838
841
  this.setState({
839
842
  isPlayingFile: true
840
843
  });
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
66
66
  }
67
67
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
68
68
  const packageName = "@atlaskit/media-card";
69
- const packageVersion = "77.4.4";
69
+ const packageVersion = "77.4.5";
70
70
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
71
71
  packageVersion,
72
72
  packageName,
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
7
7
  import { ExternalImageCard } from './externalImageCard';
8
8
  import { FileCard } from './fileCard';
9
9
  const packageName = "@atlaskit/media-card";
10
- const packageVersion = "77.4.4";
10
+ const packageVersion = "77.4.5";
11
11
  export const CardV2Base = ({
12
12
  identifier,
13
13
  ...otherProps
@@ -1,5 +1,5 @@
1
1
  import DownloadIcon from '@atlaskit/icon/glyph/download';
2
- import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isFileIdentifier, isImageRepresentationReady } from '@atlaskit/media-client';
2
+ import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isImageRepresentationReady } from '@atlaskit/media-client';
3
3
  import { MediaFileStateError, useFileState } from '@atlaskit/media-client-react';
4
4
  import { getMediaTypeFromMimeType, getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
5
5
  import { getOrientation } from '@atlaskit/media-ui';
@@ -315,7 +315,7 @@ export const FileCard = ({
315
315
  fireNonCriticalErrorEventRef.current && fireNonCriticalErrorEventRef.current(error);
316
316
  }
317
317
  const fileImageMode = imageResizeModeToFileImageMode(resizeMode);
318
- isFileIdentifier(identifier) && removeCardPreviewFromCache(identifier.id, fileImageMode);
318
+ removeCardPreviewFromCache(identifier.id, fileImageMode);
319
319
  setCardPreview(undefined);
320
320
  } else {
321
321
  if (!['complete', 'error', 'failed-processing'].includes(status)) {
@@ -367,7 +367,7 @@ export const FileCard = ({
367
367
  return;
368
368
  }
369
369
  const isVideo = metadata && metadata.mediaType === 'video';
370
- if (useInlinePlayer && isVideo && !!cardPreview) {
370
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
371
371
  setIsPlayingFile(true);
372
372
  setShouldAutoplay(true);
373
373
  } else if (shouldOpenMediaViewer) {
@@ -696,10 +696,10 @@ export const FileCard = ({
696
696
  * in order to avoid race conditions of the ViewportDector being unmounted before
697
697
  * it is able to set isCardVisible to true.
698
698
  */
699
- isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
699
+ isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
700
700
  setIsPlayingFile(true);
701
701
  }
702
- }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, useInlinePlayer]);
702
+ }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, status, useInlinePlayer]);
703
703
 
704
704
  //----------------------------------------------------------------//
705
705
  //----------------- fireScreenEvent ------------------------------//
@@ -856,7 +856,9 @@ export const FileCard = ({
856
856
  identifier: identifier,
857
857
  autoplay: !!shouldAutoplay,
858
858
  onFullscreenChange: onFullscreenChange,
859
- onError: () => {
859
+ onError: e => {
860
+ setError(new MediaCardError('error-file-state', e));
861
+ setStatus('error');
860
862
  setIsPlayingFile(false);
861
863
  },
862
864
  onClick: onCardClick,
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
37
37
  } = this.state;
38
38
  const analyticsContext = {
39
39
  packageVersion: "@atlaskit/media-card",
40
- packageName: "77.4.4",
40
+ packageName: "77.4.5",
41
41
  componentName: 'mediaInlineCard',
42
42
  component: 'mediaInlineCard'
43
43
  };
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
4
4
  import { MediaCardError } from '../errors';
5
5
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
6
6
  const packageName = "@atlaskit/media-card";
7
- const packageVersion = "77.4.4";
7
+ const packageVersion = "77.4.5";
8
8
  let concurrentExperience;
9
9
  const getExperience = id => {
10
10
  if (!concurrentExperience) {
@@ -40,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
40
40
  import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
41
41
  import { generateUniqueId } from '../utils/generateUniqueId';
42
42
  var packageName = "@atlaskit/media-card";
43
- var packageVersion = "77.4.4";
43
+ var packageVersion = "77.4.5";
44
44
  export var CardBase = /*#__PURE__*/function (_Component) {
45
45
  _inherits(CardBase, _Component);
46
46
  var _super = _createSuper(CardBase);
@@ -391,7 +391,9 @@ export var CardBase = /*#__PURE__*/function (_Component) {
391
391
  identifier = _this$props5.identifier,
392
392
  useInlinePlayer = _this$props5.useInlinePlayer,
393
393
  shouldOpenMediaViewer = _this$props5.shouldOpenMediaViewer;
394
- var cardPreview = _this.state.cardPreview;
394
+ var _this$state = _this.state,
395
+ status = _this$state.status,
396
+ cardPreview = _this$state.cardPreview;
395
397
  var _assertThisInitialize2 = _assertThisInitialized(_this),
396
398
  metadata = _assertThisInitialize2.metadata;
397
399
  _this.onClick(event, analyticsEvent);
@@ -399,7 +401,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
399
401
  return;
400
402
  }
401
403
  var isVideo = metadata && metadata.mediaType === 'video';
402
- if (useInlinePlayer && isVideo && !!cardPreview) {
404
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
403
405
  _this.setState({
404
406
  isPlayingFile: true,
405
407
  shouldAutoplay: true
@@ -425,8 +427,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
425
427
  });
426
428
  }
427
429
  });
428
- _defineProperty(_assertThisInitialized(_this), "onInlinePlayerError", function () {
430
+ _defineProperty(_assertThisInitialized(_this), "onInlinePlayerError", function (e) {
429
431
  _this.setState({
432
+ error: new MediaCardError('error-file-state', e),
433
+ status: 'error',
430
434
  isPlayingFile: false
431
435
  });
432
436
  });
@@ -444,9 +448,9 @@ export var CardBase = /*#__PURE__*/function (_Component) {
444
448
  testId = _this$props6.testId,
445
449
  originalDimensions = _this$props6.originalDimensions,
446
450
  onFullscreenChange = _this$props6.onFullscreenChange;
447
- var _this$state = _this.state,
448
- shouldAutoplay = _this$state.shouldAutoplay,
449
- cardPreview = _this$state.cardPreview;
451
+ var _this$state2 = _this.state,
452
+ shouldAutoplay = _this$state2.shouldAutoplay,
453
+ cardPreview = _this$state2.cardPreview;
450
454
  var card = _this.renderCard(false, 'loading', false);
451
455
  return /*#__PURE__*/React.createElement(Suspense, {
452
456
  fallback: card
@@ -533,13 +537,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
533
537
  shouldOpenMediaViewer = _this$props8.shouldOpenMediaViewer,
534
538
  shouldHideTooltip = _this$props8.shouldHideTooltip;
535
539
  var mediaItemType = identifier.mediaItemType;
536
- var _this$state2 = _this.state,
537
- status = _this$state2.status,
538
- progress = _this$state2.progress,
539
- cardPreview = _this$state2.cardPreview,
540
- error = _this$state2.error,
541
- cardRef = _this$state2.cardRef,
542
- isCardVisible = _this$state2.isCardVisible;
540
+ var _this$state3 = _this.state,
541
+ status = _this$state3.status,
542
+ progress = _this$state3.progress,
543
+ cardPreview = _this$state3.cardPreview,
544
+ error = _this$state3.error,
545
+ cardRef = _this$state3.cardRef,
546
+ isCardVisible = _this$state3.isCardVisible;
543
547
  var _assertThisInitialize3 = _assertThisInitialized(_this),
544
548
  metadata = _assertThisInitialize3.metadata;
545
549
  var _assertThisInitialize4 = _assertThisInitialized(_this),
@@ -709,9 +713,9 @@ export var CardBase = /*#__PURE__*/function (_Component) {
709
713
  value: function componentDidMount() {
710
714
  var _getDocument;
711
715
  this.hasBeenMounted = true;
712
- var _this$state3 = this.state,
713
- isCardVisible = _this$state3.isCardVisible,
714
- cardPreview = _this$state3.cardPreview;
716
+ var _this$state4 = this.state,
717
+ isCardVisible = _this$state4.isCardVisible,
718
+ cardPreview = _this$state4.cardPreview;
715
719
  var _this$props11 = this.props,
716
720
  identifier = _this$props11.identifier,
717
721
  ssr = _this$props11.ssr,
@@ -759,15 +763,15 @@ export var CardBase = /*#__PURE__*/function (_Component) {
759
763
  useInlinePlayer = _this$props12.useInlinePlayer,
760
764
  disableOverlay = _this$props12.disableOverlay,
761
765
  ssr = _this$props12.ssr;
762
- var _this$state4 = this.state,
763
- isCardVisible = _this$state4.isCardVisible,
764
- cardPreview = _this$state4.cardPreview,
765
- status = _this$state4.status,
766
- fileState = _this$state4.fileState,
767
- isBannedLocalPreview = _this$state4.isBannedLocalPreview,
768
- previewDidRender = _this$state4.previewDidRender,
769
- isPlayingFile = _this$state4.isPlayingFile,
770
- wasResolvedUpfrontPreview = _this$state4.wasResolvedUpfrontPreview;
766
+ var _this$state5 = this.state,
767
+ isCardVisible = _this$state5.isCardVisible,
768
+ cardPreview = _this$state5.cardPreview,
769
+ status = _this$state5.status,
770
+ fileState = _this$state5.fileState,
771
+ isBannedLocalPreview = _this$state5.isBannedLocalPreview,
772
+ previewDidRender = _this$state5.previewDidRender,
773
+ isPlayingFile = _this$state5.isPlayingFile,
774
+ wasResolvedUpfrontPreview = _this$state5.wasResolvedUpfrontPreview;
771
775
  var isDiffIdentifier = isDifferentIdentifier(prevIdentifier, identifier);
772
776
  /**
773
777
  * Variable turnedVisible should only be true when media card
@@ -845,7 +849,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
845
849
  var _getFileDetails2 = getFileDetails(identifier, fileState),
846
850
  mimeType = _getFileDetails2.mimeType;
847
851
  var isVideoPlayable = videoIsPlayable(isBannedLocalPreview, fileState, mimeType);
848
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
852
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
849
853
  this.setState({
850
854
  isPlayingFile: true
851
855
  });
@@ -921,22 +925,22 @@ export var CardBase = /*#__PURE__*/function (_Component) {
921
925
  }, {
922
926
  key: "metadata",
923
927
  get: function get() {
924
- var _this$state5;
925
- return getFileDetails(this.props.identifier, (_this$state5 = this.state) === null || _this$state5 === void 0 ? void 0 : _this$state5.fileState);
928
+ var _this$state6;
929
+ return getFileDetails(this.props.identifier, (_this$state6 = this.state) === null || _this$state6 === void 0 ? void 0 : _this$state6.fileState);
926
930
  }
927
931
  }, {
928
932
  key: "fileAttributes",
929
933
  get: function get() {
930
- var _this$state6;
931
- return getFileAttributes(this.metadata, (_this$state6 = this.state) === null || _this$state6 === void 0 || (_this$state6 = _this$state6.fileState) === null || _this$state6 === void 0 ? void 0 : _this$state6.status);
934
+ var _this$state7;
935
+ return getFileAttributes(this.metadata, (_this$state7 = this.state) === null || _this$state7 === void 0 || (_this$state7 = _this$state7.fileState) === null || _this$state7 === void 0 ? void 0 : _this$state7.status);
932
936
  }
933
937
  }, {
934
938
  key: "fireOperationalEvent",
935
939
  value: function fireOperationalEvent() {
936
- var _this$state7 = this.state,
937
- status = _this$state7.status,
938
- error = _this$state7.error,
939
- fileState = _this$state7.fileState;
940
+ var _this$state8 = this.state,
941
+ status = _this$state8.status,
942
+ error = _this$state8.error,
943
+ fileState = _this$state8.fileState;
940
944
  var createAnalyticsEvent = this.props.createAnalyticsEvent;
941
945
  createAnalyticsEvent && _fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
942
946
  completeUfoExperience(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
@@ -995,9 +999,9 @@ export var CardBase = /*#__PURE__*/function (_Component) {
995
999
  }, {
996
1000
  key: "render",
997
1001
  value: function render() {
998
- var _this$state8 = this.state,
999
- isPlayingFile = _this$state8.isPlayingFile,
1000
- mediaViewerSelectedItem = _this$state8.mediaViewerSelectedItem;
1002
+ var _this$state9 = this.state,
1003
+ isPlayingFile = _this$state9.isPlayingFile,
1004
+ mediaViewerSelectedItem = _this$state9.mediaViewerSelectedItem;
1001
1005
  var innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null, this.storeSSRData());
1002
1006
  return this.props.intl ? innerContent : /*#__PURE__*/React.createElement(IntlProvider, {
1003
1007
  locale: "en"
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
83
83
  }(React.Component);
84
84
  _defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
85
85
  var packageName = "@atlaskit/media-card";
86
- var packageVersion = "77.4.4";
86
+ var packageVersion = "77.4.5";
87
87
  var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
88
88
  packageVersion: packageVersion,
89
89
  packageName: packageName,
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
9
9
  import { ExternalImageCard } from './externalImageCard';
10
10
  import { FileCard } from './fileCard';
11
11
  var packageName = "@atlaskit/media-card";
12
- var packageVersion = "77.4.4";
12
+ var packageVersion = "77.4.5";
13
13
  export var CardV2Base = function CardV2Base(_ref) {
14
14
  var identifier = _ref.identifier,
15
15
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  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; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import DownloadIcon from '@atlaskit/icon/glyph/download';
9
- import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isFileIdentifier, isImageRepresentationReady } from '@atlaskit/media-client';
9
+ import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isImageRepresentationReady } from '@atlaskit/media-client';
10
10
  import { MediaFileStateError, useFileState } from '@atlaskit/media-client-react';
11
11
  import { getMediaTypeFromMimeType, getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
12
12
  import { getOrientation } from '@atlaskit/media-ui';
@@ -358,7 +358,7 @@ export var FileCard = function FileCard(_ref) {
358
358
  fireNonCriticalErrorEventRef.current && fireNonCriticalErrorEventRef.current(error);
359
359
  }
360
360
  var fileImageMode = imageResizeModeToFileImageMode(resizeMode);
361
- isFileIdentifier(identifier) && removeCardPreviewFromCache(identifier.id, fileImageMode);
361
+ removeCardPreviewFromCache(identifier.id, fileImageMode);
362
362
  setCardPreview(undefined);
363
363
  } else {
364
364
  if (!['complete', 'error', 'failed-processing'].includes(status)) {
@@ -410,7 +410,7 @@ export var FileCard = function FileCard(_ref) {
410
410
  return;
411
411
  }
412
412
  var isVideo = metadata && metadata.mediaType === 'video';
413
- if (useInlinePlayer && isVideo && !!cardPreview) {
413
+ if (useInlinePlayer && isVideo && !!cardPreview && status !== 'error') {
414
414
  setIsPlayingFile(true);
415
415
  setShouldAutoplay(true);
416
416
  } else if (shouldOpenMediaViewer) {
@@ -806,10 +806,10 @@ export var FileCard = function FileCard(_ref) {
806
806
  * in order to avoid race conditions of the ViewportDector being unmounted before
807
807
  * it is able to set isCardVisible to true.
808
808
  */
809
- isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable) {
809
+ isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && status !== 'error') {
810
810
  setIsPlayingFile(true);
811
811
  }
812
- }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, useInlinePlayer]);
812
+ }, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isBannedLocalPreview, isPlayingFile, status, useInlinePlayer]);
813
813
 
814
814
  //----------------------------------------------------------------//
815
815
  //----------------- fireScreenEvent ------------------------------//
@@ -966,7 +966,9 @@ export var FileCard = function FileCard(_ref) {
966
966
  identifier: identifier,
967
967
  autoplay: !!shouldAutoplay,
968
968
  onFullscreenChange: onFullscreenChange,
969
- onError: function onError() {
969
+ onError: function onError(e) {
970
+ setError(new MediaCardError('error-file-state', e));
971
+ setStatus('error');
970
972
  setIsPlayingFile(false);
971
973
  },
972
974
  onClick: onCardClick,
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
103
103
  ErrorBoundary = _this$state.ErrorBoundary;
104
104
  var analyticsContext = {
105
105
  packageVersion: "@atlaskit/media-card",
106
- packageName: "77.4.4",
106
+ packageName: "77.4.5",
107
107
  componentName: 'mediaInlineCard',
108
108
  component: 'mediaInlineCard'
109
109
  };
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
7
7
  import { MediaCardError } from '../errors';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
9
  var packageName = "@atlaskit/media-card";
10
- var packageVersion = "77.4.4";
10
+ var packageVersion = "77.4.5";
11
11
  var concurrentExperience;
12
12
  var getExperience = function getExperience(id) {
13
13
  if (!concurrentExperience) {
@@ -48,7 +48,7 @@ export declare class CardBase extends Component<CardBaseProps, CardState> {
48
48
  unsubscribe: () => void;
49
49
  get actions(): CardAction[];
50
50
  onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
51
- onInlinePlayerError: () => void;
51
+ onInlinePlayerError: (e: Error) => void;
52
52
  setRef: (cardRef: HTMLDivElement | null) => void;
53
53
  renderInlinePlayer: () => JSX.Element;
54
54
  onMediaViewerClose: () => void;
@@ -48,7 +48,7 @@ export declare class CardBase extends Component<CardBaseProps, CardState> {
48
48
  unsubscribe: () => void;
49
49
  get actions(): CardAction[];
50
50
  onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
51
- onInlinePlayerError: () => void;
51
+ onInlinePlayerError: (e: Error) => void;
52
52
  setRef: (cardRef: HTMLDivElement | null) => void;
53
53
  renderInlinePlayer: () => JSX.Element;
54
54
  onMediaViewerClose: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "77.4.4",
3
+ "version": "77.4.5",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/analytics-next": "^9.1.0",
40
40
  "@atlaskit/dropdown-menu": "^12.1.0",
41
41
  "@atlaskit/editor-shared-styles": "^2.8.0",
42
- "@atlaskit/icon": "^21.12.0",
42
+ "@atlaskit/icon": "^22.0.0",
43
43
  "@atlaskit/media-client": "^25.0.0",
44
44
  "@atlaskit/media-client-react": "^1.4.0",
45
45
  "@atlaskit/media-common": "^11.0.0",