@atlaskit/media-card 74.6.1 → 74.7.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/card/card.js +8 -5
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  5. package/dist/cjs/inline/mediaInlineCard.js +2 -0
  6. package/dist/cjs/utils/analytics.js +1 -15
  7. package/dist/cjs/utils/ufoExperiences.js +3 -2
  8. package/dist/cjs/utils/videoIsPlayable.js +14 -0
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/card/card.js +11 -7
  11. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  12. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  13. package/dist/es2019/inline/mediaInlineCard.js +2 -0
  14. package/dist/es2019/utils/analytics.js +1 -13
  15. package/dist/es2019/utils/ufoExperiences.js +4 -3
  16. package/dist/es2019/utils/videoIsPlayable.js +7 -0
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/card/card.js +10 -7
  19. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  20. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  21. package/dist/esm/inline/mediaInlineCard.js +2 -0
  22. package/dist/esm/utils/analytics.js +1 -13
  23. package/dist/esm/utils/ufoExperiences.js +4 -3
  24. package/dist/esm/utils/videoIsPlayable.js +7 -0
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/inline/mediaInlineCard.d.ts +8 -1
  27. package/dist/types/types.d.ts +6 -2
  28. package/dist/types/utils/analytics.d.ts +0 -2
  29. package/dist/types/utils/videoIsPlayable.d.ts +2 -0
  30. package/example-helpers/index.tsx +1 -4
  31. package/package.json +10 -10
  32. package/report.api.md +6 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 74.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b37723f2cfa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b37723f2cfa) - The component now logs the full provided feature flags object
