@atlaskit/media-card 74.5.1 → 74.5.2
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 +6 -0
- package/dist/cjs/card/actions.js +0 -5
- package/dist/cjs/card/card.js +126 -260
- package/dist/cjs/card/cardAnalytics.js +0 -18
- package/dist/cjs/card/cardImageView/cardImageViewWrapper.js +7 -16
- package/dist/cjs/card/cardImageView/cardOverlay/cardOverlayComponents.js +3 -15
- package/dist/cjs/card/cardImageView/cardOverlay/index.js +20 -52
- package/dist/cjs/card/cardImageView/cardOverlay/styles.js +1 -19
- package/dist/cjs/card/cardImageView/cardViewWrapper.js +7 -10
- package/dist/cjs/card/cardImageView/fileCardImageView.js +66 -111
- package/dist/cjs/card/cardImageView/index.js +0 -1
- package/dist/cjs/card/cardImageView/styles.js +0 -14
- package/dist/cjs/card/cardLoader.js +3 -20
- package/dist/cjs/card/cardState.js +0 -9
- package/dist/cjs/card/cardView.js +105 -198
- package/dist/cjs/card/getCardPreview/cache.js +0 -12
- package/dist/cjs/card/getCardPreview/filePreviewStatus.js +8 -16
- package/dist/cjs/card/getCardPreview/helpers.js +0 -39
- package/dist/cjs/card/getCardPreview/imageRefetchingAnalytics.js +0 -8
- package/dist/cjs/card/getCardPreview/index.js +16 -85
- package/dist/cjs/card/getCardStatus.js +5 -24
- package/dist/cjs/card/index.js +0 -2
- package/dist/cjs/card/inlinePlayer.js +19 -102
- package/dist/cjs/card/inlinePlayerLazy.js +0 -11
- package/dist/cjs/card/inlinePlayerWrapper.js +5 -8
- package/dist/cjs/card/media-card-analytics-error-boundary.js +6 -34
- package/dist/cjs/card/styles/animations.js +0 -5
- package/dist/cjs/card/styles/getSelectedBorderStyle.js +0 -4
- package/dist/cjs/card/styles/index.js +0 -14
- package/dist/cjs/card/styles/mixins.js +0 -11
- package/dist/cjs/card/styles/styles.js +4 -20
- package/dist/cjs/card/ui/actionsBar/actionsBar.js +2 -20
- package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +1 -4
- package/dist/cjs/card/ui/actionsBar/styles.js +0 -8
- package/dist/cjs/card/ui/blanket/blanket.js +1 -4
- package/dist/cjs/card/ui/blanket/styles.js +0 -9
- package/dist/cjs/card/ui/common.js +0 -8
- package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +2 -5
- package/dist/cjs/card/ui/iconMessage/index.js +4 -22
- package/dist/cjs/card/ui/iconMessage/styles.js +1 -10
- package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +2 -5
- package/dist/cjs/card/ui/iconWrapper/styles.js +3 -11
- package/dist/cjs/card/ui/imageRenderer/imageRenderer.js +8 -21
- package/dist/cjs/card/ui/loadingRateLimited/styles.js +1 -10
- package/dist/cjs/card/ui/newFileExperience/newFileExperienceWrapper.js +14 -19
- package/dist/cjs/card/ui/newFileExperience/styles.js +10 -26
- package/dist/cjs/card/ui/playButton/playButton.js +0 -7
- package/dist/cjs/card/ui/playButton/playButtonBackground.js +1 -4
- package/dist/cjs/card/ui/playButton/playButtonWrapper.js +1 -4
- package/dist/cjs/card/ui/playButton/styles.js +0 -6
- package/dist/cjs/card/ui/progressBar/progressBar.js +6 -14
- package/dist/cjs/card/ui/progressBar/styledBar.js +4 -7
- package/dist/cjs/card/ui/progressBar/styles.js +4 -18
- package/dist/cjs/card/ui/styles.js +12 -46
- package/dist/cjs/card/ui/tickBox/styles.js +0 -11
- package/dist/cjs/card/ui/tickBox/tickBox.js +0 -6
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +1 -4
- package/dist/cjs/card/ui/titleBox/failedTitleBox.js +2 -11
- package/dist/cjs/card/ui/titleBox/styles.js +4 -19
- package/dist/cjs/card/ui/titleBox/titleBox.js +9 -21
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +2 -14
- package/dist/cjs/card/ui/unhandledErrorCard/index.js +6 -36
- package/dist/cjs/classnames.js +0 -1
- package/dist/cjs/errors.js +7 -66
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/inline/index.js +0 -2
- package/dist/cjs/inline/loader.js +2 -43
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +4 -29
- package/dist/cjs/inline/mediaInlineCard.js +21 -57
- package/dist/cjs/types.js +0 -2
- package/dist/cjs/utils/analytics.js +0 -49
- package/dist/cjs/utils/breakpoint.js +0 -10
- package/dist/cjs/utils/cardActions/cardActionButton.js +1 -4
- package/dist/cjs/utils/cardActions/cardActionIconButton.js +7 -29
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +6 -35
- package/dist/cjs/utils/cardActions/cardActionsView.js +7 -34
- package/dist/cjs/utils/cardActions/index.js +0 -4
- package/dist/cjs/utils/cardActions/styles.js +0 -13
- package/dist/cjs/utils/cardDimensions.js +5 -22
- package/dist/cjs/utils/containsPixelUnit.js +0 -2
- package/dist/cjs/utils/dimensionComparer.js +0 -8
- package/dist/cjs/utils/document.js +0 -4
- package/dist/cjs/utils/errorIcon/index.js +0 -18
- package/dist/cjs/utils/errorIcon/styles.js +0 -5
- package/dist/cjs/utils/fileIcon/index.js +3 -21
- package/dist/cjs/utils/fileIcon/styles.js +0 -6
- package/dist/cjs/utils/generateUniqueId.js +0 -2
- package/dist/cjs/utils/getCSSUnitValue.js +0 -1
- package/dist/cjs/utils/getDataURIDimension.js +0 -13
- package/dist/cjs/utils/getElementDimension.js +0 -2
- package/dist/cjs/utils/getErrorMessage.js +0 -6
- package/dist/cjs/utils/getMediaCardCursor.js +1 -6
- package/dist/cjs/utils/globalScope/getSSRData.js +0 -5
- package/dist/cjs/utils/globalScope/globalScope.js +8 -25
- package/dist/cjs/utils/globalScope/index.js +0 -2
- package/dist/cjs/utils/index.js +0 -12
- package/dist/cjs/utils/isRetina.js +0 -1
- package/dist/cjs/utils/isValidPercentageUnit.js +0 -2
- package/dist/cjs/utils/lightCards/cardError.js +0 -21
- package/dist/cjs/utils/lightCards/cardLoading.js +3 -27
- package/dist/cjs/utils/lightCards/getDimensionsWithDefault.js +0 -2
- package/dist/cjs/utils/lightCards/lightCardWrappers.js +1 -9
- package/dist/cjs/utils/lightCards/styles.js +1 -13
- package/dist/cjs/utils/metadata.js +0 -7
- package/dist/cjs/utils/objectURLCache.js +0 -22
- package/dist/cjs/utils/preventClickThrough.js +0 -5
- package/dist/cjs/utils/printScript.js +0 -10
- package/dist/cjs/utils/progressBar/index.js +0 -17
- package/dist/cjs/utils/progressBar/styles.js +0 -6
- package/dist/cjs/utils/resizeModeToMediaImageProps.js +0 -1
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +0 -5
- package/dist/cjs/utils/ufoExperiences.js +1 -21
- package/dist/cjs/utils/videoSnapshot.js +2 -11
- package/dist/cjs/utils/viewportDetector.js +5 -24
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/actions.js +2 -1
- package/dist/es2019/card/card.js +26 -121
- package/dist/es2019/card/cardAnalytics.js +0 -5
- package/dist/es2019/card/cardImageView/cardOverlay/index.js +2 -16
- package/dist/es2019/card/cardImageView/cardOverlay/styles.js +1 -2
- package/dist/es2019/card/cardImageView/fileCardImageView.js +3 -36
- package/dist/es2019/card/cardImageView/styles.js +0 -3
- package/dist/es2019/card/cardLoader.js +3 -14
- package/dist/es2019/card/cardState.js +1 -2
- package/dist/es2019/card/cardView.js +24 -68
- package/dist/es2019/card/getCardPreview/cache.js +0 -4
- package/dist/es2019/card/getCardPreview/filePreviewStatus.js +8 -5
- package/dist/es2019/card/getCardPreview/helpers.js +0 -9
- package/dist/es2019/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
- package/dist/es2019/card/getCardPreview/index.js +16 -30
- package/dist/es2019/card/getCardStatus.js +2 -15
- package/dist/es2019/card/inlinePlayer.js +2 -35
- package/dist/es2019/card/inlinePlayerLazy.js +1 -2
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -15
- package/dist/es2019/card/styles/getSelectedBorderStyle.js +1 -1
- package/dist/es2019/card/styles/styles.js +0 -3
- package/dist/es2019/card/ui/actionsBar/actionsBar.js +0 -3
- package/dist/es2019/card/ui/common.js +0 -2
- package/dist/es2019/card/ui/iconMessage/styles.js +0 -2
- package/dist/es2019/card/ui/iconWrapper/styles.js +2 -2
- package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +0 -3
- package/dist/es2019/card/ui/progressBar/styles.js +1 -3
- package/dist/es2019/card/ui/styles.js +3 -4
- package/dist/es2019/card/ui/titleBox/styles.js +2 -3
- package/dist/es2019/card/ui/unhandledErrorCard/index.js +0 -8
- package/dist/es2019/errors.js +8 -17
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/inline/loader.js +1 -18
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -12
- package/dist/es2019/inline/mediaInlineCard.js +0 -15
- package/dist/es2019/types.js +1 -1
- package/dist/es2019/utils/analytics.js +0 -3
- package/dist/es2019/utils/breakpoint.js +0 -4
- package/dist/es2019/utils/cardActions/cardActionIconButton.js +3 -5
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +0 -5
- package/dist/es2019/utils/cardActions/cardActionsView.js +0 -10
- package/dist/es2019/utils/cardActions/styles.js +0 -3
- package/dist/es2019/utils/cardDimensions.js +7 -14
- package/dist/es2019/utils/dimensionComparer.js +0 -3
- package/dist/es2019/utils/document.js +0 -2
- package/dist/es2019/utils/errorIcon/index.js +0 -3
- package/dist/es2019/utils/fileIcon/index.js +0 -1
- package/dist/es2019/utils/getDataURIDimension.js +0 -4
- package/dist/es2019/utils/getMediaCardCursor.js +1 -4
- package/dist/es2019/utils/globalScope/getSSRData.js +0 -2
- package/dist/es2019/utils/globalScope/globalScope.js +3 -10
- package/dist/es2019/utils/lightCards/cardError.js +0 -3
- package/dist/es2019/utils/lightCards/cardLoading.js +0 -3
- package/dist/es2019/utils/lightCards/lightCardWrappers.js +0 -1
- package/dist/es2019/utils/metadata.js +0 -5
- package/dist/es2019/utils/objectURLCache.js +0 -10
- package/dist/es2019/utils/printScript.js +0 -3
- package/dist/es2019/utils/progressBar/index.js +0 -2
- package/dist/es2019/utils/shouldDisplayImageThumbnail.js +0 -2
- package/dist/es2019/utils/ufoExperiences.js +5 -10
- package/dist/es2019/utils/videoSnapshot.js +2 -4
- package/dist/es2019/utils/viewportDetector.js +0 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/actions.js +0 -3
- package/dist/esm/card/card.js +126 -254
- package/dist/esm/card/cardAnalytics.js +0 -6
- package/dist/esm/card/cardImageView/cardImageViewWrapper.js +6 -6
- package/dist/esm/card/cardImageView/cardOverlay/cardOverlayComponents.js +2 -2
- package/dist/esm/card/cardImageView/cardOverlay/index.js +22 -37
- package/dist/esm/card/cardImageView/cardOverlay/styles.js +2 -6
- package/dist/esm/card/cardImageView/cardViewWrapper.js +6 -6
- package/dist/esm/card/cardImageView/fileCardImageView.js +66 -104
- package/dist/esm/card/cardImageView/styles.js +0 -5
- package/dist/esm/card/cardLoader.js +6 -17
- package/dist/esm/card/cardState.js +1 -2
- package/dist/esm/card/cardView.js +105 -171
- package/dist/esm/card/getCardPreview/cache.js +0 -7
- package/dist/esm/card/getCardPreview/filePreviewStatus.js +11 -11
- package/dist/esm/card/getCardPreview/helpers.js +0 -28
- package/dist/esm/card/getCardPreview/imageRefetchingAnalytics.js +0 -3
- package/dist/esm/card/getCardPreview/index.js +16 -53
- package/dist/esm/card/getCardStatus.js +5 -20
- package/dist/esm/card/inlinePlayer.js +19 -85
- package/dist/esm/card/inlinePlayerLazy.js +1 -5
- package/dist/esm/card/inlinePlayerWrapper.js +4 -4
- package/dist/esm/card/media-card-analytics-error-boundary.js +6 -28
- package/dist/esm/card/styles/animations.js +0 -2
- package/dist/esm/card/styles/getSelectedBorderStyle.js +1 -1
- package/dist/esm/card/styles/index.js +0 -2
- package/dist/esm/card/styles/styles.js +4 -9
- package/dist/esm/card/ui/actionsBar/actionsBar.js +2 -12
- package/dist/esm/card/ui/actionsBar/styles.js +0 -2
- package/dist/esm/card/ui/blanket/styles.js +0 -2
- package/dist/esm/card/ui/common.js +0 -4
- package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +1 -1
- package/dist/esm/card/ui/iconMessage/index.js +4 -4
- package/dist/esm/card/ui/iconMessage/styles.js +1 -5
- package/dist/esm/card/ui/iconWrapper/iconWrapper.js +1 -1
- package/dist/esm/card/ui/iconWrapper/styles.js +3 -5
- package/dist/esm/card/ui/imageRenderer/imageRenderer.js +8 -11
- package/dist/esm/card/ui/loadingRateLimited/styles.js +1 -3
- package/dist/esm/card/ui/newFileExperience/newFileExperienceWrapper.js +13 -13
- package/dist/esm/card/ui/newFileExperience/styles.js +10 -12
- package/dist/esm/card/ui/playButton/styles.js +0 -2
- package/dist/esm/card/ui/progressBar/progressBar.js +6 -6
- package/dist/esm/card/ui/progressBar/styledBar.js +3 -3
- package/dist/esm/card/ui/progressBar/styles.js +4 -8
- package/dist/esm/card/ui/styles.js +12 -20
- package/dist/esm/card/ui/tickBox/styles.js +0 -2
- package/dist/esm/card/ui/titleBox/failedTitleBox.js +2 -2
- package/dist/esm/card/ui/titleBox/styles.js +4 -7
- package/dist/esm/card/ui/titleBox/titleBox.js +9 -11
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -1
- package/dist/esm/card/ui/unhandledErrorCard/index.js +6 -24
- package/dist/esm/errors.js +8 -40
- package/dist/esm/index.js +1 -0
- package/dist/esm/inline/loader.js +3 -40
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +4 -23
- package/dist/esm/inline/mediaInlineCard.js +21 -40
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils/analytics.js +0 -6
- package/dist/esm/utils/breakpoint.js +0 -5
- package/dist/esm/utils/cardActions/cardActionIconButton.js +7 -18
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +6 -19
- package/dist/esm/utils/cardActions/cardActionsView.js +7 -22
- package/dist/esm/utils/cardActions/styles.js +0 -5
- package/dist/esm/utils/cardDimensions.js +7 -14
- package/dist/esm/utils/dimensionComparer.js +0 -3
- package/dist/esm/utils/document.js +0 -2
- package/dist/esm/utils/errorIcon/index.js +0 -9
- package/dist/esm/utils/errorIcon/styles.js +0 -2
- package/dist/esm/utils/fileIcon/index.js +3 -11
- package/dist/esm/utils/fileIcon/styles.js +0 -2
- package/dist/esm/utils/getDataURIDimension.js +0 -4
- package/dist/esm/utils/getMediaCardCursor.js +1 -4
- package/dist/esm/utils/globalScope/getSSRData.js +0 -2
- package/dist/esm/utils/globalScope/globalScope.js +8 -15
- package/dist/esm/utils/lightCards/cardError.js +0 -9
- package/dist/esm/utils/lightCards/cardLoading.js +3 -13
- package/dist/esm/utils/lightCards/lightCardWrappers.js +0 -1
- package/dist/esm/utils/lightCards/styles.js +1 -3
- package/dist/esm/utils/metadata.js +0 -5
- package/dist/esm/utils/objectURLCache.js +0 -15
- package/dist/esm/utils/printScript.js +0 -5
- package/dist/esm/utils/progressBar/index.js +0 -9
- package/dist/esm/utils/progressBar/styles.js +0 -2
- package/dist/esm/utils/shouldDisplayImageThumbnail.js +0 -2
- package/dist/esm/utils/ufoExperiences.js +1 -12
- package/dist/esm/utils/videoSnapshot.js +2 -6
- package/dist/esm/utils/viewportDetector.js +5 -16
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
package/dist/esm/card/card.js
CHANGED
|
@@ -8,15 +8,10 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
|
|
12
11
|
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; }
|
|
13
|
-
|
|
14
12
|
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; }
|
|
15
|
-
|
|
16
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
-
|
|
18
14
|
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; } }
|
|
19
|
-
|
|
20
15
|
import React, { Component, Suspense } from 'react';
|
|
21
16
|
import ReactDOM from 'react-dom';
|
|
22
17
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -44,33 +39,28 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
44
39
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
45
40
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
46
41
|
var packageName = "@atlaskit/media-card";
|
|
47
|
-
var packageVersion = "74.5.
|
|
42
|
+
var packageVersion = "74.5.2";
|
|
48
43
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
49
44
|
_inherits(CardBase, _Component);
|
|
50
|
-
|
|
51
45
|
var _super = _createSuper(CardBase);
|
|
52
|
-
|
|
53
46
|
// An internalOccurrenceKey is a randomly generated value to differentiate various instances
|
|
54
47
|
// of Cards regardless of whether it shares the same file (either internal or external)
|
|
48
|
+
|
|
55
49
|
// We initialise timeElapsedTillCommenced
|
|
56
50
|
// to avoid extra branching on a possibly undefined value.
|
|
51
|
+
|
|
57
52
|
// Generate unique traceId for file
|
|
53
|
+
|
|
58
54
|
function CardBase(props) {
|
|
59
55
|
var _this;
|
|
60
|
-
|
|
61
56
|
_classCallCheck(this, CardBase);
|
|
62
|
-
|
|
63
57
|
_this = _super.call(this, props);
|
|
64
|
-
|
|
65
58
|
_defineProperty(_assertThisInitialized(_this), "internalOccurrenceKey", generateUniqueId());
|
|
66
|
-
|
|
67
59
|
_defineProperty(_assertThisInitialized(_this), "hasBeenMounted", false);
|
|
68
|
-
|
|
69
60
|
_defineProperty(_assertThisInitialized(_this), "fileStateFlags", {
|
|
70
61
|
wasStatusUploading: false,
|
|
71
62
|
wasStatusProcessing: false
|
|
72
63
|
});
|
|
73
|
-
|
|
74
64
|
_defineProperty(_assertThisInitialized(_this), "ssrReliability", {
|
|
75
65
|
server: {
|
|
76
66
|
status: 'unknown'
|
|
@@ -79,13 +69,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
79
69
|
status: 'unknown'
|
|
80
70
|
}
|
|
81
71
|
});
|
|
82
|
-
|
|
83
72
|
_defineProperty(_assertThisInitialized(_this), "timeElapsedTillCommenced", performance.now());
|
|
84
|
-
|
|
85
73
|
_defineProperty(_assertThisInitialized(_this), "traceContext", {
|
|
86
74
|
traceId: getRandomHex(8)
|
|
87
75
|
});
|
|
88
|
-
|
|
89
76
|
_defineProperty(_assertThisInitialized(_this), "getImageURLParams", function (_ref) {
|
|
90
77
|
var collection = _ref.collectionName;
|
|
91
78
|
return _objectSpread(_objectSpread({
|
|
@@ -95,20 +82,17 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
95
82
|
allowAnimated: true
|
|
96
83
|
});
|
|
97
84
|
});
|
|
98
|
-
|
|
99
85
|
_defineProperty(_assertThisInitialized(_this), "getMediaBlobUrlAttrs", function (identifier, fileState) {
|
|
100
86
|
var id = identifier.id,
|
|
101
|
-
|
|
87
|
+
collection = identifier.collectionName;
|
|
102
88
|
var _this$props = _this.props,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
89
|
+
originalDimensions = _this$props.originalDimensions,
|
|
90
|
+
contextId = _this$props.contextId,
|
|
91
|
+
alt = _this$props.alt;
|
|
107
92
|
var _getFileDetails = getFileDetails(identifier, fileState),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
mimeType = _getFileDetails.mimeType,
|
|
94
|
+
name = _getFileDetails.name,
|
|
95
|
+
size = _getFileDetails.size;
|
|
112
96
|
return contextId ? _objectSpread(_objectSpread({
|
|
113
97
|
id: id,
|
|
114
98
|
collection: collection,
|
|
@@ -120,15 +104,14 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
120
104
|
alt: alt
|
|
121
105
|
}) : undefined;
|
|
122
106
|
});
|
|
123
|
-
|
|
124
107
|
_defineProperty(_assertThisInitialized(_this), "getCardPreviewParams", function (identifier, fileState) {
|
|
125
108
|
var isBannedLocalPreview = _this.state.isBannedLocalPreview;
|
|
126
109
|
var id = identifier.id;
|
|
127
110
|
var _this$props2 = _this.props,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
111
|
+
_this$props2$dimensio = _this$props2.dimensions,
|
|
112
|
+
dimensions = _this$props2$dimensio === void 0 ? {} : _this$props2$dimensio,
|
|
113
|
+
mediaClient = _this$props2.mediaClient,
|
|
114
|
+
createAnalyticsEvent = _this$props2.createAnalyticsEvent;
|
|
132
115
|
return {
|
|
133
116
|
mediaClient: mediaClient,
|
|
134
117
|
id: id,
|
|
@@ -143,23 +126,21 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
143
126
|
traceContext: _this.traceContext
|
|
144
127
|
};
|
|
145
128
|
});
|
|
146
|
-
|
|
147
129
|
_defineProperty(_assertThisInitialized(_this), "setCacheSSRPreview", function (identifier) {
|
|
148
130
|
var _this$props3 = _this.props,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier)).catch(function () {
|
|
131
|
+
mediaClient = _this$props3.mediaClient,
|
|
132
|
+
_this$props3$dimensio = _this$props3.dimensions,
|
|
133
|
+
dimensions = _this$props3$dimensio === void 0 ? {} : _this$props3$dimensio;
|
|
134
|
+
fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier)).catch(function () {
|
|
135
|
+
// No need to log this error.
|
|
153
136
|
// If preview fails, it will be refetched later
|
|
154
137
|
//TODO: test this catch
|
|
155
138
|
// https://product-fabric.atlassian.net/browse/MEX-1071
|
|
156
139
|
});
|
|
157
140
|
});
|
|
158
|
-
|
|
159
141
|
_defineProperty(_assertThisInitialized(_this), "refetchSSRPreview", /*#__PURE__*/function () {
|
|
160
142
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(identifier) {
|
|
161
143
|
var _this$props4, mediaClient, _this$props4$dimensio, dimensions, cardPreview, wrappedError;
|
|
162
|
-
|
|
163
144
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
164
145
|
while (1) {
|
|
165
146
|
switch (_context.prev = _context.next) {
|
|
@@ -168,24 +149,18 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
168
149
|
_context.prev = 1;
|
|
169
150
|
_context.next = 4;
|
|
170
151
|
return fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, _this.getImageURLParams(identifier), _this.getMediaBlobUrlAttrs(identifier));
|
|
171
|
-
|
|
172
152
|
case 4:
|
|
173
153
|
cardPreview = _context.sent;
|
|
174
|
-
|
|
175
154
|
_this.safeSetState({
|
|
176
155
|
cardPreview: cardPreview
|
|
177
156
|
});
|
|
178
|
-
|
|
179
157
|
_context.next = 12;
|
|
180
158
|
break;
|
|
181
|
-
|
|
182
159
|
case 8:
|
|
183
160
|
_context.prev = 8;
|
|
184
161
|
_context.t0 = _context["catch"](1);
|
|
185
162
|
wrappedError = ensureMediaCardError('remote-preview-fetch-ssr', _context.t0, true);
|
|
186
|
-
|
|
187
163
|
_this.fireNonCriticalErrorEvent(wrappedError);
|
|
188
|
-
|
|
189
164
|
case 12:
|
|
190
165
|
case "end":
|
|
191
166
|
return _context.stop();
|
|
@@ -193,12 +168,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
193
168
|
}
|
|
194
169
|
}, _callee, null, [[1, 8]]);
|
|
195
170
|
}));
|
|
196
|
-
|
|
197
171
|
return function (_x) {
|
|
198
172
|
return _ref2.apply(this, arguments);
|
|
199
173
|
};
|
|
200
174
|
}());
|
|
201
|
-
|
|
202
175
|
_defineProperty(_assertThisInitialized(_this), "resolvePreview", /*#__PURE__*/function () {
|
|
203
176
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(identifier, fileState) {
|
|
204
177
|
var params, cardPreview, wrappedError;
|
|
@@ -210,17 +183,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
210
183
|
params = _this.getCardPreviewParams(identifier, fileState);
|
|
211
184
|
_context2.next = 4;
|
|
212
185
|
return getCardPreview(params);
|
|
213
|
-
|
|
214
186
|
case 4:
|
|
215
187
|
cardPreview = _context2.sent;
|
|
216
|
-
|
|
217
188
|
_this.safeSetState({
|
|
218
189
|
cardPreview: cardPreview
|
|
219
190
|
});
|
|
220
|
-
|
|
221
191
|
_context2.next = 12;
|
|
222
192
|
break;
|
|
223
|
-
|
|
224
193
|
case 8:
|
|
225
194
|
_context2.prev = 8;
|
|
226
195
|
_context2.t0 = _context2["catch"](0);
|
|
@@ -228,7 +197,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
228
197
|
// If local preview fails (i.e, no remote preview available),
|
|
229
198
|
// we can stay in the same status until there is a remote preview available
|
|
230
199
|
// If it's any other error we set status 'error'
|
|
231
|
-
|
|
232
200
|
if (isLocalPreviewError(wrappedError)) {
|
|
233
201
|
// This error should already been logged inside the getCardPreview. No need to log it here.
|
|
234
202
|
_this.safeSetState({
|
|
@@ -240,7 +208,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
240
208
|
error: wrappedError
|
|
241
209
|
});
|
|
242
210
|
}
|
|
243
|
-
|
|
244
211
|
case 12:
|
|
245
212
|
case "end":
|
|
246
213
|
return _context2.stop();
|
|
@@ -248,16 +215,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
248
215
|
}
|
|
249
216
|
}, _callee2, null, [[0, 8]]);
|
|
250
217
|
}));
|
|
251
|
-
|
|
252
218
|
return function (_x2, _x3) {
|
|
253
219
|
return _ref3.apply(this, arguments);
|
|
254
220
|
};
|
|
255
221
|
}());
|
|
256
|
-
|
|
257
222
|
_defineProperty(_assertThisInitialized(_this), "getPerformanceAttributes", function () {
|
|
258
223
|
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
259
|
-
|
|
260
|
-
|
|
224
|
+
timeElapsedTillCommenced = _assertThisInitialize.timeElapsedTillCommenced;
|
|
261
225
|
var timeElapsedTillEvent = performance.now();
|
|
262
226
|
var durationSinceCommenced = timeElapsedTillCommenced && timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
263
227
|
return {
|
|
@@ -267,58 +231,48 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
267
231
|
}
|
|
268
232
|
};
|
|
269
233
|
});
|
|
270
|
-
|
|
271
234
|
_defineProperty(_assertThisInitialized(_this), "logSSRImageError", function (cardPreview) {
|
|
272
235
|
if (cardPreview) {
|
|
273
236
|
var failedSSRObject = _objectSpread({
|
|
274
237
|
status: 'fail'
|
|
275
238
|
}, extractErrorInfo(new ImageLoadError(cardPreview.source)));
|
|
276
|
-
|
|
277
239
|
if (isSSRClientPreview(cardPreview)) {
|
|
278
240
|
_this.ssrReliability.client = failedSSRObject;
|
|
279
241
|
}
|
|
242
|
+
|
|
280
243
|
/*
|
|
281
244
|
If the cardPreview failed and it comes from server (global scope / ssrData), it means that we have reused it in client and the error counts for both: server & client.
|
|
282
245
|
*/
|
|
283
246
|
|
|
284
|
-
|
|
285
247
|
if (isSSRDataPreview(cardPreview)) {
|
|
286
248
|
_this.ssrReliability.server = failedSSRObject;
|
|
287
249
|
_this.ssrReliability.client = failedSSRObject;
|
|
288
250
|
}
|
|
289
251
|
}
|
|
290
252
|
});
|
|
291
|
-
|
|
292
253
|
_defineProperty(_assertThisInitialized(_this), "onImageError", function (cardPreview) {
|
|
293
254
|
_this.logSSRImageError(cardPreview);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
255
|
+
var currentPreview = _this.state.cardPreview;
|
|
256
|
+
// If the dataURI has been replaced, we can dismiss this error
|
|
297
257
|
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
298
258
|
return;
|
|
299
259
|
}
|
|
300
|
-
|
|
301
260
|
var error = new ImageLoadError(cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source);
|
|
302
261
|
var isLocal = cardPreview && isLocalPreview(cardPreview);
|
|
303
262
|
var isSSR = cardPreview && (isSSRClientPreview(cardPreview) || isSSRDataPreview(cardPreview));
|
|
304
|
-
|
|
305
263
|
if (isLocal || isSSR) {
|
|
306
264
|
var updateState = {
|
|
307
265
|
cardPreview: undefined
|
|
308
266
|
};
|
|
309
|
-
|
|
310
267
|
if (isLocal) {
|
|
311
268
|
updateState.isBannedLocalPreview = true;
|
|
312
|
-
|
|
313
269
|
_this.fireNonCriticalErrorEvent(error);
|
|
314
270
|
}
|
|
315
|
-
|
|
316
271
|
var _this$props5 = _this.props,
|
|
317
|
-
|
|
318
|
-
|
|
272
|
+
identifier = _this$props5.identifier,
|
|
273
|
+
resizeMode = _this$props5.resizeMode;
|
|
319
274
|
var fileImageMode = imageResizeModeToFileImageMode(resizeMode);
|
|
320
275
|
isFileIdentifier(identifier) && removeCardPreviewFromCache(identifier.id, fileImageMode);
|
|
321
|
-
|
|
322
276
|
_this.safeSetState(updateState);
|
|
323
277
|
} else {
|
|
324
278
|
_this.safeSetState({
|
|
@@ -327,7 +281,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
327
281
|
});
|
|
328
282
|
}
|
|
329
283
|
});
|
|
330
|
-
|
|
331
284
|
_defineProperty(_assertThisInitialized(_this), "onImageLoad", function (cardPreview) {
|
|
332
285
|
if (cardPreview) {
|
|
333
286
|
if (isSSRClientPreview(cardPreview) && _this.ssrReliability.client.status === 'unknown') {
|
|
@@ -335,11 +288,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
335
288
|
status: 'success'
|
|
336
289
|
};
|
|
337
290
|
}
|
|
291
|
+
|
|
338
292
|
/*
|
|
339
293
|
If the image loads successfully and it comes from server (global scope / ssrData), it means that we have reused it in client and the success counts for both: server & client.
|
|
340
294
|
*/
|
|
341
295
|
|
|
342
|
-
|
|
343
296
|
if (isSSRDataPreview(cardPreview) && _this.ssrReliability.server.status === 'unknown') {
|
|
344
297
|
_this.ssrReliability.server = {
|
|
345
298
|
status: 'success'
|
|
@@ -349,35 +302,29 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
349
302
|
};
|
|
350
303
|
}
|
|
351
304
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
305
|
+
var currentPreview = _this.state.cardPreview;
|
|
306
|
+
// If the dataURI has been replaced, we can dismiss this callback
|
|
355
307
|
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
356
308
|
return;
|
|
357
309
|
}
|
|
358
|
-
|
|
359
310
|
_this.safeSetState({
|
|
360
311
|
previewDidRender: true
|
|
361
312
|
});
|
|
362
313
|
});
|
|
363
|
-
|
|
364
314
|
_defineProperty(_assertThisInitialized(_this), "fireCopiedEvent", function () {
|
|
365
315
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
366
316
|
var cardRef = _this.state.cardRef;
|
|
367
317
|
cardRef && createAnalyticsEvent && fireCopiedEvent(createAnalyticsEvent, _this.metadata.id, cardRef);
|
|
368
318
|
});
|
|
369
|
-
|
|
370
319
|
_defineProperty(_assertThisInitialized(_this), "fireScreenEvent", function () {
|
|
371
320
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
372
321
|
createAnalyticsEvent && fireScreenEvent(createAnalyticsEvent, _this.fileAttributes);
|
|
373
322
|
});
|
|
374
|
-
|
|
375
323
|
_defineProperty(_assertThisInitialized(_this), "fireNonCriticalErrorEvent", function (error) {
|
|
376
324
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
377
325
|
var fileState = _this.state.fileState;
|
|
378
326
|
createAnalyticsEvent && fireNonCriticalErrorEvent(createAnalyticsEvent, _this.state.status, _this.fileAttributes, _this.ssrReliability, error, _this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
|
|
379
327
|
});
|
|
380
|
-
|
|
381
328
|
_defineProperty(_assertThisInitialized(_this), "safeSetState", function (newState) {
|
|
382
329
|
if (_this.hasBeenMounted) {
|
|
383
330
|
/**
|
|
@@ -390,12 +337,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
390
337
|
_this.setState(createStateUpdater(newState, _this.fireNonCriticalErrorEvent));
|
|
391
338
|
}
|
|
392
339
|
});
|
|
393
|
-
|
|
394
340
|
_defineProperty(_assertThisInitialized(_this), "unsubscribe", function () {
|
|
395
341
|
if (_this.subscription) {
|
|
396
342
|
_this.subscription.unsubscribe();
|
|
397
343
|
}
|
|
398
|
-
|
|
399
344
|
if (_this.hasBeenMounted) {
|
|
400
345
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
401
346
|
_this.setState({
|
|
@@ -403,25 +348,19 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
403
348
|
});
|
|
404
349
|
}
|
|
405
350
|
});
|
|
406
|
-
|
|
407
351
|
_defineProperty(_assertThisInitialized(_this), "onCardViewClick", function (event, analyticsEvent) {
|
|
408
352
|
var _this$props6 = _this.props,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
353
|
+
identifier = _this$props6.identifier,
|
|
354
|
+
useInlinePlayer = _this$props6.useInlinePlayer,
|
|
355
|
+
shouldOpenMediaViewer = _this$props6.shouldOpenMediaViewer;
|
|
412
356
|
var cardPreview = _this.state.cardPreview;
|
|
413
|
-
|
|
414
357
|
var _assertThisInitialize2 = _assertThisInitialized(_this),
|
|
415
|
-
|
|
416
|
-
|
|
358
|
+
metadata = _assertThisInitialize2.metadata;
|
|
417
359
|
_this.onClick(event, analyticsEvent);
|
|
418
|
-
|
|
419
360
|
if (!metadata) {
|
|
420
361
|
return;
|
|
421
362
|
}
|
|
422
|
-
|
|
423
363
|
var isVideo = metadata && metadata.mediaType === 'video';
|
|
424
|
-
|
|
425
364
|
if (useInlinePlayer && isVideo && !!cardPreview) {
|
|
426
365
|
_this.setState({
|
|
427
366
|
isPlayingFile: true,
|
|
@@ -429,7 +368,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
429
368
|
});
|
|
430
369
|
} else if (shouldOpenMediaViewer) {
|
|
431
370
|
var mediaViewerSelectedItem;
|
|
432
|
-
|
|
433
371
|
if (isFileIdentifier(identifier)) {
|
|
434
372
|
mediaViewerSelectedItem = {
|
|
435
373
|
id: identifier.id,
|
|
@@ -444,40 +382,34 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
444
382
|
name: identifier.name
|
|
445
383
|
};
|
|
446
384
|
}
|
|
447
|
-
|
|
448
385
|
_this.setState({
|
|
449
386
|
mediaViewerSelectedItem: mediaViewerSelectedItem
|
|
450
387
|
});
|
|
451
388
|
}
|
|
452
389
|
});
|
|
453
|
-
|
|
454
390
|
_defineProperty(_assertThisInitialized(_this), "onInlinePlayerError", function () {
|
|
455
391
|
_this.setState({
|
|
456
392
|
isPlayingFile: false
|
|
457
393
|
});
|
|
458
394
|
});
|
|
459
|
-
|
|
460
395
|
_defineProperty(_assertThisInitialized(_this), "setRef", function (cardRef) {
|
|
461
396
|
!!cardRef && _this.setState({
|
|
462
397
|
cardRef: cardRef
|
|
463
398
|
});
|
|
464
399
|
});
|
|
465
|
-
|
|
466
400
|
_defineProperty(_assertThisInitialized(_this), "renderInlinePlayer", function () {
|
|
467
401
|
var _this$props7 = _this.props,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
402
|
+
identifier = _this$props7.identifier,
|
|
403
|
+
mediaClient = _this$props7.mediaClient,
|
|
404
|
+
dimensions = _this$props7.dimensions,
|
|
405
|
+
selected = _this$props7.selected,
|
|
406
|
+
testId = _this$props7.testId,
|
|
407
|
+
originalDimensions = _this$props7.originalDimensions,
|
|
408
|
+
onFullscreenChange = _this$props7.onFullscreenChange;
|
|
475
409
|
var _this$state = _this.state,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
410
|
+
shouldAutoplay = _this$state.shouldAutoplay,
|
|
411
|
+
cardPreview = _this$state.cardPreview;
|
|
479
412
|
var card = _this.renderCard(false, 'loading', false);
|
|
480
|
-
|
|
481
413
|
return /*#__PURE__*/React.createElement(Suspense, {
|
|
482
414
|
fallback: card
|
|
483
415
|
}, /*#__PURE__*/React.createElement(InlinePlayerLazy, {
|
|
@@ -495,17 +427,14 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
495
427
|
cardPreview: cardPreview
|
|
496
428
|
}));
|
|
497
429
|
});
|
|
498
|
-
|
|
499
430
|
_defineProperty(_assertThisInitialized(_this), "onMediaViewerClose", function () {
|
|
500
431
|
_this.setState({
|
|
501
432
|
mediaViewerSelectedItem: undefined
|
|
502
433
|
});
|
|
503
434
|
});
|
|
504
|
-
|
|
505
435
|
_defineProperty(_assertThisInitialized(_this), "onDisplayImage", function () {
|
|
506
436
|
var identifier = _this.props.identifier;
|
|
507
437
|
var payloadPart;
|
|
508
|
-
|
|
509
438
|
if (isFileIdentifier(identifier)) {
|
|
510
439
|
payloadPart = {
|
|
511
440
|
fileId: identifier.id,
|
|
@@ -517,25 +446,21 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
517
446
|
isUserCollection: false
|
|
518
447
|
};
|
|
519
448
|
}
|
|
520
|
-
|
|
521
449
|
globalMediaEventEmitter.emit('media-viewed', _objectSpread({
|
|
522
450
|
viewingLevel: 'minimal'
|
|
523
451
|
}, payloadPart));
|
|
524
452
|
});
|
|
525
|
-
|
|
526
453
|
_defineProperty(_assertThisInitialized(_this), "renderMediaViewer", function () {
|
|
527
454
|
var mediaViewerSelectedItem = _this.state.mediaViewerSelectedItem;
|
|
528
455
|
var _this$props8 = _this.props,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
456
|
+
mediaClient = _this$props8.mediaClient,
|
|
457
|
+
identifier = _this$props8.identifier,
|
|
458
|
+
mediaViewerDataSource = _this$props8.mediaViewerDataSource,
|
|
459
|
+
contextId = _this$props8.contextId,
|
|
460
|
+
featureFlags = _this$props8.featureFlags;
|
|
535
461
|
if (!mediaViewerSelectedItem) {
|
|
536
462
|
return;
|
|
537
463
|
}
|
|
538
|
-
|
|
539
464
|
var collectionName = isFileIdentifier(identifier) ? identifier.collectionName || '' : '';
|
|
540
465
|
var dataSource = mediaViewerDataSource || {
|
|
541
466
|
list: []
|
|
@@ -550,51 +475,48 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
550
475
|
featureFlags: featureFlags
|
|
551
476
|
}), document.body);
|
|
552
477
|
});
|
|
553
|
-
|
|
554
478
|
_defineProperty(_assertThisInitialized(_this), "renderCard", function () {
|
|
555
479
|
var withCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
556
480
|
var cardStatusOverride = arguments.length > 1 ? arguments[1] : undefined;
|
|
557
481
|
var izLazyOverride = arguments.length > 2 ? arguments[2] : undefined;
|
|
558
482
|
var _this$props9 = _this.props,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
483
|
+
identifier = _this$props9.identifier,
|
|
484
|
+
isLazy = _this$props9.isLazy,
|
|
485
|
+
appearance = _this$props9.appearance,
|
|
486
|
+
resizeMode = _this$props9.resizeMode,
|
|
487
|
+
dimensions = _this$props9.dimensions,
|
|
488
|
+
selectable = _this$props9.selectable,
|
|
489
|
+
selected = _this$props9.selected,
|
|
490
|
+
disableOverlay = _this$props9.disableOverlay,
|
|
491
|
+
alt = _this$props9.alt,
|
|
492
|
+
testId = _this$props9.testId,
|
|
493
|
+
featureFlags = _this$props9.featureFlags,
|
|
494
|
+
titleBoxBgColor = _this$props9.titleBoxBgColor,
|
|
495
|
+
titleBoxIcon = _this$props9.titleBoxIcon,
|
|
496
|
+
ssr = _this$props9.ssr,
|
|
497
|
+
useInlinePlayer = _this$props9.useInlinePlayer,
|
|
498
|
+
shouldOpenMediaViewer = _this$props9.shouldOpenMediaViewer;
|
|
575
499
|
var mediaItemType = identifier.mediaItemType;
|
|
576
500
|
var _this$state2 = _this.state,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
501
|
+
status = _this$state2.status,
|
|
502
|
+
progress = _this$state2.progress,
|
|
503
|
+
cardPreview = _this$state2.cardPreview,
|
|
504
|
+
error = _this$state2.error,
|
|
505
|
+
cardRef = _this$state2.cardRef,
|
|
506
|
+
isCardVisible = _this$state2.isCardVisible;
|
|
584
507
|
var _assertThisInitialize3 = _assertThisInitialized(_this),
|
|
585
|
-
|
|
586
|
-
|
|
508
|
+
metadata = _assertThisInitialize3.metadata;
|
|
587
509
|
var _assertThisInitialize4 = _assertThisInitialized(_this),
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
510
|
+
onCardViewClick = _assertThisInitialize4.onCardViewClick,
|
|
511
|
+
onDisplayImage = _assertThisInitialize4.onDisplayImage,
|
|
512
|
+
actions = _assertThisInitialize4.actions,
|
|
513
|
+
onMouseEnter = _assertThisInitialize4.onMouseEnter;
|
|
514
|
+
var isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
592
515
|
|
|
593
|
-
|
|
516
|
+
// Card can be artificially turned visible before entering the viewport
|
|
594
517
|
// For example, when we have the image in cache
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
518
|
+
var nativeLazyLoad = isLazyWithOverride && !isCardVisible;
|
|
519
|
+
// Force Media Image to always display img for SSR
|
|
598
520
|
var forceSyncDisplay = !!ssr;
|
|
599
521
|
var mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, status === 'error' || status === 'failed-processing', !!_this.state.cardPreview, metadata.mediaType);
|
|
600
522
|
var card = /*#__PURE__*/React.createElement(CardView, {
|
|
@@ -631,13 +553,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
631
553
|
onVisible: _this.onCardInViewport
|
|
632
554
|
}, card) : card;
|
|
633
555
|
});
|
|
634
|
-
|
|
635
556
|
_defineProperty(_assertThisInitialized(_this), "storeSSRData", function () {
|
|
636
557
|
var _this$ssrReliability$;
|
|
637
|
-
|
|
638
558
|
var _this$props10 = _this.props,
|
|
639
|
-
|
|
640
|
-
|
|
559
|
+
ssr = _this$props10.ssr,
|
|
560
|
+
identifier = _this$props10.identifier;
|
|
641
561
|
var _this$state$cardPrevi = _this.state.cardPreview;
|
|
642
562
|
_this$state$cardPrevi = _this$state$cardPrevi === void 0 ? {} : _this$state$cardPrevi;
|
|
643
563
|
var dataURI = _this$state$cardPrevi.dataURI;
|
|
@@ -648,19 +568,15 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
648
568
|
error: ((_this$ssrReliability$ = _this.ssrReliability.server) === null || _this$ssrReliability$ === void 0 ? void 0 : _this$ssrReliability$.status) === 'fail' ? _this.ssrReliability.server : undefined
|
|
649
569
|
});
|
|
650
570
|
});
|
|
651
|
-
|
|
652
571
|
_defineProperty(_assertThisInitialized(_this), "onCardInViewport", function () {
|
|
653
572
|
_this.setState({
|
|
654
573
|
isCardVisible: true
|
|
655
574
|
});
|
|
656
575
|
});
|
|
657
|
-
|
|
658
576
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (event, analyticsEvent) {
|
|
659
577
|
var onClick = _this.props.onClick;
|
|
660
|
-
|
|
661
578
|
var _assertThisInitialize5 = _assertThisInitialized(_this),
|
|
662
|
-
|
|
663
|
-
|
|
579
|
+
metadata = _assertThisInitialize5.metadata;
|
|
664
580
|
if (onClick) {
|
|
665
581
|
var cardEvent = {
|
|
666
582
|
event: event,
|
|
@@ -669,13 +585,10 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
669
585
|
onClick(cardEvent, analyticsEvent);
|
|
670
586
|
}
|
|
671
587
|
});
|
|
672
|
-
|
|
673
588
|
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function (event) {
|
|
674
589
|
var onMouseEnter = _this.props.onMouseEnter;
|
|
675
|
-
|
|
676
590
|
var _assertThisInitialize6 = _assertThisInitialized(_this),
|
|
677
|
-
|
|
678
|
-
|
|
591
|
+
metadata = _assertThisInitialize6.metadata;
|
|
679
592
|
if (onMouseEnter) {
|
|
680
593
|
var cardEvent = {
|
|
681
594
|
event: event,
|
|
@@ -684,35 +597,26 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
684
597
|
onMouseEnter(cardEvent);
|
|
685
598
|
}
|
|
686
599
|
});
|
|
687
|
-
|
|
688
600
|
var _status = 'loading';
|
|
689
|
-
|
|
690
601
|
var _cardPreview;
|
|
691
|
-
|
|
692
602
|
var _error;
|
|
693
|
-
|
|
694
603
|
var _this$props11 = _this.props,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
604
|
+
_identifier = _this$props11.identifier,
|
|
605
|
+
_resizeMode = _this$props11.resizeMode,
|
|
606
|
+
_ssr = _this$props11.ssr,
|
|
607
|
+
_mediaClient = _this$props11.mediaClient;
|
|
700
608
|
if (isFileIdentifier(_identifier)) {
|
|
701
609
|
var id = _identifier.id;
|
|
702
610
|
var fileImageMode = imageResizeModeToFileImageMode(_resizeMode);
|
|
703
611
|
_cardPreview = getCardPreviewFromCache(id, fileImageMode);
|
|
704
|
-
|
|
705
612
|
if (!_cardPreview && _ssr) {
|
|
706
613
|
var _this$ssrData, _this$ssrData2;
|
|
707
|
-
|
|
708
614
|
_this.ssrData = getSSRData(_identifier);
|
|
709
|
-
|
|
710
615
|
if ((_this$ssrData = _this.ssrData) !== null && _this$ssrData !== void 0 && _this$ssrData.error) {
|
|
711
616
|
_this.ssrReliability.server = _objectSpread({
|
|
712
617
|
status: 'fail'
|
|
713
618
|
}, _this.ssrData.error);
|
|
714
619
|
}
|
|
715
|
-
|
|
716
620
|
if (!((_this$ssrData2 = _this.ssrData) !== null && _this$ssrData2 !== void 0 && _this$ssrData2.dataURI)) {
|
|
717
621
|
try {
|
|
718
622
|
_cardPreview = getSSRCardPreview(_ssr, _mediaClient, _identifier.id, _this.getImageURLParams(_identifier), _this.getMediaBlobUrlAttrs(_identifier));
|
|
@@ -730,7 +634,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
730
634
|
}
|
|
731
635
|
} else if (isExternalImageIdentifier(_identifier)) {
|
|
732
636
|
_this.fireCommencedEvent();
|
|
733
|
-
|
|
734
637
|
_status = 'loading-preview';
|
|
735
638
|
var dataURI = _identifier.dataURI;
|
|
736
639
|
_cardPreview = {
|
|
@@ -738,14 +641,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
738
641
|
orientation: 1,
|
|
739
642
|
source: 'external'
|
|
740
643
|
};
|
|
741
|
-
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// If cardPreview is available from local cache or external, `isCardVisible`
|
|
742
647
|
// should be true to avoid flickers during re-mount of the component
|
|
743
648
|
// should not be visible for SSR preview, otherwise we'll fire the metadata fetch from
|
|
744
649
|
// outside the viewport
|
|
745
|
-
|
|
746
|
-
|
|
747
650
|
var _isCardVisible = !_this.props.isLazy || !!_cardPreview && !isSSRPreview(_cardPreview);
|
|
748
|
-
|
|
749
651
|
_this.state = {
|
|
750
652
|
status: _status,
|
|
751
653
|
isCardVisible: _isCardVisible,
|
|
@@ -759,76 +661,68 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
759
661
|
};
|
|
760
662
|
return _this;
|
|
761
663
|
}
|
|
762
|
-
|
|
763
664
|
_createClass(CardBase, [{
|
|
764
665
|
key: "componentDidMount",
|
|
765
666
|
value: function componentDidMount() {
|
|
766
667
|
var _getDocument;
|
|
767
|
-
|
|
768
668
|
this.hasBeenMounted = true;
|
|
769
669
|
var _this$state3 = this.state,
|
|
770
|
-
|
|
771
|
-
|
|
670
|
+
isCardVisible = _this$state3.isCardVisible,
|
|
671
|
+
cardPreview = _this$state3.cardPreview;
|
|
772
672
|
var _this$props12 = this.props,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
673
|
+
identifier = _this$props12.identifier,
|
|
674
|
+
ssr = _this$props12.ssr,
|
|
675
|
+
dimensions = _this$props12.dimensions;
|
|
777
676
|
if (isCardVisible && isFileIdentifier(identifier)) {
|
|
778
677
|
this.updateStateForIdentifier(identifier);
|
|
779
678
|
}
|
|
780
|
-
|
|
781
679
|
if (isCardVisible && !!ssr && !!cardPreview && isFileIdentifier(identifier)) {
|
|
782
680
|
var _this$ssrData3;
|
|
783
|
-
|
|
784
681
|
if (isSSRClientPreview(cardPreview)) {
|
|
785
682
|
// Since the SSR preview brings the token in the query params,
|
|
786
683
|
// We need to fetch the remote preview to be able to cache it,
|
|
787
684
|
this.setCacheSSRPreview(identifier);
|
|
788
685
|
}
|
|
789
|
-
|
|
790
686
|
if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData3 = this.ssrData) === null || _this$ssrData3 === void 0 ? void 0 : _this$ssrData3.dimensions, dimensions)) {
|
|
791
687
|
// If dimensions from Server have changed and are bigger,
|
|
792
688
|
// we need to refetch
|
|
793
689
|
this.refetchSSRPreview(identifier);
|
|
794
690
|
}
|
|
795
|
-
}
|
|
691
|
+
}
|
|
692
|
+
// we add a listener for each of the cards on the page
|
|
796
693
|
// and then check if the triggered listener is from the card
|
|
797
694
|
// that contains a div in current window.getSelection()
|
|
798
695
|
// won't work in IE11
|
|
799
|
-
|
|
800
|
-
|
|
801
696
|
(_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.addEventListener('copy', this.fireCopiedEvent);
|
|
802
697
|
}
|
|
803
698
|
}, {
|
|
804
699
|
key: "componentDidUpdate",
|
|
805
700
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
806
701
|
var prevMediaClient = prevProps.mediaClient,
|
|
807
|
-
|
|
808
|
-
|
|
702
|
+
prevIdentifier = prevProps.identifier,
|
|
703
|
+
prevDimensions = prevProps.dimensions;
|
|
809
704
|
var prevIsCardVisible = prevState.isCardVisible;
|
|
810
705
|
var _this$props13 = this.props,
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
706
|
+
mediaClient = _this$props13.mediaClient,
|
|
707
|
+
identifier = _this$props13.identifier,
|
|
708
|
+
dimensions = _this$props13.dimensions,
|
|
709
|
+
featureFlags = _this$props13.featureFlags,
|
|
710
|
+
useInlinePlayer = _this$props13.useInlinePlayer,
|
|
711
|
+
disableOverlay = _this$props13.disableOverlay,
|
|
712
|
+
resizeMode = _this$props13.resizeMode;
|
|
818
713
|
var _this$state4 = this.state,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
714
|
+
isCardVisible = _this$state4.isCardVisible,
|
|
715
|
+
cardPreview = _this$state4.cardPreview,
|
|
716
|
+
status = _this$state4.status,
|
|
717
|
+
fileState = _this$state4.fileState,
|
|
718
|
+
isBannedLocalPreview = _this$state4.isBannedLocalPreview,
|
|
719
|
+
previewDidRender = _this$state4.previewDidRender,
|
|
720
|
+
isPlayingFile = _this$state4.isPlayingFile;
|
|
826
721
|
var isDifferent = isDifferentIdentifier(prevIdentifier, identifier);
|
|
827
722
|
var turnedVisible = !prevIsCardVisible && isCardVisible;
|
|
828
723
|
var isNewMediaClient = prevMediaClient !== mediaClient;
|
|
829
724
|
var fileImageMode = imageResizeModeToFileImageMode(resizeMode);
|
|
830
725
|
this.updateFileStateFlag(fileState);
|
|
831
|
-
|
|
832
726
|
if (isExternalImageIdentifier(identifier) && isDifferent) {
|
|
833
727
|
this.fireCommencedEvent();
|
|
834
728
|
var dataURI = identifier.dataURI;
|
|
@@ -842,19 +736,15 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
842
736
|
isCardVisible: true
|
|
843
737
|
});
|
|
844
738
|
}
|
|
845
|
-
|
|
846
739
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDifferent))) {
|
|
847
740
|
this.updateStateForIdentifier(identifier);
|
|
848
741
|
}
|
|
849
|
-
|
|
850
742
|
if (this.state.status !== prevState.status) {
|
|
851
743
|
this.fireOperationalEvent();
|
|
852
|
-
|
|
853
744
|
if (this.state.status === 'complete' || this.fileAttributes.fileMediatype === 'video' && !!cardPreview && this.state.status === 'processing') {
|
|
854
745
|
this.fireScreenEvent();
|
|
855
746
|
}
|
|
856
747
|
}
|
|
857
|
-
|
|
858
748
|
if (isFileIdentifier(identifier) && fileState && shouldResolvePreview({
|
|
859
749
|
status: status,
|
|
860
750
|
fileState: fileState,
|
|
@@ -868,24 +758,21 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
868
758
|
})) {
|
|
869
759
|
this.resolvePreview(identifier, fileState);
|
|
870
760
|
}
|
|
871
|
-
|
|
872
761
|
if (turnedVisible && this.props.ssr && !!cardPreview && isSSRClientPreview(cardPreview) && isFileIdentifier(identifier)) {
|
|
873
762
|
// Since the SSR preview brings the token in the query params,
|
|
874
763
|
// We need to fetch the remote preview to be able to cache it,
|
|
875
764
|
this.setCacheSSRPreview(identifier);
|
|
876
765
|
}
|
|
877
|
-
|
|
878
|
-
|
|
766
|
+
if (previewDidRender &&
|
|
767
|
+
// We should't complete if status is uploading
|
|
879
768
|
['loading-preview', 'processing'].includes(status)) {
|
|
880
769
|
this.safeSetState({
|
|
881
770
|
status: 'complete'
|
|
882
771
|
});
|
|
883
772
|
this.unsubscribe();
|
|
884
773
|
}
|
|
885
|
-
|
|
886
774
|
var isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
887
775
|
var videoAvailableToPlay = fileState && isProcessedFileState(fileState);
|
|
888
|
-
|
|
889
776
|
if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
|
|
890
777
|
this.setState({
|
|
891
778
|
isPlayingFile: true
|
|
@@ -896,7 +783,6 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
896
783
|
key: "componentWillUnmount",
|
|
897
784
|
value: function componentWillUnmount() {
|
|
898
785
|
var _getDocument2;
|
|
899
|
-
|
|
900
786
|
this.hasBeenMounted = false;
|
|
901
787
|
this.unsubscribe();
|
|
902
788
|
(_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.removeEventListener('copy', this.fireCopiedEvent);
|
|
@@ -913,9 +799,7 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
913
799
|
if (!fileState) {
|
|
914
800
|
return;
|
|
915
801
|
}
|
|
916
|
-
|
|
917
802
|
var status = fileState.status;
|
|
918
|
-
|
|
919
803
|
if (status === 'processing') {
|
|
920
804
|
this.fileStateFlags.wasStatusProcessing = true;
|
|
921
805
|
} else if (status === 'uploading') {
|
|
@@ -926,12 +810,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
926
810
|
key: "subscribeInternalFile",
|
|
927
811
|
value: function subscribeInternalFile(identifier) {
|
|
928
812
|
var _this2 = this;
|
|
929
|
-
|
|
930
813
|
var mediaClient = this.props.mediaClient;
|
|
931
814
|
var isBannedLocalPreview = this.state.isBannedLocalPreview;
|
|
932
815
|
var id = identifier.id,
|
|
933
|
-
|
|
934
|
-
|
|
816
|
+
collectionName = identifier.collectionName,
|
|
817
|
+
occurrenceKey = identifier.occurrenceKey;
|
|
935
818
|
this.unsubscribe();
|
|
936
819
|
this.subscription = mediaClient.file.getFileState(id, {
|
|
937
820
|
collectionName: collectionName,
|
|
@@ -940,13 +823,11 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
940
823
|
next: function next(fileState) {
|
|
941
824
|
var featureFlags = _this2.props.featureFlags;
|
|
942
825
|
var newState = getCardStateFromFileState(fileState, isBannedLocalPreview, featureFlags);
|
|
943
|
-
|
|
944
826
|
_this2.safeSetState(newState);
|
|
945
827
|
},
|
|
946
828
|
error: function error(e) {
|
|
947
829
|
var errorReason = _this2.state.status === 'uploading' ? 'upload' : 'metadata-fetch';
|
|
948
830
|
var error = new MediaCardError(errorReason, e);
|
|
949
|
-
|
|
950
831
|
_this2.safeSetState({
|
|
951
832
|
error: error,
|
|
952
833
|
status: 'error'
|
|
@@ -958,10 +839,8 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
958
839
|
key: "requestedDimensions",
|
|
959
840
|
get: function get() {
|
|
960
841
|
var dimensions = this.props.dimensions;
|
|
961
|
-
|
|
962
842
|
var _ref4 = this.state || {},
|
|
963
|
-
|
|
964
|
-
|
|
843
|
+
element = _ref4.cardRef;
|
|
965
844
|
return getRequestedDimensions({
|
|
966
845
|
dimensions: dimensions,
|
|
967
846
|
element: element
|
|
@@ -971,23 +850,21 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
971
850
|
key: "metadata",
|
|
972
851
|
get: function get() {
|
|
973
852
|
var _this$state5;
|
|
974
|
-
|
|
975
853
|
return getFileDetails(this.props.identifier, (_this$state5 = this.state) === null || _this$state5 === void 0 ? void 0 : _this$state5.fileState);
|
|
976
854
|
}
|
|
977
855
|
}, {
|
|
978
856
|
key: "fileAttributes",
|
|
979
857
|
get: function get() {
|
|
980
858
|
var _this$state6, _this$state6$fileStat;
|
|
981
|
-
|
|
982
859
|
return getFileAttributes(this.metadata, (_this$state6 = this.state) === null || _this$state6 === void 0 ? void 0 : (_this$state6$fileStat = _this$state6.fileState) === null || _this$state6$fileStat === void 0 ? void 0 : _this$state6$fileStat.status);
|
|
983
860
|
}
|
|
984
861
|
}, {
|
|
985
862
|
key: "fireOperationalEvent",
|
|
986
863
|
value: function fireOperationalEvent() {
|
|
987
864
|
var _this$state7 = this.state,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
865
|
+
status = _this$state7.status,
|
|
866
|
+
error = _this$state7.error,
|
|
867
|
+
fileState = _this$state7.fileState;
|
|
991
868
|
var createAnalyticsEvent = this.props.createAnalyticsEvent;
|
|
992
869
|
createAnalyticsEvent && _fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
|
|
993
870
|
completeUfoExperience(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
|
|
@@ -1008,15 +885,13 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
1008
885
|
key: "actions",
|
|
1009
886
|
get: function get() {
|
|
1010
887
|
var _this3 = this;
|
|
1011
|
-
|
|
1012
888
|
var _this$props14 = this.props,
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
889
|
+
_this$props14$actions = _this$props14.actions,
|
|
890
|
+
actions = _this$props14$actions === void 0 ? [] : _this$props14$actions,
|
|
891
|
+
identifier = _this$props14.identifier,
|
|
892
|
+
shouldEnableDownloadButton = _this$props14.shouldEnableDownloadButton;
|
|
1017
893
|
var status = this.state.status;
|
|
1018
894
|
var metadata = this.metadata;
|
|
1019
|
-
|
|
1020
895
|
if (isFileIdentifier(identifier) && (status === 'failed-processing' || shouldEnableDownloadButton)) {
|
|
1021
896
|
var downloadAction = {
|
|
1022
897
|
label: 'Download',
|
|
@@ -1036,18 +911,16 @@ export var CardBase = /*#__PURE__*/function (_Component) {
|
|
|
1036
911
|
key: "render",
|
|
1037
912
|
value: function render() {
|
|
1038
913
|
var _this$state8 = this.state,
|
|
1039
|
-
|
|
1040
|
-
|
|
914
|
+
isPlayingFile = _this$state8.isPlayingFile,
|
|
915
|
+
mediaViewerSelectedItem = _this$state8.mediaViewerSelectedItem;
|
|
1041
916
|
var innerContent = /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? this.renderInlinePlayer() : this.renderCard(), mediaViewerSelectedItem ? this.renderMediaViewer() : null, this.storeSSRData());
|
|
1042
917
|
return this.props.intl ? innerContent : /*#__PURE__*/React.createElement(IntlProvider, {
|
|
1043
918
|
locale: "en"
|
|
1044
919
|
}, innerContent);
|
|
1045
920
|
}
|
|
1046
921
|
}]);
|
|
1047
|
-
|
|
1048
922
|
return CardBase;
|
|
1049
923
|
}(Component);
|
|
1050
|
-
|
|
1051
924
|
_defineProperty(CardBase, "defaultProps", {
|
|
1052
925
|
appearance: 'auto',
|
|
1053
926
|
resizeMode: 'crop',
|
|
@@ -1056,7 +929,6 @@ _defineProperty(CardBase, "defaultProps", {
|
|
|
1056
929
|
// Media Feature Flag defaults are defined in @atlaskit/media-common
|
|
1057
930
|
featureFlags: {}
|
|
1058
931
|
});
|
|
1059
|
-
|
|
1060
932
|
export var Card = withMediaAnalyticsContext({
|
|
1061
933
|
packageVersion: packageVersion,
|
|
1062
934
|
packageName: packageName,
|