@atlaskit/media-card 77.4.4 → 77.4.6
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 +13 -0
- package/dist/cjs/card/card.js +42 -38
- package/dist/cjs/card/getCardPreview/filePreviewStatus.js +2 -0
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/fileCard.js +120 -521
- package/dist/cjs/card/v2/useFilePreview.js +592 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +7 -4
- package/dist/es2019/card/getCardPreview/filePreviewStatus.js +2 -0
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/fileCard.js +105 -436
- package/dist/es2019/card/v2/useFilePreview.js +499 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +42 -38
- package/dist/esm/card/getCardPreview/filePreviewStatus.js +2 -0
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/fileCard.js +125 -526
- package/dist/esm/card/v2/useFilePreview.js +584 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/card.d.ts +1 -1
- package/dist/types/card/v2/useFilePreview.d.ts +38 -0
- package/dist/types-ts4.5/card/card.d.ts +1 -1
- package/dist/types-ts4.5/card/v2/useFilePreview.d.ts +38 -0
- package/package.json +4 -4
- package/tmp/api-report-tmp.d.ts +0 -345
package/dist/esm/card/card.js
CHANGED
|
@@ -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.
|
|
43
|
+
var packageVersion = "77.4.6";
|
|
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
|
|
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$
|
|
448
|
-
shouldAutoplay = _this$
|
|
449
|
-
cardPreview = _this$
|
|
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$
|
|
537
|
-
status = _this$
|
|
538
|
-
progress = _this$
|
|
539
|
-
cardPreview = _this$
|
|
540
|
-
error = _this$
|
|
541
|
-
cardRef = _this$
|
|
542
|
-
isCardVisible = _this$
|
|
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$
|
|
713
|
-
isCardVisible = _this$
|
|
714
|
-
cardPreview = _this$
|
|
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$
|
|
763
|
-
isCardVisible = _this$
|
|
764
|
-
cardPreview = _this$
|
|
765
|
-
status = _this$
|
|
766
|
-
fileState = _this$
|
|
767
|
-
isBannedLocalPreview = _this$
|
|
768
|
-
previewDidRender = _this$
|
|
769
|
-
isPlayingFile = _this$
|
|
770
|
-
wasResolvedUpfrontPreview = _this$
|
|
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$
|
|
925
|
-
return getFileDetails(this.props.identifier, (_this$
|
|
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$
|
|
931
|
-
return getFileAttributes(this.metadata, (_this$
|
|
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$
|
|
937
|
-
status = _this$
|
|
938
|
-
error = _this$
|
|
939
|
-
fileState = _this$
|
|
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$
|
|
999
|
-
isPlayingFile = _this$
|
|
1000
|
-
mediaViewerSelectedItem = _this$
|
|
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"
|
|
@@ -26,6 +26,8 @@ export var extractFilePreviewStatus = function extractFilePreviewStatus(fileStat
|
|
|
26
26
|
isSupportedByBrowser: isSupportedByBrowser
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
|
|
30
|
+
// CXP-2723 TODO: Review this in relation to removing status from the hook
|
|
29
31
|
export var isPreviewableStatus = function isPreviewableStatus(cardStatus, _ref3) {
|
|
30
32
|
var isPreviewable = _ref3.isPreviewable,
|
|
31
33
|
hasPreview = _ref3.hasPreview,
|
|
@@ -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.
|
|
86
|
+
var packageVersion = "77.4.6";
|
|
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.
|
|
12
|
+
var packageVersion = "77.4.6";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|