@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/es2019/card/card.js
CHANGED
|
@@ -26,25 +26,24 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
26
26
|
import { completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
27
27
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
28
28
|
const packageName = "@atlaskit/media-card";
|
|
29
|
-
const packageVersion = "74.5.
|
|
29
|
+
const packageVersion = "74.5.2";
|
|
30
30
|
export class CardBase extends Component {
|
|
31
31
|
// An internalOccurrenceKey is a randomly generated value to differentiate various instances
|
|
32
32
|
// of Cards regardless of whether it shares the same file (either internal or external)
|
|
33
|
+
|
|
33
34
|
// We initialise timeElapsedTillCommenced
|
|
34
35
|
// to avoid extra branching on a possibly undefined value.
|
|
36
|
+
|
|
35
37
|
// Generate unique traceId for file
|
|
38
|
+
|
|
36
39
|
constructor(props) {
|
|
37
40
|
super(props);
|
|
38
|
-
|
|
39
41
|
_defineProperty(this, "internalOccurrenceKey", generateUniqueId());
|
|
40
|
-
|
|
41
42
|
_defineProperty(this, "hasBeenMounted", false);
|
|
42
|
-
|
|
43
43
|
_defineProperty(this, "fileStateFlags", {
|
|
44
44
|
wasStatusUploading: false,
|
|
45
45
|
wasStatusProcessing: false
|
|
46
46
|
});
|
|
47
|
-
|
|
48
47
|
_defineProperty(this, "ssrReliability", {
|
|
49
48
|
server: {
|
|
50
49
|
status: 'unknown'
|
|
@@ -53,13 +52,10 @@ export class CardBase extends Component {
|
|
|
53
52
|
status: 'unknown'
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
|
-
|
|
57
55
|
_defineProperty(this, "timeElapsedTillCommenced", performance.now());
|
|
58
|
-
|
|
59
56
|
_defineProperty(this, "traceContext", {
|
|
60
57
|
traceId: getRandomHex(8)
|
|
61
58
|
});
|
|
62
|
-
|
|
63
59
|
_defineProperty(this, "getImageURLParams", ({
|
|
64
60
|
collectionName: collection
|
|
65
61
|
}) => ({
|
|
@@ -68,7 +64,6 @@ export class CardBase extends Component {
|
|
|
68
64
|
...this.requestedDimensions,
|
|
69
65
|
allowAnimated: true
|
|
70
66
|
}));
|
|
71
|
-
|
|
72
67
|
_defineProperty(this, "getMediaBlobUrlAttrs", (identifier, fileState) => {
|
|
73
68
|
const {
|
|
74
69
|
id,
|
|
@@ -95,7 +90,6 @@ export class CardBase extends Component {
|
|
|
95
90
|
alt
|
|
96
91
|
} : undefined;
|
|
97
92
|
});
|
|
98
|
-
|
|
99
93
|
_defineProperty(this, "getCardPreviewParams", (identifier, fileState) => {
|
|
100
94
|
const {
|
|
101
95
|
isBannedLocalPreview
|
|
@@ -122,25 +116,23 @@ export class CardBase extends Component {
|
|
|
122
116
|
traceContext: this.traceContext
|
|
123
117
|
};
|
|
124
118
|
});
|
|
125
|
-
|
|
126
119
|
_defineProperty(this, "setCacheSSRPreview", identifier => {
|
|
127
120
|
const {
|
|
128
121
|
mediaClient,
|
|
129
122
|
dimensions = {}
|
|
130
123
|
} = this.props;
|
|
131
|
-
fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, this.getImageURLParams(identifier), this.getMediaBlobUrlAttrs(identifier)).catch(() => {
|
|
124
|
+
fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, this.getImageURLParams(identifier), this.getMediaBlobUrlAttrs(identifier)).catch(() => {
|
|
125
|
+
// No need to log this error.
|
|
132
126
|
// If preview fails, it will be refetched later
|
|
133
127
|
//TODO: test this catch
|
|
134
128
|
// https://product-fabric.atlassian.net/browse/MEX-1071
|
|
135
129
|
});
|
|
136
130
|
});
|
|
137
|
-
|
|
138
131
|
_defineProperty(this, "refetchSSRPreview", async identifier => {
|
|
139
132
|
const {
|
|
140
133
|
mediaClient,
|
|
141
134
|
dimensions = {}
|
|
142
135
|
} = this.props;
|
|
143
|
-
|
|
144
136
|
try {
|
|
145
137
|
const cardPreview = await fetchAndCacheRemotePreview(mediaClient, identifier.id, dimensions, this.getImageURLParams(identifier), this.getMediaBlobUrlAttrs(identifier));
|
|
146
138
|
this.safeSetState({
|
|
@@ -151,7 +143,6 @@ export class CardBase extends Component {
|
|
|
151
143
|
this.fireNonCriticalErrorEvent(wrappedError);
|
|
152
144
|
}
|
|
153
145
|
});
|
|
154
|
-
|
|
155
146
|
_defineProperty(this, "resolvePreview", async (identifier, fileState) => {
|
|
156
147
|
try {
|
|
157
148
|
const params = this.getCardPreviewParams(identifier, fileState);
|
|
@@ -160,11 +151,11 @@ export class CardBase extends Component {
|
|
|
160
151
|
cardPreview
|
|
161
152
|
});
|
|
162
153
|
} catch (e) {
|
|
163
|
-
const wrappedError = ensureMediaCardError('preview-fetch', e);
|
|
154
|
+
const wrappedError = ensureMediaCardError('preview-fetch', e);
|
|
155
|
+
// If remote preview fails, we set status 'error'
|
|
164
156
|
// If local preview fails (i.e, no remote preview available),
|
|
165
157
|
// we can stay in the same status until there is a remote preview available
|
|
166
158
|
// If it's any other error we set status 'error'
|
|
167
|
-
|
|
168
159
|
if (isLocalPreviewError(wrappedError)) {
|
|
169
160
|
// This error should already been logged inside the getCardPreview. No need to log it here.
|
|
170
161
|
this.safeSetState({
|
|
@@ -178,7 +169,6 @@ export class CardBase extends Component {
|
|
|
178
169
|
}
|
|
179
170
|
}
|
|
180
171
|
});
|
|
181
|
-
|
|
182
172
|
_defineProperty(this, "getPerformanceAttributes", () => {
|
|
183
173
|
const {
|
|
184
174
|
timeElapsedTillCommenced
|
|
@@ -192,53 +182,46 @@ export class CardBase extends Component {
|
|
|
192
182
|
}
|
|
193
183
|
};
|
|
194
184
|
});
|
|
195
|
-
|
|
196
185
|
_defineProperty(this, "logSSRImageError", cardPreview => {
|
|
197
186
|
if (cardPreview) {
|
|
198
187
|
const failedSSRObject = {
|
|
199
188
|
status: 'fail',
|
|
200
189
|
...extractErrorInfo(new ImageLoadError(cardPreview.source))
|
|
201
190
|
};
|
|
202
|
-
|
|
203
191
|
if (isSSRClientPreview(cardPreview)) {
|
|
204
192
|
this.ssrReliability.client = failedSSRObject;
|
|
205
193
|
}
|
|
194
|
+
|
|
206
195
|
/*
|
|
207
196
|
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.
|
|
208
197
|
*/
|
|
209
198
|
|
|
210
|
-
|
|
211
199
|
if (isSSRDataPreview(cardPreview)) {
|
|
212
200
|
this.ssrReliability.server = failedSSRObject;
|
|
213
201
|
this.ssrReliability.client = failedSSRObject;
|
|
214
202
|
}
|
|
215
203
|
}
|
|
216
204
|
});
|
|
217
|
-
|
|
218
205
|
_defineProperty(this, "onImageError", cardPreview => {
|
|
219
206
|
this.logSSRImageError(cardPreview);
|
|
220
207
|
const {
|
|
221
208
|
cardPreview: currentPreview
|
|
222
|
-
} = this.state;
|
|
223
|
-
|
|
209
|
+
} = this.state;
|
|
210
|
+
// If the dataURI has been replaced, we can dismiss this error
|
|
224
211
|
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
225
212
|
return;
|
|
226
213
|
}
|
|
227
|
-
|
|
228
214
|
const error = new ImageLoadError(cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source);
|
|
229
215
|
const isLocal = cardPreview && isLocalPreview(cardPreview);
|
|
230
216
|
const isSSR = cardPreview && (isSSRClientPreview(cardPreview) || isSSRDataPreview(cardPreview));
|
|
231
|
-
|
|
232
217
|
if (isLocal || isSSR) {
|
|
233
218
|
const updateState = {
|
|
234
219
|
cardPreview: undefined
|
|
235
220
|
};
|
|
236
|
-
|
|
237
221
|
if (isLocal) {
|
|
238
222
|
updateState.isBannedLocalPreview = true;
|
|
239
223
|
this.fireNonCriticalErrorEvent(error);
|
|
240
224
|
}
|
|
241
|
-
|
|
242
225
|
const {
|
|
243
226
|
identifier,
|
|
244
227
|
resizeMode
|
|
@@ -253,7 +236,6 @@ export class CardBase extends Component {
|
|
|
253
236
|
});
|
|
254
237
|
}
|
|
255
238
|
});
|
|
256
|
-
|
|
257
239
|
_defineProperty(this, "onImageLoad", cardPreview => {
|
|
258
240
|
if (cardPreview) {
|
|
259
241
|
if (isSSRClientPreview(cardPreview) && this.ssrReliability.client.status === 'unknown') {
|
|
@@ -261,11 +243,11 @@ export class CardBase extends Component {
|
|
|
261
243
|
status: 'success'
|
|
262
244
|
};
|
|
263
245
|
}
|
|
246
|
+
|
|
264
247
|
/*
|
|
265
248
|
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.
|
|
266
249
|
*/
|
|
267
250
|
|
|
268
|
-
|
|
269
251
|
if (isSSRDataPreview(cardPreview) && this.ssrReliability.server.status === 'unknown') {
|
|
270
252
|
this.ssrReliability.server = {
|
|
271
253
|
status: 'success'
|
|
@@ -275,20 +257,17 @@ export class CardBase extends Component {
|
|
|
275
257
|
};
|
|
276
258
|
}
|
|
277
259
|
}
|
|
278
|
-
|
|
279
260
|
const {
|
|
280
261
|
cardPreview: currentPreview
|
|
281
|
-
} = this.state;
|
|
282
|
-
|
|
262
|
+
} = this.state;
|
|
263
|
+
// If the dataURI has been replaced, we can dismiss this callback
|
|
283
264
|
if ((cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI) !== (currentPreview === null || currentPreview === void 0 ? void 0 : currentPreview.dataURI)) {
|
|
284
265
|
return;
|
|
285
266
|
}
|
|
286
|
-
|
|
287
267
|
this.safeSetState({
|
|
288
268
|
previewDidRender: true
|
|
289
269
|
});
|
|
290
270
|
});
|
|
291
|
-
|
|
292
271
|
_defineProperty(this, "fireCopiedEvent", () => {
|
|
293
272
|
const {
|
|
294
273
|
createAnalyticsEvent
|
|
@@ -298,14 +277,12 @@ export class CardBase extends Component {
|
|
|
298
277
|
} = this.state;
|
|
299
278
|
cardRef && createAnalyticsEvent && fireCopiedEvent(createAnalyticsEvent, this.metadata.id, cardRef);
|
|
300
279
|
});
|
|
301
|
-
|
|
302
280
|
_defineProperty(this, "fireScreenEvent", () => {
|
|
303
281
|
const {
|
|
304
282
|
createAnalyticsEvent
|
|
305
283
|
} = this.props;
|
|
306
284
|
createAnalyticsEvent && fireScreenEvent(createAnalyticsEvent, this.fileAttributes);
|
|
307
285
|
});
|
|
308
|
-
|
|
309
286
|
_defineProperty(this, "fireNonCriticalErrorEvent", error => {
|
|
310
287
|
const {
|
|
311
288
|
createAnalyticsEvent
|
|
@@ -315,7 +292,6 @@ export class CardBase extends Component {
|
|
|
315
292
|
} = this.state;
|
|
316
293
|
createAnalyticsEvent && fireNonCriticalErrorEvent(createAnalyticsEvent, this.state.status, this.fileAttributes, this.ssrReliability, error, this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
|
|
317
294
|
});
|
|
318
|
-
|
|
319
295
|
_defineProperty(this, "safeSetState", newState => {
|
|
320
296
|
if (this.hasBeenMounted) {
|
|
321
297
|
/**
|
|
@@ -328,12 +304,10 @@ export class CardBase extends Component {
|
|
|
328
304
|
this.setState(createStateUpdater(newState, this.fireNonCriticalErrorEvent));
|
|
329
305
|
}
|
|
330
306
|
});
|
|
331
|
-
|
|
332
307
|
_defineProperty(this, "unsubscribe", () => {
|
|
333
308
|
if (this.subscription) {
|
|
334
309
|
this.subscription.unsubscribe();
|
|
335
310
|
}
|
|
336
|
-
|
|
337
311
|
if (this.hasBeenMounted) {
|
|
338
312
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
339
313
|
this.setState({
|
|
@@ -341,7 +315,6 @@ export class CardBase extends Component {
|
|
|
341
315
|
});
|
|
342
316
|
}
|
|
343
317
|
});
|
|
344
|
-
|
|
345
318
|
_defineProperty(this, "onCardViewClick", (event, analyticsEvent) => {
|
|
346
319
|
const {
|
|
347
320
|
identifier,
|
|
@@ -355,13 +328,10 @@ export class CardBase extends Component {
|
|
|
355
328
|
metadata
|
|
356
329
|
} = this;
|
|
357
330
|
this.onClick(event, analyticsEvent);
|
|
358
|
-
|
|
359
331
|
if (!metadata) {
|
|
360
332
|
return;
|
|
361
333
|
}
|
|
362
|
-
|
|
363
334
|
const isVideo = metadata && metadata.mediaType === 'video';
|
|
364
|
-
|
|
365
335
|
if (useInlinePlayer && isVideo && !!cardPreview) {
|
|
366
336
|
this.setState({
|
|
367
337
|
isPlayingFile: true,
|
|
@@ -369,7 +339,6 @@ export class CardBase extends Component {
|
|
|
369
339
|
});
|
|
370
340
|
} else if (shouldOpenMediaViewer) {
|
|
371
341
|
let mediaViewerSelectedItem;
|
|
372
|
-
|
|
373
342
|
if (isFileIdentifier(identifier)) {
|
|
374
343
|
mediaViewerSelectedItem = {
|
|
375
344
|
id: identifier.id,
|
|
@@ -384,25 +353,21 @@ export class CardBase extends Component {
|
|
|
384
353
|
name: identifier.name
|
|
385
354
|
};
|
|
386
355
|
}
|
|
387
|
-
|
|
388
356
|
this.setState({
|
|
389
357
|
mediaViewerSelectedItem
|
|
390
358
|
});
|
|
391
359
|
}
|
|
392
360
|
});
|
|
393
|
-
|
|
394
361
|
_defineProperty(this, "onInlinePlayerError", () => {
|
|
395
362
|
this.setState({
|
|
396
363
|
isPlayingFile: false
|
|
397
364
|
});
|
|
398
365
|
});
|
|
399
|
-
|
|
400
366
|
_defineProperty(this, "setRef", cardRef => {
|
|
401
367
|
!!cardRef && this.setState({
|
|
402
368
|
cardRef
|
|
403
369
|
});
|
|
404
370
|
});
|
|
405
|
-
|
|
406
371
|
_defineProperty(this, "renderInlinePlayer", () => {
|
|
407
372
|
const {
|
|
408
373
|
identifier,
|
|
@@ -435,19 +400,16 @@ export class CardBase extends Component {
|
|
|
435
400
|
cardPreview: cardPreview
|
|
436
401
|
}));
|
|
437
402
|
});
|
|
438
|
-
|
|
439
403
|
_defineProperty(this, "onMediaViewerClose", () => {
|
|
440
404
|
this.setState({
|
|
441
405
|
mediaViewerSelectedItem: undefined
|
|
442
406
|
});
|
|
443
407
|
});
|
|
444
|
-
|
|
445
408
|
_defineProperty(this, "onDisplayImage", () => {
|
|
446
409
|
const {
|
|
447
410
|
identifier
|
|
448
411
|
} = this.props;
|
|
449
412
|
let payloadPart;
|
|
450
|
-
|
|
451
413
|
if (isFileIdentifier(identifier)) {
|
|
452
414
|
payloadPart = {
|
|
453
415
|
fileId: identifier.id,
|
|
@@ -459,13 +421,11 @@ export class CardBase extends Component {
|
|
|
459
421
|
isUserCollection: false
|
|
460
422
|
};
|
|
461
423
|
}
|
|
462
|
-
|
|
463
424
|
globalMediaEventEmitter.emit('media-viewed', {
|
|
464
425
|
viewingLevel: 'minimal',
|
|
465
426
|
...payloadPart
|
|
466
427
|
});
|
|
467
428
|
});
|
|
468
|
-
|
|
469
429
|
_defineProperty(this, "renderMediaViewer", () => {
|
|
470
430
|
const {
|
|
471
431
|
mediaViewerSelectedItem
|
|
@@ -477,11 +437,9 @@ export class CardBase extends Component {
|
|
|
477
437
|
contextId,
|
|
478
438
|
featureFlags
|
|
479
439
|
} = this.props;
|
|
480
|
-
|
|
481
440
|
if (!mediaViewerSelectedItem) {
|
|
482
441
|
return;
|
|
483
442
|
}
|
|
484
|
-
|
|
485
443
|
const collectionName = isFileIdentifier(identifier) ? identifier.collectionName || '' : '';
|
|
486
444
|
const dataSource = mediaViewerDataSource || {
|
|
487
445
|
list: []
|
|
@@ -496,7 +454,6 @@ export class CardBase extends Component {
|
|
|
496
454
|
featureFlags: featureFlags
|
|
497
455
|
}), document.body);
|
|
498
456
|
});
|
|
499
|
-
|
|
500
457
|
_defineProperty(this, "renderCard", (withCallbacks = true, cardStatusOverride, izLazyOverride) => {
|
|
501
458
|
const {
|
|
502
459
|
identifier,
|
|
@@ -536,11 +493,12 @@ export class CardBase extends Component {
|
|
|
536
493
|
actions,
|
|
537
494
|
onMouseEnter
|
|
538
495
|
} = this;
|
|
539
|
-
const isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
540
|
-
// For example, when we have the image in cache
|
|
541
|
-
|
|
542
|
-
const nativeLazyLoad = isLazyWithOverride && !isCardVisible; // Force Media Image to always display img for SSR
|
|
496
|
+
const isLazyWithOverride = izLazyOverride === undefined ? isLazy : izLazyOverride;
|
|
543
497
|
|
|
498
|
+
// Card can be artificially turned visible before entering the viewport
|
|
499
|
+
// For example, when we have the image in cache
|
|
500
|
+
const nativeLazyLoad = isLazyWithOverride && !isCardVisible;
|
|
501
|
+
// Force Media Image to always display img for SSR
|
|
544
502
|
const forceSyncDisplay = !!ssr;
|
|
545
503
|
const mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, status === 'error' || status === 'failed-processing', !!this.state.cardPreview, metadata.mediaType);
|
|
546
504
|
const card = /*#__PURE__*/React.createElement(CardView, {
|
|
@@ -577,10 +535,8 @@ export class CardBase extends Component {
|
|
|
577
535
|
onVisible: this.onCardInViewport
|
|
578
536
|
}, card) : card;
|
|
579
537
|
});
|
|
580
|
-
|
|
581
538
|
_defineProperty(this, "storeSSRData", () => {
|
|
582
539
|
var _this$ssrReliability$;
|
|
583
|
-
|
|
584
540
|
const {
|
|
585
541
|
ssr,
|
|
586
542
|
identifier
|
|
@@ -597,13 +553,11 @@ export class CardBase extends Component {
|
|
|
597
553
|
error: ((_this$ssrReliability$ = this.ssrReliability.server) === null || _this$ssrReliability$ === void 0 ? void 0 : _this$ssrReliability$.status) === 'fail' ? this.ssrReliability.server : undefined
|
|
598
554
|
});
|
|
599
555
|
});
|
|
600
|
-
|
|
601
556
|
_defineProperty(this, "onCardInViewport", () => {
|
|
602
557
|
this.setState({
|
|
603
558
|
isCardVisible: true
|
|
604
559
|
});
|
|
605
560
|
});
|
|
606
|
-
|
|
607
561
|
_defineProperty(this, "onClick", (event, analyticsEvent) => {
|
|
608
562
|
const {
|
|
609
563
|
onClick
|
|
@@ -611,7 +565,6 @@ export class CardBase extends Component {
|
|
|
611
565
|
const {
|
|
612
566
|
metadata
|
|
613
567
|
} = this;
|
|
614
|
-
|
|
615
568
|
if (onClick) {
|
|
616
569
|
const cardEvent = {
|
|
617
570
|
event,
|
|
@@ -620,7 +573,6 @@ export class CardBase extends Component {
|
|
|
620
573
|
onClick(cardEvent, analyticsEvent);
|
|
621
574
|
}
|
|
622
575
|
});
|
|
623
|
-
|
|
624
576
|
_defineProperty(this, "onMouseEnter", event => {
|
|
625
577
|
const {
|
|
626
578
|
onMouseEnter
|
|
@@ -628,7 +580,6 @@ export class CardBase extends Component {
|
|
|
628
580
|
const {
|
|
629
581
|
metadata
|
|
630
582
|
} = this;
|
|
631
|
-
|
|
632
583
|
if (onMouseEnter) {
|
|
633
584
|
const cardEvent = {
|
|
634
585
|
event,
|
|
@@ -637,39 +588,30 @@ export class CardBase extends Component {
|
|
|
637
588
|
onMouseEnter(cardEvent);
|
|
638
589
|
}
|
|
639
590
|
});
|
|
640
|
-
|
|
641
591
|
let _status = 'loading';
|
|
642
|
-
|
|
643
592
|
let _cardPreview;
|
|
644
|
-
|
|
645
593
|
let _error;
|
|
646
|
-
|
|
647
594
|
const {
|
|
648
595
|
identifier: _identifier,
|
|
649
596
|
resizeMode: _resizeMode,
|
|
650
597
|
ssr: _ssr,
|
|
651
598
|
mediaClient: _mediaClient
|
|
652
599
|
} = this.props;
|
|
653
|
-
|
|
654
600
|
if (isFileIdentifier(_identifier)) {
|
|
655
601
|
const {
|
|
656
602
|
id
|
|
657
603
|
} = _identifier;
|
|
658
604
|
const fileImageMode = imageResizeModeToFileImageMode(_resizeMode);
|
|
659
605
|
_cardPreview = getCardPreviewFromCache(id, fileImageMode);
|
|
660
|
-
|
|
661
606
|
if (!_cardPreview && _ssr) {
|
|
662
607
|
var _this$ssrData, _this$ssrData2;
|
|
663
|
-
|
|
664
608
|
this.ssrData = getSSRData(_identifier);
|
|
665
|
-
|
|
666
609
|
if ((_this$ssrData = this.ssrData) !== null && _this$ssrData !== void 0 && _this$ssrData.error) {
|
|
667
610
|
this.ssrReliability.server = {
|
|
668
611
|
status: 'fail',
|
|
669
612
|
...this.ssrData.error
|
|
670
613
|
};
|
|
671
614
|
}
|
|
672
|
-
|
|
673
615
|
if (!((_this$ssrData2 = this.ssrData) !== null && _this$ssrData2 !== void 0 && _this$ssrData2.dataURI)) {
|
|
674
616
|
try {
|
|
675
617
|
_cardPreview = getSSRCardPreview(_ssr, _mediaClient, _identifier.id, this.getImageURLParams(_identifier), this.getMediaBlobUrlAttrs(_identifier));
|
|
@@ -697,14 +639,13 @@ export class CardBase extends Component {
|
|
|
697
639
|
orientation: 1,
|
|
698
640
|
source: 'external'
|
|
699
641
|
};
|
|
700
|
-
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// If cardPreview is available from local cache or external, `isCardVisible`
|
|
701
645
|
// should be true to avoid flickers during re-mount of the component
|
|
702
646
|
// should not be visible for SSR preview, otherwise we'll fire the metadata fetch from
|
|
703
647
|
// outside the viewport
|
|
704
|
-
|
|
705
|
-
|
|
706
648
|
const _isCardVisible = !this.props.isLazy || !!_cardPreview && !isSSRPreview(_cardPreview);
|
|
707
|
-
|
|
708
649
|
this.state = {
|
|
709
650
|
status: _status,
|
|
710
651
|
isCardVisible: _isCardVisible,
|
|
@@ -717,10 +658,8 @@ export class CardBase extends Component {
|
|
|
717
658
|
error: _error
|
|
718
659
|
};
|
|
719
660
|
}
|
|
720
|
-
|
|
721
661
|
componentDidMount() {
|
|
722
662
|
var _getDocument;
|
|
723
|
-
|
|
724
663
|
this.hasBeenMounted = true;
|
|
725
664
|
const {
|
|
726
665
|
isCardVisible,
|
|
@@ -731,34 +670,28 @@ export class CardBase extends Component {
|
|
|
731
670
|
ssr,
|
|
732
671
|
dimensions
|
|
733
672
|
} = this.props;
|
|
734
|
-
|
|
735
673
|
if (isCardVisible && isFileIdentifier(identifier)) {
|
|
736
674
|
this.updateStateForIdentifier(identifier);
|
|
737
675
|
}
|
|
738
|
-
|
|
739
676
|
if (isCardVisible && !!ssr && !!cardPreview && isFileIdentifier(identifier)) {
|
|
740
677
|
var _this$ssrData3;
|
|
741
|
-
|
|
742
678
|
if (isSSRClientPreview(cardPreview)) {
|
|
743
679
|
// Since the SSR preview brings the token in the query params,
|
|
744
680
|
// We need to fetch the remote preview to be able to cache it,
|
|
745
681
|
this.setCacheSSRPreview(identifier);
|
|
746
682
|
}
|
|
747
|
-
|
|
748
683
|
if (isSSRDataPreview(cardPreview) && isBigger((_this$ssrData3 = this.ssrData) === null || _this$ssrData3 === void 0 ? void 0 : _this$ssrData3.dimensions, dimensions)) {
|
|
749
684
|
// If dimensions from Server have changed and are bigger,
|
|
750
685
|
// we need to refetch
|
|
751
686
|
this.refetchSSRPreview(identifier);
|
|
752
687
|
}
|
|
753
|
-
}
|
|
688
|
+
}
|
|
689
|
+
// we add a listener for each of the cards on the page
|
|
754
690
|
// and then check if the triggered listener is from the card
|
|
755
691
|
// that contains a div in current window.getSelection()
|
|
756
692
|
// won't work in IE11
|
|
757
|
-
|
|
758
|
-
|
|
759
693
|
(_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.addEventListener('copy', this.fireCopiedEvent);
|
|
760
694
|
}
|
|
761
|
-
|
|
762
695
|
componentDidUpdate(prevProps, prevState) {
|
|
763
696
|
const {
|
|
764
697
|
mediaClient: prevMediaClient,
|
|
@@ -791,7 +724,6 @@ export class CardBase extends Component {
|
|
|
791
724
|
const isNewMediaClient = prevMediaClient !== mediaClient;
|
|
792
725
|
const fileImageMode = imageResizeModeToFileImageMode(resizeMode);
|
|
793
726
|
this.updateFileStateFlag(fileState);
|
|
794
|
-
|
|
795
727
|
if (isExternalImageIdentifier(identifier) && isDifferent) {
|
|
796
728
|
this.fireCommencedEvent();
|
|
797
729
|
const {
|
|
@@ -807,19 +739,15 @@ export class CardBase extends Component {
|
|
|
807
739
|
isCardVisible: true
|
|
808
740
|
});
|
|
809
741
|
}
|
|
810
|
-
|
|
811
742
|
if (isFileIdentifier(identifier) && (turnedVisible || !!this.subscription && (isNewMediaClient || isDifferent))) {
|
|
812
743
|
this.updateStateForIdentifier(identifier);
|
|
813
744
|
}
|
|
814
|
-
|
|
815
745
|
if (this.state.status !== prevState.status) {
|
|
816
746
|
this.fireOperationalEvent();
|
|
817
|
-
|
|
818
747
|
if (this.state.status === 'complete' || this.fileAttributes.fileMediatype === 'video' && !!cardPreview && this.state.status === 'processing') {
|
|
819
748
|
this.fireScreenEvent();
|
|
820
749
|
}
|
|
821
750
|
}
|
|
822
|
-
|
|
823
751
|
if (isFileIdentifier(identifier) && fileState && shouldResolvePreview({
|
|
824
752
|
status,
|
|
825
753
|
fileState,
|
|
@@ -833,60 +761,50 @@ export class CardBase extends Component {
|
|
|
833
761
|
})) {
|
|
834
762
|
this.resolvePreview(identifier, fileState);
|
|
835
763
|
}
|
|
836
|
-
|
|
837
764
|
if (turnedVisible && this.props.ssr && !!cardPreview && isSSRClientPreview(cardPreview) && isFileIdentifier(identifier)) {
|
|
838
765
|
// Since the SSR preview brings the token in the query params,
|
|
839
766
|
// We need to fetch the remote preview to be able to cache it,
|
|
840
767
|
this.setCacheSSRPreview(identifier);
|
|
841
768
|
}
|
|
842
|
-
|
|
843
|
-
|
|
769
|
+
if (previewDidRender &&
|
|
770
|
+
// We should't complete if status is uploading
|
|
844
771
|
['loading-preview', 'processing'].includes(status)) {
|
|
845
772
|
this.safeSetState({
|
|
846
773
|
status: 'complete'
|
|
847
774
|
});
|
|
848
775
|
this.unsubscribe();
|
|
849
776
|
}
|
|
850
|
-
|
|
851
777
|
const isVideo = this.fileAttributes.fileMediatype === 'video';
|
|
852
778
|
const videoAvailableToPlay = fileState && isProcessedFileState(fileState);
|
|
853
|
-
|
|
854
779
|
if (isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && videoAvailableToPlay && getMediaFeatureFlag('timestampOnVideo', this.props.featureFlags)) {
|
|
855
780
|
this.setState({
|
|
856
781
|
isPlayingFile: true
|
|
857
782
|
});
|
|
858
783
|
}
|
|
859
784
|
}
|
|
860
|
-
|
|
861
785
|
componentWillUnmount() {
|
|
862
786
|
var _getDocument2;
|
|
863
|
-
|
|
864
787
|
this.hasBeenMounted = false;
|
|
865
788
|
this.unsubscribe();
|
|
866
789
|
(_getDocument2 = getDocument()) === null || _getDocument2 === void 0 ? void 0 : _getDocument2.removeEventListener('copy', this.fireCopiedEvent);
|
|
867
790
|
}
|
|
868
|
-
|
|
869
791
|
updateStateForIdentifier(identifier) {
|
|
870
792
|
this.fireCommencedEvent();
|
|
871
793
|
this.subscribeInternalFile(identifier);
|
|
872
794
|
}
|
|
873
|
-
|
|
874
795
|
updateFileStateFlag(fileState) {
|
|
875
796
|
if (!fileState) {
|
|
876
797
|
return;
|
|
877
798
|
}
|
|
878
|
-
|
|
879
799
|
const {
|
|
880
800
|
status
|
|
881
801
|
} = fileState;
|
|
882
|
-
|
|
883
802
|
if (status === 'processing') {
|
|
884
803
|
this.fileStateFlags.wasStatusProcessing = true;
|
|
885
804
|
} else if (status === 'uploading') {
|
|
886
805
|
this.fileStateFlags.wasStatusUploading = true;
|
|
887
806
|
}
|
|
888
807
|
}
|
|
889
|
-
|
|
890
808
|
subscribeInternalFile(identifier) {
|
|
891
809
|
const {
|
|
892
810
|
mediaClient
|
|
@@ -921,7 +839,6 @@ export class CardBase extends Component {
|
|
|
921
839
|
}
|
|
922
840
|
});
|
|
923
841
|
}
|
|
924
|
-
|
|
925
842
|
get requestedDimensions() {
|
|
926
843
|
const {
|
|
927
844
|
dimensions
|
|
@@ -934,19 +851,14 @@ export class CardBase extends Component {
|
|
|
934
851
|
element
|
|
935
852
|
});
|
|
936
853
|
}
|
|
937
|
-
|
|
938
854
|
get metadata() {
|
|
939
855
|
var _this$state;
|
|
940
|
-
|
|
941
856
|
return getFileDetails(this.props.identifier, (_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.fileState);
|
|
942
857
|
}
|
|
943
|
-
|
|
944
858
|
get fileAttributes() {
|
|
945
859
|
var _this$state2, _this$state2$fileStat;
|
|
946
|
-
|
|
947
860
|
return getFileAttributes(this.metadata, (_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : (_this$state2$fileStat = _this$state2.fileState) === null || _this$state2$fileStat === void 0 ? void 0 : _this$state2$fileStat.status);
|
|
948
861
|
}
|
|
949
|
-
|
|
950
862
|
fireOperationalEvent() {
|
|
951
863
|
const {
|
|
952
864
|
status,
|
|
@@ -959,7 +871,6 @@ export class CardBase extends Component {
|
|
|
959
871
|
createAnalyticsEvent && fireOperationalEvent(createAnalyticsEvent, status, this.fileAttributes, this.getPerformanceAttributes(), this.ssrReliability, error, this.traceContext, fileState === null || fileState === void 0 ? void 0 : fileState.metadataTraceContext);
|
|
960
872
|
completeUfoExperience(this.internalOccurrenceKey, status, this.fileAttributes, this.fileStateFlags, this.ssrReliability, error);
|
|
961
873
|
}
|
|
962
|
-
|
|
963
874
|
fireCommencedEvent() {
|
|
964
875
|
this.timeElapsedTillCommenced = performance.now();
|
|
965
876
|
const {
|
|
@@ -972,7 +883,6 @@ export class CardBase extends Component {
|
|
|
972
883
|
}, this.traceContext);
|
|
973
884
|
startUfoExperience(this.internalOccurrenceKey);
|
|
974
885
|
}
|
|
975
|
-
|
|
976
886
|
get actions() {
|
|
977
887
|
const {
|
|
978
888
|
actions = [],
|
|
@@ -985,7 +895,6 @@ export class CardBase extends Component {
|
|
|
985
895
|
const {
|
|
986
896
|
metadata
|
|
987
897
|
} = this;
|
|
988
|
-
|
|
989
898
|
if (isFileIdentifier(identifier) && (status === 'failed-processing' || shouldEnableDownloadButton)) {
|
|
990
899
|
const downloadAction = {
|
|
991
900
|
label: 'Download',
|
|
@@ -999,7 +908,6 @@ export class CardBase extends Component {
|
|
|
999
908
|
return actions;
|
|
1000
909
|
}
|
|
1001
910
|
}
|
|
1002
|
-
|
|
1003
911
|
render() {
|
|
1004
912
|
const {
|
|
1005
913
|
isPlayingFile,
|
|
@@ -1010,9 +918,7 @@ export class CardBase extends Component {
|
|
|
1010
918
|
locale: "en"
|
|
1011
919
|
}, innerContent);
|
|
1012
920
|
}
|
|
1013
|
-
|
|
1014
921
|
}
|
|
1015
|
-
|
|
1016
922
|
_defineProperty(CardBase, "defaultProps", {
|
|
1017
923
|
appearance: 'auto',
|
|
1018
924
|
resizeMode: 'crop',
|
|
@@ -1021,7 +927,6 @@ _defineProperty(CardBase, "defaultProps", {
|
|
|
1021
927
|
// Media Feature Flag defaults are defined in @atlaskit/media-common
|
|
1022
928
|
featureFlags: {}
|
|
1023
929
|
});
|
|
1024
|
-
|
|
1025
930
|
export const Card = withMediaAnalyticsContext({
|
|
1026
931
|
packageVersion,
|
|
1027
932
|
packageName,
|