8
+ - Updated dependencies
9
+
10
+ ## 74.7.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`8a0a92b2885`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a0a92b2885) - MEX-2210 improve inconsistent behaviour on timestampOnVideo playback
15
+ - [`c3eba8c788d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3eba8c788d) - Deprecation notice: Media Card and Inline Card no longer accept a collection name as a data source for Media Viewer. Integrators should pass the full list of files to browse through the new "mediaViewerItems" property.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 74.6.1
4
22
 
5
23
  ### Patch Changes
@@ -26,6 +26,7 @@ var _mediaViewer = require("@atlaskit/media-viewer");
26
26
  var _reactIntlNext = require("react-intl-next");
27
27
  var _cardView = require("./cardView");
28
28
  var _viewportDetector = require("../utils/viewportDetector");
29
+ var _videoIsPlayable = require("../utils/videoIsPlayable");
29
30
  var _getDataURIDimension = require("../utils/getDataURIDimension");
30
31
  var _getCardPreview = require("./getCardPreview");
31
32
  var _metadata = require("../utils/metadata");
@@ -47,7 +48,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
47
48
  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); }; }
48
49
  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; } }
49
50
  var packageName = "@atlaskit/media-card";
50
- var packageVersion = "74.6.1";
51
+ var packageVersion = "74.7.1";
51
52
  var CardBase = /*#__PURE__*/function (_Component) {
52
53
  (0, _inherits2.default)(CardBase, _Component);
53
54
  var _super = _createSuper(CardBase);
@@ -513,6 +514,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
513
514
  mediaClient = _this$props7.mediaClient,
514
515
  identifier = _this$props7.identifier,
515
516
  mediaViewerDataSource = _this$props7.mediaViewerDataSource,
517
+ mediaViewerItems = _this$props7.mediaViewerItems,
516
518
  contextId = _this$props7.contextId,
517
519
  featureFlags = _this$props7.featureFlags;
518
520
  if (!mediaViewerSelectedItem) {
@@ -525,6 +527,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
525
527
  return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_mediaViewer.MediaViewer, {
526
528
  collectionName: collectionName,
527
529
  dataSource: dataSource,
530
+ items: mediaViewerItems,
528
531
  mediaClientConfig: mediaClient.config,
529
532
  selectedItem: mediaViewerSelectedItem,
530
533
  onClose: _this.onMediaViewerClose,
@@ -860,8 +863,10 @@ var CardBase = /*#__PURE__*/function (_Component) {
860
863
  this.unsubscribe();
861
864
  }
862
865
  var isVideo = this.fileAttributes.fileMediatype === 'video';
863
- var videoAvailableToPlay = fileState && (0, _mediaClient2.isProcessedFileState)(fileState);
864
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && (0, _mediaCommon.getMediaFeatureFlag)('timestampOnVideo', this.props.featureFlags)) {
866
+ var _getFileDetails2 = (0, _metadata.getFileDetails)(identifier, fileState),
867
+ mimeType = _getFileDetails2.mimeType;
868
+ var isVideoPlayable = (0, _videoIsPlayable.videoIsPlayable)(isBannedLocalPreview, fileState, mimeType);
869
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && (0, _mediaCommon.getMediaFeatureFlag)('timestampOnVideo', this.props.featureFlags)) {
865
870
  this.setState({
866
871
  isPlayingFile: true
867
872
  });
@@ -1023,8 +1028,6 @@ var Card = (0, _mediaCommon.withMediaAnalyticsContext)({
1023
1028
  packageName: packageName,
1024
1029
  componentName: 'mediaCard',
1025
1030
  component: 'mediaCard'
1026
- }, {
1027
- filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
1028
1031
  })((0, _analyticsNext.withAnalyticsEvents)()((0, _reactIntlNext.injectIntl)(CardBase, {
1029
1032
  enforceContext: false
1030
1033
  })));
@@ -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 = "74.6.1";
93
+ var packageVersion = "74.7.1";
94
94
  var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
95
95
  packageVersion: packageVersion,
96
96
  packageName: packageName,
@@ -77,7 +77,7 @@ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Com
77
77
  }(_react.default.Component);
78
78
  (0, _defineProperty2.default)(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
79
79
  var packageName = "@atlaskit/media-card";
80
- var packageVersion = "74.6.1";
80
+ var packageVersion = "74.7.1";
81
81
  var MediaInlineAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
82
82
  packageVersion: packageVersion,
83
83
  packageName: packageName,
@@ -25,6 +25,7 @@ var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
25
25
  isSelected = _ref.isSelected,
26
26
  onClick = _ref.onClick,
27
27
  mediaViewerDataSource = _ref.mediaViewerDataSource,
28
+ mediaViewerItems = _ref.mediaViewerItems,
28
29
  intl = _ref.intl;
29
30
  var _useState = (0, _react.useState)(),
30
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -57,6 +58,7 @@ var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
57
58
  return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_mediaViewer.MediaViewer, {
58
59
  collectionName: identifier.collectionName || '',
59
60
  dataSource: dataSource,
61
+ items: mediaViewerItems,
60
62
  mediaClientConfig: mediaClient.mediaClientConfig,
61
63
  selectedItem: identifier,
62
64
  onClose: onMediaViewerClose
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.extractErrorInfo = exports.createAndFireMediaCardEvent = exports.LOGGED_FEATURE_FLAG_KEYS = exports.LOGGED_FEATURE_FLAGS = void 0;
7
+ exports.extractErrorInfo = exports.createAndFireMediaCardEvent = void 0;
8
8
  exports.fireMediaCardEvent = fireMediaCardEvent;
9
9
  exports.getRenderSucceededEventPayload = exports.getRenderPreviewableCardPayload = exports.getRenderFailedFileStatusPayload = exports.getRenderFailedExternalUriPayload = exports.getRenderErrorRequestMetadata = exports.getRenderErrorFailReason = exports.getRenderErrorEventPayload = exports.getRenderErrorErrorReason = exports.getRenderErrorErrorDetail = exports.getRenderCommencedEventPayload = exports.getRemoteSuccessEventPayload = exports.getFileAttributes = exports.getErrorTraceContext = exports.getErrorEventPayload = exports.getCopiedFilePayload = exports.getCacheHitEventPayload = void 0;
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -14,20 +14,6 @@ var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _errors = require("../errors");
15
15
  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; }
16
16
  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; }
17
- var relevantFlags = {
18
- newCardExperience: true,
19
- captions: true,
20
- timestampOnVideo: true,
21
- observedWidth: true,
22
- mediaInline: false,
23
- folderUploads: false,
24
- memoryCacheLogging: true,
25
- fetchFileStateAfterUpload: true
26
- };
27
- var LOGGED_FEATURE_FLAGS = (0, _mediaCommon.filterFeatureFlagNames)(relevantFlags);
28
- exports.LOGGED_FEATURE_FLAGS = LOGGED_FEATURE_FLAGS;
29
- var LOGGED_FEATURE_FLAG_KEYS = (0, _mediaCommon.filterFeatureFlagKeysAllProducts)(relevantFlags);
30
- exports.LOGGED_FEATURE_FLAG_KEYS = LOGGED_FEATURE_FLAG_KEYS;
31
17
  var getFileAttributes = function getFileAttributes(metadata, fileStatus) {
32
18
  return {
33
19
  fileMediatype: metadata.mediaType,
@@ -7,13 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.startUfoExperience = exports.completeUfoExperience = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _ufo = require("@atlaskit/ufo");
10
+ var _mediaCommon = require("@atlaskit/media-common");
10
11
  var _analytics = require("./analytics");
11
12
  var _errors = require("../errors");
12
13
  var _mediaClient = require("@atlaskit/media-client");
13
14
  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; }
14
15
  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; }
15
16
  var packageName = "@atlaskit/media-card";
16
- var packageVersion = "74.6.1";
17
+ var packageVersion = "74.7.1";
17
18
  var concurrentExperience;
18
19
  var getExperience = function getExperience(id) {
19
20
  if (!concurrentExperience) {
@@ -23,7 +24,7 @@ var getExperience = function getExperience(id) {
23
24
  },
24
25
  type: _ufo.ExperienceTypes.Experience,
25
26
  performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
26
- featureFlags: _analytics.LOGGED_FEATURE_FLAG_KEYS
27
+ featureFlags: (0, _mediaCommon.getFeatureFlagKeysAllProducts)()
27
28
  };
28
29
  concurrentExperience = new _ufo.ConcurrentExperience('media-card-render', inlineExperience);
29
30
  }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.videoIsPlayable = void 0;
7
+ var _mediaClient = require("@atlaskit/media-client");
8
+ var _mediaCommon = require("@atlaskit/media-common");
9
+ var videoIsPlayable = function videoIsPlayable(isBannedLocalPreview, fileState, mimeType) {
10
+ var localPreviewAvailable = mimeType && !isBannedLocalPreview && (0, _mediaCommon.isVideoMimeTypeSupportedByBrowser)(mimeType);
11
+ var videoProcessedByServer = fileState && (0, _mediaClient.isProcessedFileState)(fileState);
12
+ return !!(localPreviewAvailable || videoProcessedByServer);
13
+ };
14
+ exports.videoIsPlayable = videoIsPlayable;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.6.1",
3
+ "version": "74.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -5,16 +5,17 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
6
6
  import DownloadIcon from '@atlaskit/icon/glyph/download';
7
7
  import { getRandomHex } from '@atlaskit/media-common';
8
- import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, isProcessedFileState, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
8
+ import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
9
9
  import { MediaViewer } from '@atlaskit/media-viewer';
10
10
  import { injectIntl, IntlProvider } from 'react-intl-next';
11
11
  import { CardView } from './cardView';
12
12
  import { ViewportDetector } from '../utils/viewportDetector';
13
+ import { videoIsPlayable } from '../utils/videoIsPlayable';
13
14
  import { getRequestedDimensions } from '../utils/getDataURIDimension';
14
15
  import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, isSSRDataPreview, fetchAndCacheRemotePreview } from './getCardPreview';
15
16
  import { getFileDetails } from '../utils/metadata';
16
17
  import { InlinePlayerLazy } from './inlinePlayerLazy';
17
- import { getFileAttributes, extractErrorInfo, LOGGED_FEATURE_FLAGS } from '../utils/analytics';
18
+ import { getFileAttributes, extractErrorInfo } from '../utils/analytics';
18
19
  import { isLocalPreviewError, MediaCardError, ensureMediaCardError, ImageLoadError } from '../errors';
19
20
  import { fireOperationalEvent, fireCommencedEvent, fireCopiedEvent, fireScreenEvent, fireNonCriticalErrorEvent } from './cardAnalytics';
20
21
  import getDocument from '../utils/document';
@@ -26,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
26
27
  import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
27
28
  import { generateUniqueId } from '../utils/generateUniqueId';
28
29
  const packageName = "@atlaskit/media-card";
29
- const packageVersion = "74.6.1";
30
+ const packageVersion = "74.7.1";
30
31
  export class CardBase extends Component {
31
32
  // An internalOccurrenceKey is a randomly generated value to differentiate various instances
32
33
  // of Cards regardless of whether it shares the same file (either internal or external)
@@ -464,6 +465,7 @@ export class CardBase extends Component {
464
465
  mediaClient,
465
466
  identifier,
466
467
  mediaViewerDataSource,
468
+ mediaViewerItems,
467
469
  contextId,
468
470
  featureFlags
469
471
  } = this.props;
@@ -477,6 +479,7 @@ export class CardBase extends Component {
477
479
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
478
480
  collectionName: collectionName,
479
481
  dataSource: dataSource,
482
+ items: mediaViewerItems,
480
483
  mediaClientConfig: mediaClient.config,
481
484
  selectedItem: mediaViewerSelectedItem,
482
485
  onClose: this.onMediaViewerClose,
@@ -834,8 +837,11 @@ export class CardBase extends Component {
834
837
  this.unsubscribe();
835
838
  }
836
839
  const isVideo = this.fileAttributes.fileMediatype === 'video';
837
- const videoAvailableToPlay = fileState && isProcessedFileState(fileState);
838
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
840
+ const {
841
+ mimeType
842
+ } = getFileDetails(identifier, fileState);
843
+ const isVideoPlayable = videoIsPlayable(isBannedLocalPreview, fileState, mimeType);
844
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
839
845
  this.setState({
840
846
  isPlayingFile: true
841
847
  });
@@ -991,8 +997,6 @@ export const Card = withMediaAnalyticsContext({
991
997
  packageName,
992
998
  componentName: 'mediaCard',
993
999
  component: 'mediaCard'
994
- }, {
995
- filterFeatureFlags: LOGGED_FEATURE_FLAGS
996
1000
  })(withAnalyticsEvents()(injectIntl(CardBase, {
997
1001
  enforceContext: false
998
1002
  })));
@@ -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 = "74.6.1";
69
+ const packageVersion = "74.7.1";
70
70
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
71
71
  packageVersion,
72
72
  packageName,
@@ -54,7 +54,7 @@ class WrappedMediaInlineAnalyticsErrorBoundary extends React.Component {
54
54
  }
55
55
  _defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
56
56
  const packageName = "@atlaskit/media-card";
57
- const packageVersion = "74.6.1";
57
+ const packageVersion = "74.7.1";
58
58
  const MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
59
59
  packageVersion,
60
60
  packageName,
@@ -14,6 +14,7 @@ export const MediaInlineCardInternal = ({
14
14
  isSelected,
15
15
  onClick,
16
16
  mediaViewerDataSource,
17
+ mediaViewerItems,
17
18
  intl
18
19
  }) => {
19
20
  const [fileState, setFileState] = useState();
@@ -36,6 +37,7 @@ export const MediaInlineCardInternal = ({
36
37
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
37
38
  collectionName: identifier.collectionName || '',
38
39
  dataSource: dataSource,
40
+ items: mediaViewerItems,
39
41
  mediaClientConfig: mediaClient.mediaClientConfig,
40
42
  selectedItem: identifier,
41
43
  onClose: onMediaViewerClose
@@ -1,19 +1,7 @@
1
1
  import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
2
- import { ANALYTICS_MEDIA_CHANNEL, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
2
+ import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
3
3
  import { createAndFireEvent } from '@atlaskit/analytics-next';
4
4
  import { isMediaCardError } from '../errors';
5
- const relevantFlags = {
6
- newCardExperience: true,
7
- captions: true,
8
- timestampOnVideo: true,
9
- observedWidth: true,
10
- mediaInline: false,
11
- folderUploads: false,
12
- memoryCacheLogging: true,
13
- fetchFileStateAfterUpload: true
14
- };
15
- export const LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
16
- export const LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
17
5
  export const getFileAttributes = (metadata, fileStatus) => ({
18
6
  fileMediatype: metadata.mediaType,
19
7
  fileMimetype: metadata.mimeType,
@@ -1,9 +1,10 @@
1
1
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
2
- import { extractErrorInfo, getRenderErrorRequestMetadata, LOGGED_FEATURE_FLAG_KEYS } from './analytics';
2
+ import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
3
+ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
3
4
  import { MediaCardError } from '../errors';
4
5
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
5
6
  const packageName = "@atlaskit/media-card";
6
- const packageVersion = "74.6.1";
7
+ const packageVersion = "74.7.1";
7
8
  let concurrentExperience;
8
9
  const getExperience = id => {
9
10
  if (!concurrentExperience) {
@@ -13,7 +14,7 @@ const getExperience = id => {
13
14
  },
14
15
  type: ExperienceTypes.Experience,
15
16
  performanceType: ExperiencePerformanceTypes.InlineResult,
16
- featureFlags: LOGGED_FEATURE_FLAG_KEYS
17
+ featureFlags: getFeatureFlagKeysAllProducts()
17
18
  };
18
19
  concurrentExperience = new ConcurrentExperience('media-card-render', inlineExperience);
19
20
  }
@@ -0,0 +1,7 @@
1
+ import { isProcessedFileState } from '@atlaskit/media-client';
2
+ import { isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
3
+ export const videoIsPlayable = (isBannedLocalPreview, fileState, mimeType) => {
4
+ const localPreviewAvailable = mimeType && !isBannedLocalPreview && isVideoMimeTypeSupportedByBrowser(mimeType);
5
+ const videoProcessedByServer = fileState && isProcessedFileState(fileState);
6
+ return !!(localPreviewAvailable || videoProcessedByServer);
7
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.6.1",
3
+ "version": "74.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -18,16 +18,17 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
18
18
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
19
19
  import DownloadIcon from '@atlaskit/icon/glyph/download';
20
20
  import { getRandomHex } from '@atlaskit/media-common';
21
- import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, isProcessedFileState, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
21
+ import { globalMediaEventEmitter, isDifferentIdentifier, isFileIdentifier, RECENTS_COLLECTION, isImageRepresentationReady, isExternalImageIdentifier, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
22
22
  import { MediaViewer } from '@atlaskit/media-viewer';
23
23
  import { injectIntl, IntlProvider } from 'react-intl-next';
24
24
  import { CardView } from './cardView';
25
25
  import { ViewportDetector } from '../utils/viewportDetector';
26
+ import { videoIsPlayable } from '../utils/videoIsPlayable';
26
27
  import { getRequestedDimensions } from '../utils/getDataURIDimension';
27
28
  import { getCardPreview, getCardPreviewFromCache, removeCardPreviewFromCache, getFilePreviewFromFileState, shouldResolvePreview, getSSRCardPreview, isLocalPreview, isSSRPreview, isSSRClientPreview, isSSRDataPreview, fetchAndCacheRemotePreview } from './getCardPreview';
28
29
  import { getFileDetails } from '../utils/metadata';
29
30
  import { InlinePlayerLazy } from './inlinePlayerLazy';
30
- import { getFileAttributes, extractErrorInfo, LOGGED_FEATURE_FLAGS } from '../utils/analytics';
31
+ import { getFileAttributes, extractErrorInfo } from '../utils/analytics';
31
32
  import { isLocalPreviewError, MediaCardError, ensureMediaCardError, ImageLoadError } from '../errors';
32
33
  import { fireOperationalEvent as _fireOperationalEvent, fireCommencedEvent as _fireCommencedEvent, fireCopiedEvent, fireScreenEvent, fireNonCriticalErrorEvent } from './cardAnalytics';
33
34
  import getDocument from '../utils/document';
@@ -39,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
39
40
  import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
40
41
  import { generateUniqueId } from '../utils/generateUniqueId';
41
42
  var packageName = "@atlaskit/media-card";
42
- var packageVersion = "74.6.1";
43
+ var packageVersion = "74.7.1";
43
44
  export var CardBase = /*#__PURE__*/function (_Component) {
44
45
  _inherits(CardBase, _Component);
45
46
  var _super = _createSuper(CardBase);
@@ -505,6 +506,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
505
506
  mediaClient = _this$props7.mediaClient,
506
507
  identifier = _this$props7.identifier,
507
508
  mediaViewerDataSource = _this$props7.mediaViewerDataSource,
509
+ mediaViewerItems = _this$props7.mediaViewerItems,
508
510
  contextId = _this$props7.contextId,
509
511
  featureFlags = _this$props7.featureFlags;
510
512
  if (!mediaViewerSelectedItem) {
@@ -517,6 +519,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
517
519
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
518
520
  collectionName: collectionName,
519
521
  dataSource: dataSource,
522
+ items: mediaViewerItems,
520
523
  mediaClientConfig: mediaClient.config,
521
524
  selectedItem: mediaViewerSelectedItem,
522
525
  onClose: _this.onMediaViewerClose,
@@ -852,8 +855,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
852
855
  this.unsubscribe();
853
856
  }
854
857
  var isVideo = this.fileAttributes.fileMediatype === 'video';
855
- var videoAvailableToPlay = fileState && isProcessedFileState(fileState);
856
- if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
858
+ var _getFileDetails2 = getFileDetails(identifier, fileState),
859
+ mimeType = _getFileDetails2.mimeType;
860
+ var isVideoPlayable = videoIsPlayable(isBannedLocalPreview, fileState, mimeType);
861
+ if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
857
862
  this.setState({
858
863
  isPlayingFile: true
859
864
  });
@@ -1014,8 +1019,6 @@ export var Card = withMediaAnalyticsContext({
1014
1019
  packageName: packageName,
1015
1020
  componentName: 'mediaCard',
1016
1021
  component: 'mediaCard'
1017
- }, {
1018
- filterFeatureFlags: LOGGED_FEATURE_FLAGS
1019
1022
  })(withAnalyticsEvents()(injectIntl(CardBase, {
1020
1023
  enforceContext: false
1021
1024
  })));
@@ -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 = "74.6.1";
86
+ var packageVersion = "74.7.1";
87
87
  var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
88
88
  packageVersion: packageVersion,
89
89
  packageName: packageName,
@@ -70,7 +70,7 @@ var WrappedMediaInlineAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Com
70
70
  }(React.Component);
71
71
  _defineProperty(WrappedMediaInlineAnalyticsErrorBoundary, "displayName", 'MediaInlineAnalyticsErrorBoundary');
72
72
  var packageName = "@atlaskit/media-card";
73
- var packageVersion = "74.6.1";
73
+ var packageVersion = "74.7.1";
74
74
  var MediaInlineAnalyticsErrorBoundary = withMediaAnalyticsContext({
75
75
  packageVersion: packageVersion,
76
76
  packageName: packageName,
@@ -15,6 +15,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
15
15
  isSelected = _ref.isSelected,
16
16
  onClick = _ref.onClick,
17
17
  mediaViewerDataSource = _ref.mediaViewerDataSource,
18
+ mediaViewerItems = _ref.mediaViewerItems,
18
19
  intl = _ref.intl;
19
20
  var _useState = useState(),
20
21
  _useState2 = _slicedToArray(_useState, 2),
@@ -47,6 +48,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
47
48
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
48
49
  collectionName: identifier.collectionName || '',
49
50
  dataSource: dataSource,
51
+ items: mediaViewerItems,
50
52
  mediaClientConfig: mediaClient.mediaClientConfig,
51
53
  selectedItem: identifier,
52
54
  onClose: onMediaViewerClose
@@ -2,21 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
4
  import { getMediaClientErrorReason, isRequestError } from '@atlaskit/media-client';
5
- import { ANALYTICS_MEDIA_CHANNEL, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
5
+ import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
6
6
  import { createAndFireEvent } from '@atlaskit/analytics-next';
7
7
  import { isMediaCardError } from '../errors';
8
- var relevantFlags = {
9
- newCardExperience: true,
10
- captions: true,
11
- timestampOnVideo: true,
12
- observedWidth: true,
13
- mediaInline: false,
14
- folderUploads: false,
15
- memoryCacheLogging: true,
16
- fetchFileStateAfterUpload: true
17
- };
18
- export var LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
19
- export var LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
20
8
  export var getFileAttributes = function getFileAttributes(metadata, fileStatus) {
21
9
  return {
22
10
  fileMediatype: metadata.mediaType,
@@ -2,11 +2,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
4
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
5
- import { extractErrorInfo, getRenderErrorRequestMetadata, LOGGED_FEATURE_FLAG_KEYS } from './analytics';
5
+ import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
6
+ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
6
7
  import { MediaCardError } from '../errors';
7
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
8
9
  var packageName = "@atlaskit/media-card";
9
- var packageVersion = "74.6.1";
10
+ var packageVersion = "74.7.1";
10
11
  var concurrentExperience;
11
12
  var getExperience = function getExperience(id) {
12
13
  if (!concurrentExperience) {
@@ -16,7 +17,7 @@ var getExperience = function getExperience(id) {
16
17
  },
17
18
  type: ExperienceTypes.Experience,
18
19
  performanceType: ExperiencePerformanceTypes.InlineResult,
19
- featureFlags: LOGGED_FEATURE_FLAG_KEYS
20
+ featureFlags: getFeatureFlagKeysAllProducts()
20
21
  };
21
22
  concurrentExperience = new ConcurrentExperience('media-card-render', inlineExperience);
22
23
  }
@@ -0,0 +1,7 @@
1
+ import { isProcessedFileState } from '@atlaskit/media-client';
2
+ import { isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
3
+ export var videoIsPlayable = function videoIsPlayable(isBannedLocalPreview, fileState, mimeType) {
4
+ var localPreviewAvailable = mimeType && !isBannedLocalPreview && isVideoMimeTypeSupportedByBrowser(mimeType);
5
+ var videoProcessedByServer = fileState && isProcessedFileState(fileState);
6
+ return !!(localPreviewAvailable || videoProcessedByServer);
7
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.6.1",
3
+ "version": "74.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import React, { FC } from 'react';
2
- import { FileIdentifier, MediaClient } from '@atlaskit/media-client';
2
+ import { FileIdentifier, Identifier, MediaClient } from '@atlaskit/media-client';
3
3
  import { WrappedComponentProps } from 'react-intl-next';
4
4
  import { MediaViewerDataSource } from '@atlaskit/media-viewer';
5
5
  export interface MediaInlineCardProps {
@@ -8,7 +8,14 @@ export interface MediaInlineCardProps {
8
8
  shouldOpenMediaViewer?: boolean;
9
9
  isSelected?: boolean;
10
10
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
11
+ /**
12
+ * Includes data source like collection name,
13
+ * media file list.
14
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-149 Internal documentation for deprecation (no external access)}}
15
+ * Use mediaViewerItems instead
16
+ */
11
17
  mediaViewerDataSource?: MediaViewerDataSource;
18
+ mediaViewerItems?: Identifier[];
12
19
  }
13
20
  export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
14
21
  export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
@@ -75,10 +75,14 @@ export interface CardProps extends SharedCardProps, CardEventProps {
75
75
  readonly isLazy?: boolean;
76
76
  readonly useInlinePlayer?: boolean;
77
77
  readonly shouldOpenMediaViewer?: boolean;
78
- /** Imported from MediaViewer. It includes data source like collection name,
79
- * media file list.
78
+ /**
79
+ * Includes data source like collection name,
80
+ * media file list.
81
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-149 Internal documentation for deprecation (no external access)}}
82
+ * Use mediaViewerItems instead
80
83
  */
81
84
  readonly mediaViewerDataSource?: MediaViewerDataSource;
85
+ readonly mediaViewerItems?: Identifier[];
82
86
  readonly contextId?: string;
83
87
  readonly shouldEnableDownloadButton?: boolean;
84
88
  readonly ssr?: SSR;
@@ -13,8 +13,6 @@ export declare type CardPreviewAttributes = {
13
13
  declare type WithCardPreviewCacheAttributes = {
14
14
  cardPreviewAttributes: CardPreviewAttributes;
15
15
  };
16
- export declare const LOGGED_FEATURE_FLAGS: (keyof import("@atlaskit/media-common").MediaFeatureFlags)[];
17
- export declare const LOGGED_FEATURE_FLAG_KEYS: string[];
18
16
  export declare type FileUriFailReason = 'local-uri' | 'remote-uri' | `unknown-uri`;
19
17
  export declare type FailedErrorFailReason = MediaCardErrorPrimaryReason | 'nativeError';
20
18
  export declare type MediaCardErrorInfo = {
@@ -0,0 +1,2 @@
1
+ import { FileState } from '@atlaskit/media-client';
2
+ export declare const videoIsPlayable: (isBannedLocalPreview: boolean, fileState?: FileState | undefined, mimeType?: string | undefined) => boolean;
@@ -20,7 +20,6 @@ import { SelectableCard } from './selectableCard';
20
20
  import { Card, CardAppearance, CardEvent, CardAction } from '../src';
21
21
  import { MediaCardError } from '../src/errors';
22
22
  import DevelopmentUseMessage from './developmentUseMessage';
23
- import { LOGGED_FEATURE_FLAGS } from '../src/utils/analytics';
24
23
 
25
24
  const mediaClientConfig = createStorybookMediaClientConfig();
26
25
 
@@ -141,9 +140,7 @@ export const MainWrapper: React.FC<MainWrapperProps> = ({
141
140
  <>
142
141
  {developmentOnly && <DevelopmentUseMessage />}
143
142
  {!disableFeatureFlagWrapper ? (
144
- <FeatureFlagsWrapper filterFlags={LOGGED_FEATURE_FLAGS}>
145
- {children}
146
- </FeatureFlagsWrapper>
143
+ <FeatureFlagsWrapper>{children}</FeatureFlagsWrapper>
147
144
  ) : (
148
145
  <>{children}</>
149
146
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "74.6.1",
3
+ "version": "74.7.1",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,17 +29,17 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@atlaskit/analytics-next": "^9.0.0",
32
- "@atlaskit/dropdown-menu": "^11.6.0",
32
+ "@atlaskit/dropdown-menu": "^11.7.0",
33
33
  "@atlaskit/editor-shared-styles": "^2.3.0",
34
34
  "@atlaskit/icon": "^21.11.0",
35
- "@atlaskit/media-client": "^20.0.0",
36
- "@atlaskit/media-common": "^2.19.0",
35
+ "@atlaskit/media-client": "^20.2.0",
36
+ "@atlaskit/media-common": "^4.0.0",
37
37
  "@atlaskit/media-ui": "^22.3.0",
38
- "@atlaskit/media-viewer": "^47.4.0",
39
- "@atlaskit/spinner": "^15.3.0",
40
- "@atlaskit/theme": "^12.2.0",
38
+ "@atlaskit/media-viewer": "^47.5.0",
39
+ "@atlaskit/spinner": "^15.4.0",
40
+ "@atlaskit/theme": "^12.3.0",
41
41
  "@atlaskit/tokens": "^1.2.0",
42
- "@atlaskit/tooltip": "^17.6.0",
42
+ "@atlaskit/tooltip": "^17.7.0",
43
43
  "@atlaskit/ufo": "^0.1.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "classnames": "^2.2.5",
@@ -56,13 +56,13 @@
56
56
  "devDependencies": {
57
57
  "@atlaskit/analytics-listeners": "^8.5.0",
58
58
  "@atlaskit/analytics-namespaced-context": "^6.6.0",
59
- "@atlaskit/button": "^16.5.0",
59
+ "@atlaskit/button": "^16.6.0",
60
60
  "@atlaskit/checkbox": "^12.4.0",
61
61
  "@atlaskit/docs": "*",
62
62
  "@atlaskit/inline-message": "^11.4.0",
63
63
  "@atlaskit/media-core": "^34.0.0",
64
64
  "@atlaskit/media-picker": "^64.2.0",
65
- "@atlaskit/media-test-helpers": "^30.1.0",
65
+ "@atlaskit/media-test-helpers": "^31.0.0",
66
66
  "@atlaskit/radio": "^5.4.0",
67
67
  "@atlaskit/range": "^7.0.0",
68
68
  "@atlaskit/section-message": "^6.3.0",
package/report.api.md CHANGED
@@ -148,8 +148,11 @@ export interface CardProps extends SharedCardProps, CardEventProps {
148
148
  readonly isLazy?: boolean;
149
149
  // (undocumented)
150
150
  readonly mediaClient: MediaClient;
151
+ // @deprecated
151
152
  readonly mediaViewerDataSource?: MediaViewerDataSource;
152
153
  // (undocumented)
154
+ readonly mediaViewerItems?: Identifier[];
155
+ // (undocumented)
153
156
  readonly shouldEnableDownloadButton?: boolean;
154
157
  // (undocumented)
155
158
  readonly shouldOpenMediaViewer?: boolean;
@@ -311,9 +314,11 @@ interface MediaInlineCardProps {
311
314
  isSelected?: boolean;
312
315
  // (undocumented)
313
316
  mediaClient: MediaClient;
314
- // (undocumented)
317
+ // @deprecated
315
318
  mediaViewerDataSource?: MediaViewerDataSource;
316
319
  // (undocumented)
320
+ mediaViewerItems?: Identifier[];
321
+ // (undocumented)
317
322
  onClick?: React_2.EventHandler<React_2.KeyboardEvent | React_2.MouseEvent>;
318
323
  // (undocumented)
319
324
  shouldOpenMediaViewer?: boolean;