@atlaskit/media-card 74.6.0 → 74.7.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 +17 -0
- package/dist/cjs/card/card.js +17 -7
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
- package/dist/cjs/inline/mediaInlineCard.js +2 -0
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/cjs/utils/videoIsPlayable.js +14 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/card.js +19 -8
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
- package/dist/es2019/inline/mediaInlineCard.js +2 -0
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/es2019/utils/videoIsPlayable.js +7 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/card.js +18 -8
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
- package/dist/esm/inline/mediaInlineCard.js +2 -0
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/esm/utils/videoIsPlayable.js +7 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/inline/mediaInlineCard.d.ts +8 -1
- package/dist/types/types.d.ts +6 -2
- package/dist/types/utils/videoIsPlayable.d.ts +2 -0
- package/package.json +7 -7
- package/report.api.md +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 74.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8a0a92b2885`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a0a92b2885) - MEX-2210 improve inconsistent behaviour on timestampOnVideo playback
|
|
8
|
+
- [`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.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 74.6.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`489f7b32ff6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/489f7b32ff6) - Fixed broken SSR error handling logic when the preview url fails to load
|
|
19
|
+
|
|
3
20
|
## 74.6.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -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.
|
|
51
|
+
var packageVersion = "74.7.0";
|
|
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,
|
|
@@ -767,7 +770,8 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
767
770
|
var prevMediaClient = prevProps.mediaClient,
|
|
768
771
|
prevIdentifier = prevProps.identifier,
|
|
769
772
|
prevDimensions = prevProps.dimensions;
|
|
770
|
-
var prevIsCardVisible = prevState.isCardVisible
|
|
773
|
+
var prevIsCardVisible = prevState.isCardVisible,
|
|
774
|
+
prevCardPreview = prevState.cardPreview;
|
|
771
775
|
var _this$props12 = this.props,
|
|
772
776
|
mediaClient = _this$props12.mediaClient,
|
|
773
777
|
identifier = _this$props12.identifier,
|
|
@@ -775,7 +779,8 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
775
779
|
featureFlags = _this$props12.featureFlags,
|
|
776
780
|
useInlinePlayer = _this$props12.useInlinePlayer,
|
|
777
781
|
disableOverlay = _this$props12.disableOverlay,
|
|
778
|
-
resizeMode = _this$props12.resizeMode
|
|
782
|
+
resizeMode = _this$props12.resizeMode,
|
|
783
|
+
ssr = _this$props12.ssr;
|
|
779
784
|
var _this$state4 = this.state,
|
|
780
785
|
isCardVisible = _this$state4.isCardVisible,
|
|
781
786
|
cardPreview = _this$state4.cardPreview,
|
|
@@ -799,6 +804,7 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
799
804
|
* ----------------------------------------------------
|
|
800
805
|
*/
|
|
801
806
|
var turnedVisible = !prevIsCardVisible && isCardVisible;
|
|
807
|
+
var hadSSRCardPreview = !!prevCardPreview && (0, _getCardPreview.isSSRClientPreview)(prevCardPreview) && !cardPreview;
|
|
802
808
|
var isNewMediaClient = prevMediaClient !== mediaClient;
|
|
803
809
|
var fileImageMode = (0, _mediaClient2.imageResizeModeToFileImageMode)(resizeMode);
|
|
804
810
|
this.updateFileStateFlag(fileState);
|
|
@@ -824,8 +830,10 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
824
830
|
this.fireScreenEvent();
|
|
825
831
|
}
|
|
826
832
|
}
|
|
827
|
-
if ((0, _mediaClient2.isFileIdentifier)(identifier) && turnedVisible && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
828
|
-
// This is a one-off call, only meant to happen
|
|
833
|
+
if ((0, _mediaClient2.isFileIdentifier)(identifier) && (turnedVisible || ssr === 'client' && hadSSRCardPreview) && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
834
|
+
// This is a one-off call, only meant to happen once in the component's lifecycle. Mainly when either:
|
|
835
|
+
// - turnedVisible = true
|
|
836
|
+
// - ssr = client and has no preview (the dataURI failed to load in the previous state, most likely because of an initial auth issue)
|
|
829
837
|
this.resolveUpfrontPreview(identifier);
|
|
830
838
|
} else if ((0, _mediaClient2.isFileIdentifier)(identifier) && fileState && (0, _getCardPreview.shouldResolvePreview)({
|
|
831
839
|
status: status,
|
|
@@ -855,8 +863,10 @@ var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
855
863
|
this.unsubscribe();
|
|
856
864
|
}
|
|
857
865
|
var isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
858
|
-
var
|
|
859
|
-
|
|
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)) {
|
|
860
870
|
this.setState({
|
|
861
871
|
isPlayingFile: true
|
|
862
872
|
});
|
|
@@ -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.
|
|
93
|
+
var packageVersion = "74.7.0";
|
|
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.
|
|
80
|
+
var packageVersion = "74.7.0";
|
|
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
|
|
@@ -13,7 +13,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
13
13
|
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
14
|
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
15
|
var packageName = "@atlaskit/media-card";
|
|
16
|
-
var packageVersion = "74.
|
|
16
|
+
var packageVersion = "74.7.0";
|
|
17
17
|
var concurrentExperience;
|
|
18
18
|
var getExperience = function getExperience(id) {
|
|
19
19
|
if (!concurrentExperience) {
|
|
@@ -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;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/card/card.js
CHANGED
|
@@ -5,11 +5,12 @@ 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,
|
|
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';
|
|
@@ -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.
|
|
30
|
+
const packageVersion = "74.7.0";
|
|
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,
|
|
@@ -736,7 +739,8 @@ export class CardBase extends Component {
|
|
|
736
739
|
dimensions: prevDimensions
|
|
737
740
|
} = prevProps;
|
|
738
741
|
const {
|
|
739
|
-
isCardVisible: prevIsCardVisible
|
|
742
|
+
isCardVisible: prevIsCardVisible,
|
|
743
|
+
cardPreview: prevCardPreview
|
|
740
744
|
} = prevState;
|
|
741
745
|
const {
|
|
742
746
|
mediaClient,
|
|
@@ -745,7 +749,8 @@ export class CardBase extends Component {
|
|
|
745
749
|
featureFlags,
|
|
746
750
|
useInlinePlayer,
|
|
747
751
|
disableOverlay,
|
|
748
|
-
resizeMode
|
|
752
|
+
resizeMode,
|
|
753
|
+
ssr
|
|
749
754
|
} = this.props;
|
|
750
755
|
const {
|
|
751
756
|
isCardVisible,
|
|
@@ -771,6 +776,7 @@ export class CardBase extends Component {
|
|
|
771
776
|
* ----------------------------------------------------
|
|
772
777
|
*/
|
|
773
778
|
const turnedVisible = !prevIsCardVisible && isCardVisible;
|
|
779
|
+
const hadSSRCardPreview = !!prevCardPreview && isSSRClientPreview(prevCardPreview) && !cardPreview;
|
|
774
780
|
const isNewMediaClient = prevMediaClient !== mediaClient;
|
|
775
781
|
const fileImageMode = imageResizeModeToFileImageMode(resizeMode);
|
|
776
782
|
this.updateFileStateFlag(fileState);
|
|
@@ -798,8 +804,10 @@ export class CardBase extends Component {
|
|
|
798
804
|
this.fireScreenEvent();
|
|
799
805
|
}
|
|
800
806
|
}
|
|
801
|
-
if (isFileIdentifier(identifier) && turnedVisible && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
802
|
-
// This is a one-off call, only meant to happen
|
|
807
|
+
if (isFileIdentifier(identifier) && (turnedVisible || ssr === 'client' && hadSSRCardPreview) && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
808
|
+
// This is a one-off call, only meant to happen once in the component's lifecycle. Mainly when either:
|
|
809
|
+
// - turnedVisible = true
|
|
810
|
+
// - ssr = client and has no preview (the dataURI failed to load in the previous state, most likely because of an initial auth issue)
|
|
803
811
|
this.resolveUpfrontPreview(identifier);
|
|
804
812
|
} else if (isFileIdentifier(identifier) && fileState && shouldResolvePreview({
|
|
805
813
|
status,
|
|
@@ -829,8 +837,11 @@ export class CardBase extends Component {
|
|
|
829
837
|
this.unsubscribe();
|
|
830
838
|
}
|
|
831
839
|
const isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
832
|
-
const
|
|
833
|
-
|
|
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)) {
|
|
834
845
|
this.setState({
|
|
835
846
|
isPlayingFile: true
|
|
836
847
|
});
|
|
@@ -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.
|
|
69
|
+
const packageVersion = "74.7.0";
|
|
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.
|
|
57
|
+
const packageVersion = "74.7.0";
|
|
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
|
|
@@ -3,7 +3,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata, LOGGED_FEATURE_FLAG_KE
|
|
|
3
3
|
import { MediaCardError } from '../errors';
|
|
4
4
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
5
5
|
const packageName = "@atlaskit/media-card";
|
|
6
|
-
const packageVersion = "74.
|
|
6
|
+
const packageVersion = "74.7.0";
|
|
7
7
|
let concurrentExperience;
|
|
8
8
|
const getExperience = id => {
|
|
9
9
|
if (!concurrentExperience) {
|
|
@@ -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
|
+
};
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/card/card.js
CHANGED
|
@@ -18,11 +18,12 @@ 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,
|
|
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';
|
|
@@ -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.
|
|
43
|
+
var packageVersion = "74.7.0";
|
|
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,
|
|
@@ -759,7 +762,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
759
762
|
var prevMediaClient = prevProps.mediaClient,
|
|
760
763
|
prevIdentifier = prevProps.identifier,
|
|
761
764
|
prevDimensions = prevProps.dimensions;
|
|
762
|
-
var prevIsCardVisible = prevState.isCardVisible
|
|
765
|
+
var prevIsCardVisible = prevState.isCardVisible,
|
|
766
|
+
prevCardPreview = prevState.cardPreview;
|
|
763
767
|
var _this$props12 = this.props,
|
|
764
768
|
mediaClient = _this$props12.mediaClient,
|
|
765
769
|
identifier = _this$props12.identifier,
|
|
@@ -767,7 +771,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
767
771
|
featureFlags = _this$props12.featureFlags,
|
|
768
772
|
useInlinePlayer = _this$props12.useInlinePlayer,
|
|
769
773
|
disableOverlay = _this$props12.disableOverlay,
|
|
770
|
-
resizeMode = _this$props12.resizeMode
|
|
774
|
+
resizeMode = _this$props12.resizeMode,
|
|
775
|
+
ssr = _this$props12.ssr;
|
|
771
776
|
var _this$state4 = this.state,
|
|
772
777
|
isCardVisible = _this$state4.isCardVisible,
|
|
773
778
|
cardPreview = _this$state4.cardPreview,
|
|
@@ -791,6 +796,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
791
796
|
* ----------------------------------------------------
|
|
792
797
|
*/
|
|
793
798
|
var turnedVisible = !prevIsCardVisible && isCardVisible;
|
|
799
|
+
var hadSSRCardPreview = !!prevCardPreview && isSSRClientPreview(prevCardPreview) && !cardPreview;
|
|
794
800
|
var isNewMediaClient = prevMediaClient !== mediaClient;
|
|
795
801
|
var fileImageMode = imageResizeModeToFileImageMode(resizeMode);
|
|
796
802
|
this.updateFileStateFlag(fileState);
|
|
@@ -816,8 +822,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
816
822
|
this.fireScreenEvent();
|
|
817
823
|
}
|
|
818
824
|
}
|
|
819
|
-
if (isFileIdentifier(identifier) && turnedVisible && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
820
|
-
// This is a one-off call, only meant to happen
|
|
825
|
+
if (isFileIdentifier(identifier) && (turnedVisible || ssr === 'client' && hadSSRCardPreview) && !cardPreview && !wasResolvedUpfrontPreview) {
|
|
826
|
+
// This is a one-off call, only meant to happen once in the component's lifecycle. Mainly when either:
|
|
827
|
+
// - turnedVisible = true
|
|
828
|
+
// - ssr = client and has no preview (the dataURI failed to load in the previous state, most likely because of an initial auth issue)
|
|
821
829
|
this.resolveUpfrontPreview(identifier);
|
|
822
830
|
} else if (isFileIdentifier(identifier) && fileState && shouldResolvePreview({
|
|
823
831
|
status: status,
|
|
@@ -847,8 +855,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
847
855
|
this.unsubscribe();
|
|
848
856
|
}
|
|
849
857
|
var isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
850
|
-
var
|
|
851
|
-
|
|
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)) {
|
|
852
862
|
this.setState({
|
|
853
863
|
isPlayingFile: true
|
|
854
864
|
});
|
|
@@ -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.
|
|
86
|
+
var packageVersion = "74.7.0";
|
|
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.
|
|
73
|
+
var packageVersion = "74.7.0";
|
|
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
|
|
@@ -6,7 +6,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata, LOGGED_FEATURE_FLAG_KE
|
|
|
6
6
|
import { MediaCardError } from '../errors';
|
|
7
7
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
8
8
|
var packageName = "@atlaskit/media-card";
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.7.0";
|
|
10
10
|
var concurrentExperience;
|
|
11
11
|
var getExperience = function getExperience(id) {
|
|
12
12
|
if (!concurrentExperience) {
|
|
@@ -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
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -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>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
79
|
-
*
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "74.
|
|
3
|
+
"version": "74.7.0",
|
|
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.
|
|
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.
|
|
36
|
-
"@atlaskit/media-common": "^
|
|
35
|
+
"@atlaskit/media-client": "^20.1.0",
|
|
36
|
+
"@atlaskit/media-common": "^3.0.0",
|
|
37
37
|
"@atlaskit/media-ui": "^22.3.0",
|
|
38
|
-
"@atlaskit/media-viewer": "^47.
|
|
39
|
-
"@atlaskit/spinner": "^15.
|
|
38
|
+
"@atlaskit/media-viewer": "^47.5.0",
|
|
39
|
+
"@atlaskit/spinner": "^15.4.0",
|
|
40
40
|
"@atlaskit/theme": "^12.2.0",
|
|
41
41
|
"@atlaskit/tokens": "^1.2.0",
|
|
42
|
-
"@atlaskit/tooltip": "^17.
|
|
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",
|
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
|
-
//
|
|
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;
|