@atlaskit/media-card 73.1.0 → 73.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/cjs/files/cardImageView/index.js +51 -41
- package/dist/cjs/root/card/cardAnalytics.js +4 -4
- package/dist/cjs/root/card/getCardPreview/index.js +7 -1
- package/dist/cjs/root/card/index.js +301 -155
- package/dist/cjs/root/cardView.js +128 -118
- package/dist/cjs/root/inlinePlayer.js +4 -2
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +17 -23
- package/dist/cjs/root/ui/styled.js +5 -5
- package/dist/cjs/types.js +10 -1
- package/dist/cjs/utils/analytics.js +32 -13
- package/dist/cjs/utils/dimensionComparer.js +7 -13
- package/dist/cjs/utils/getMediaCardCursor.js +29 -0
- package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
- package/dist/cjs/utils/globalScope/globalScope.js +94 -0
- package/dist/cjs/utils/globalScope/index.js +39 -0
- package/dist/cjs/utils/globalScope/types.js +5 -0
- package/dist/cjs/utils/printScript.js +44 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/files/cardImageView/index.js +19 -5
- package/dist/es2019/root/card/cardAnalytics.js +4 -4
- package/dist/es2019/root/card/getCardPreview/index.js +1 -0
- package/dist/es2019/root/card/index.js +167 -40
- package/dist/es2019/root/cardView.js +41 -35
- package/dist/es2019/root/inlinePlayer.js +4 -2
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +17 -19
- package/dist/es2019/root/ui/styled.js +4 -4
- package/dist/es2019/types.js +7 -1
- package/dist/es2019/utils/analytics.js +17 -9
- package/dist/es2019/utils/dimensionComparer.js +6 -13
- package/dist/es2019/utils/getMediaCardCursor.js +19 -0
- package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
- package/dist/es2019/utils/globalScope/globalScope.js +62 -0
- package/dist/es2019/utils/globalScope/index.js +2 -0
- package/dist/es2019/utils/globalScope/types.js +1 -0
- package/dist/es2019/utils/printScript.js +19 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/files/cardImageView/index.js +53 -41
- package/dist/esm/root/card/cardAnalytics.js +4 -4
- package/dist/esm/root/card/getCardPreview/index.js +3 -0
- package/dist/esm/root/card/index.js +284 -138
- package/dist/esm/root/cardView.js +127 -118
- package/dist/esm/root/inlinePlayer.js +4 -2
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +17 -21
- package/dist/esm/root/ui/styled.js +5 -5
- package/dist/esm/types.js +7 -1
- package/dist/esm/utils/analytics.js +26 -12
- package/dist/esm/utils/dimensionComparer.js +8 -13
- package/dist/esm/utils/getMediaCardCursor.js +19 -0
- package/dist/esm/utils/globalScope/getSSRData.js +10 -0
- package/dist/esm/utils/globalScope/globalScope.js +69 -0
- package/dist/esm/utils/globalScope/index.js +2 -0
- package/dist/esm/utils/globalScope/types.js +1 -0
- package/dist/esm/utils/printScript.js +30 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/__tests_external__/page-objects/MediaCard.d.ts +0 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/files/cardImageView/index.d.ts +6 -2
- package/dist/types/root/card/cardAnalytics.d.ts +2 -1
- package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +5 -1
- package/dist/types/root/cardView.d.ts +8 -6
- package/dist/types/root/inlinePlayer.d.ts +3 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +5 -14
- package/dist/types/root/ui/styled.d.ts +2 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types/utils/analytics.d.ts +27 -5
- package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
- package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
- package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
- package/dist/types/utils/globalScope/index.d.ts +4 -0
- package/dist/types/utils/globalScope/types.d.ts +8 -0
- package/dist/types/utils/printScript.d.ts +2 -0
- package/package.json +12 -12
|
@@ -52,7 +52,7 @@ const getWrapperShadow = (disableOverlay, selected) => {
|
|
|
52
52
|
return shadow ? `box-shadow: ${shadow};` : '';
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const getCursorStyle =
|
|
55
|
+
const getCursorStyle = cursor => `cursor: ${cursor};`;
|
|
56
56
|
|
|
57
57
|
const getClickablePlayButtonStyles = isPlayButtonClickable => {
|
|
58
58
|
if (!isPlayButtonClickable) {
|
|
@@ -83,13 +83,13 @@ export const NewFileExperienceWrapper = styled.div`
|
|
|
83
83
|
breakpoint,
|
|
84
84
|
dimensions,
|
|
85
85
|
appearance,
|
|
86
|
-
shouldUsePointerCursor,
|
|
87
86
|
disableOverlay,
|
|
88
87
|
displayBackground,
|
|
89
88
|
selected,
|
|
90
89
|
isPlayButtonClickable,
|
|
91
90
|
isTickBoxSelectable,
|
|
92
|
-
shouldDisplayTooltip
|
|
91
|
+
shouldDisplayTooltip,
|
|
92
|
+
mediaCardCursor
|
|
93
93
|
}) => `
|
|
94
94
|
${transition()}
|
|
95
95
|
box-sizing: border-box;
|
|
@@ -101,7 +101,7 @@ export const NewFileExperienceWrapper = styled.div`
|
|
|
101
101
|
${getWrapperDimensions(dimensions, appearance)}
|
|
102
102
|
${displayBackground ? `background-color: ${N20};` : ''}
|
|
103
103
|
${borderRadius}
|
|
104
|
-
${getCursorStyle(
|
|
104
|
+
${getCursorStyle(mediaCardCursor)}
|
|
105
105
|
${getWrapperShadow(disableOverlay, selected)}
|
|
106
106
|
${generateResponsiveStyles(breakpoint)}
|
|
107
107
|
${hideNativeBrowserTextSelectionStyles}
|
package/dist/es2019/types.js
CHANGED
|
@@ -30,14 +30,15 @@ export const getRenderCommencedEventPayload = (fileAttributes, performanceAttrib
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
export const getRenderSucceededEventPayload = (fileAttributes, performanceAttributes) => ({
|
|
33
|
+
export const getRenderSucceededEventPayload = (fileAttributes, performanceAttributes, ssrReliability) => ({
|
|
34
34
|
eventType: 'operational',
|
|
35
35
|
action: 'succeeded',
|
|
36
36
|
actionSubject: 'mediaCardRender',
|
|
37
37
|
attributes: {
|
|
38
38
|
fileAttributes,
|
|
39
39
|
performanceAttributes,
|
|
40
|
-
status: 'success'
|
|
40
|
+
status: 'success',
|
|
41
|
+
ssrReliability
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
export const getRenderFailedExternalUriPayload = (fileAttributes, performanceAttributes) => ({
|
|
@@ -81,7 +82,14 @@ export const getRenderErrorRequestMetadata = error => {
|
|
|
81
82
|
return error.secondaryError.metadata;
|
|
82
83
|
}
|
|
83
84
|
};
|
|
84
|
-
export const
|
|
85
|
+
export const extractErrorInfo = error => {
|
|
86
|
+
return {
|
|
87
|
+
failReason: getRenderErrorFailReason(error),
|
|
88
|
+
error: getRenderErrorErrorReason(error),
|
|
89
|
+
errorDetail: getRenderErrorErrorDetail(error)
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes, error, ssrReliability) => ({
|
|
85
93
|
eventType: 'operational',
|
|
86
94
|
action: 'failed',
|
|
87
95
|
actionSubject: 'mediaCardRender',
|
|
@@ -89,13 +97,12 @@ export const getRenderErrorEventPayload = (fileAttributes, performanceAttributes
|
|
|
89
97
|
fileAttributes,
|
|
90
98
|
performanceAttributes,
|
|
91
99
|
status: 'fail',
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
request: getRenderErrorRequestMetadata(error)
|
|
100
|
+
...extractErrorInfo(error),
|
|
101
|
+
request: getRenderErrorRequestMetadata(error),
|
|
102
|
+
ssrReliability
|
|
96
103
|
}
|
|
97
104
|
});
|
|
98
|
-
export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttributes) => ({
|
|
105
|
+
export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttributes, ssrReliability) => ({
|
|
99
106
|
eventType: 'operational',
|
|
100
107
|
action: 'failed',
|
|
101
108
|
actionSubject: 'mediaCardRender',
|
|
@@ -103,7 +110,8 @@ export const getRenderFailedFileStatusPayload = (fileAttributes, performanceAttr
|
|
|
103
110
|
fileAttributes,
|
|
104
111
|
performanceAttributes,
|
|
105
112
|
status: 'fail',
|
|
106
|
-
failReason: 'failed-processing'
|
|
113
|
+
failReason: 'failed-processing',
|
|
114
|
+
ssrReliability
|
|
107
115
|
}
|
|
108
116
|
});
|
|
109
117
|
export const getCopiedFilePayload = fileId => ({
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { isValidPercentageUnit } from './isValidPercentageUnit';
|
|
2
2
|
import { containsPixelUnit } from './containsPixelUnit';
|
|
3
|
+
|
|
4
|
+
const isPixelEquivalent = dimension => typeof dimension === 'number' || containsPixelUnit(`${dimension}`);
|
|
5
|
+
|
|
3
6
|
export const canCompareDimension = (current, next) => {
|
|
4
7
|
if (!current || !next) {
|
|
5
8
|
return false;
|
|
6
9
|
}
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (containsPixelUnit(`${current}`) && containsPixelUnit(`${next}`)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (typeof current === 'number' && typeof next === 'number') {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return false;
|
|
11
|
+
const bothPixelEquivalent = isPixelEquivalent(current) && isPixelEquivalent(next);
|
|
12
|
+
const bothPercentage = isValidPercentageUnit(current) && isValidPercentageUnit(next);
|
|
13
|
+
return bothPixelEquivalent || bothPercentage;
|
|
21
14
|
};
|
|
22
15
|
export const isBigger = (current, next) => {
|
|
23
16
|
if (!!current && !!next && canCompareDimension(current.width, next.width) && canCompareDimension(current.height, next.height)) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MediaCardCursor } from '../types';
|
|
2
|
+
export const getMediaCardCursor = (useInlinePlayer, useMediaViewer, isErrorStatus, hasCardPreview, mediaType) => {
|
|
3
|
+
// If error status or no action is requested = NoAction
|
|
4
|
+
if (isErrorStatus || !useInlinePlayer && !useMediaViewer) {
|
|
5
|
+
return MediaCardCursor.NoAction;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (!mediaType && (useInlinePlayer || useInlinePlayer && useMediaViewer)) {
|
|
9
|
+
return MediaCardCursor.NotReady;
|
|
10
|
+
} else if (mediaType === 'video' && hasCardPreview && useInlinePlayer) {
|
|
11
|
+
return MediaCardCursor.Action;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (useMediaViewer) {
|
|
15
|
+
return MediaCardCursor.Action;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return MediaCardCursor.NoAction;
|
|
19
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { printFunctionCall, printScript } from '../printScript';
|
|
3
|
+
// ----- WARNING -----
|
|
4
|
+
// This is a very sensitive fraction of code.
|
|
5
|
+
// Any changes to this file must be tested directly in product before merging.
|
|
6
|
+
// The scripts printed here might differ from what we observe in our internal tests
|
|
7
|
+
// due to minimification, for example.
|
|
8
|
+
export const GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
|
|
9
|
+
export const GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
|
|
10
|
+
export function getMediaGlobalScope(globalScope = window) {
|
|
11
|
+
// Must match GLOBAL_MEDIA_NAMESPACE. Can't reference the constant from here.
|
|
12
|
+
const namespace = '__MEDIA_INTERNAL';
|
|
13
|
+
|
|
14
|
+
if (!globalScope[namespace]) {
|
|
15
|
+
globalScope[namespace] = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return globalScope[namespace];
|
|
19
|
+
}
|
|
20
|
+
export function getMediaCardSSR(globalScope = window) {
|
|
21
|
+
const globalMedia = getMediaGlobalScope(globalScope); // Must match GLOBAL_MEDIA_CARD_SSR. Can't reference the constant from here.
|
|
22
|
+
|
|
23
|
+
const key = 'mediaCardSsr';
|
|
24
|
+
|
|
25
|
+
if (!globalMedia[key]) {
|
|
26
|
+
globalMedia[key] = {};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return globalMedia[key];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const dashed = param => param ? `-${param}` : '';
|
|
33
|
+
|
|
34
|
+
export const getKey = ({
|
|
35
|
+
id,
|
|
36
|
+
collectionName,
|
|
37
|
+
occurrenceKey
|
|
38
|
+
}) => `${id}${dashed(collectionName)}${dashed(occurrenceKey)}`;
|
|
39
|
+
export const storeDataURI = (key, dataURI, dimensions, error, globalScope = window) => {
|
|
40
|
+
const mediaCardSsr = getMediaCardSSR(globalScope);
|
|
41
|
+
mediaCardSsr[key] = {
|
|
42
|
+
dataURI,
|
|
43
|
+
dimensions,
|
|
44
|
+
error
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const generateScript = (identifier, dataURI, dimensions, error) => {
|
|
49
|
+
const functionCall = printFunctionCall(storeDataURI, getKey(identifier), dataURI, dimensions, error);
|
|
50
|
+
return printScript([getMediaCardSSR.toString(), getMediaGlobalScope.toString(), functionCall]);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const StoreSSRDataScript = ({
|
|
54
|
+
dataURI,
|
|
55
|
+
identifier,
|
|
56
|
+
dimensions,
|
|
57
|
+
error
|
|
58
|
+
}) => /*#__PURE__*/React.createElement("script", {
|
|
59
|
+
dangerouslySetInnerHTML: {
|
|
60
|
+
__html: generateScript(identifier, dataURI, dimensions, error)
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const printParam = param => {
|
|
2
|
+
if (typeof param === 'string') {
|
|
3
|
+
return `'${param}'`;
|
|
4
|
+
} else if (typeof param === 'object') {
|
|
5
|
+
return JSON.stringify(param);
|
|
6
|
+
} else if (param === undefined) {
|
|
7
|
+
return 'undefined';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return param;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const printParams = args => args.map(arg => printParam(arg)).join(',');
|
|
14
|
+
|
|
15
|
+
export const printFunctionCall = (fn, ...args) => `(${fn.toString()})(${printParams(args)});`;
|
|
16
|
+
export const printScript = statements => `(function(){
|
|
17
|
+
${statements.join(';')}
|
|
18
|
+
})();
|
|
19
|
+
`;
|
package/dist/es2019/version.json
CHANGED
|
@@ -156,18 +156,30 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
156
156
|
})));
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
159
|
+
_defineProperty(_assertThisInitialized(_this), "onImageLoad", function () {
|
|
160
160
|
var _this$props6 = _this.props,
|
|
161
|
-
status = _this$props6.status,
|
|
162
|
-
mediaItemType = _this$props6.mediaItemType,
|
|
163
|
-
dataURI = _this$props6.dataURI,
|
|
164
|
-
mediaType = _this$props6.mediaType,
|
|
165
|
-
mimeType = _this$props6.mimeType,
|
|
166
|
-
previewOrientation = _this$props6.previewOrientation,
|
|
167
|
-
onDisplayImage = _this$props6.onDisplayImage,
|
|
168
|
-
alt = _this$props6.alt,
|
|
169
161
|
onImageLoad = _this$props6.onImageLoad,
|
|
170
|
-
|
|
162
|
+
cardPreview = _this$props6.cardPreview;
|
|
163
|
+
onImageLoad && onImageLoad(cardPreview);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
_defineProperty(_assertThisInitialized(_this), "onImageError", function () {
|
|
167
|
+
var _this$props7 = _this.props,
|
|
168
|
+
onImageError = _this$props7.onImageError,
|
|
169
|
+
cardPreview = _this$props7.cardPreview;
|
|
170
|
+
onImageError && onImageError(cardPreview);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
_defineProperty(_assertThisInitialized(_this), "renderMediaImage", function () {
|
|
174
|
+
var _this$props8 = _this.props,
|
|
175
|
+
status = _this$props8.status,
|
|
176
|
+
mediaItemType = _this$props8.mediaItemType,
|
|
177
|
+
dataURI = _this$props8.dataURI,
|
|
178
|
+
mediaType = _this$props8.mediaType,
|
|
179
|
+
mimeType = _this$props8.mimeType,
|
|
180
|
+
previewOrientation = _this$props8.previewOrientation,
|
|
181
|
+
onDisplayImage = _this$props8.onDisplayImage,
|
|
182
|
+
alt = _this$props8.alt;
|
|
171
183
|
|
|
172
184
|
if (!shouldDisplayImageThumbnail(status, mediaItemType, dataURI, mediaType, mimeType)) {
|
|
173
185
|
return null;
|
|
@@ -184,17 +196,17 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
184
196
|
crop: _this.isCropped,
|
|
185
197
|
stretch: _this.isStretched,
|
|
186
198
|
previewOrientation: previewOrientation,
|
|
187
|
-
onImageLoad: onImageLoad,
|
|
188
|
-
onImageError: onImageError
|
|
199
|
+
onImageLoad: _this.onImageLoad,
|
|
200
|
+
onImageError: _this.onImageError
|
|
189
201
|
});
|
|
190
202
|
});
|
|
191
203
|
|
|
192
204
|
_defineProperty(_assertThisInitialized(_this), "renderProgressBar", function () {
|
|
193
|
-
var _this$
|
|
194
|
-
mediaName = _this$
|
|
195
|
-
progress = _this$
|
|
196
|
-
actions = _this$
|
|
197
|
-
status = _this$
|
|
205
|
+
var _this$props9 = _this.props,
|
|
206
|
+
mediaName = _this$props9.mediaName,
|
|
207
|
+
progress = _this$props9.progress,
|
|
208
|
+
actions = _this$props9.actions,
|
|
209
|
+
status = _this$props9.status;
|
|
198
210
|
|
|
199
211
|
if (status !== 'uploading') {
|
|
200
212
|
return null;
|
|
@@ -213,10 +225,10 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
213
225
|
});
|
|
214
226
|
|
|
215
227
|
_defineProperty(_assertThisInitialized(_this), "renderSuccessCardContents", function () {
|
|
216
|
-
var _this$
|
|
217
|
-
disableOverlay = _this$
|
|
218
|
-
selectable = _this$
|
|
219
|
-
status = _this$
|
|
228
|
+
var _this$props10 = _this.props,
|
|
229
|
+
disableOverlay = _this$props10.disableOverlay,
|
|
230
|
+
selectable = _this$props10.selectable,
|
|
231
|
+
status = _this$props10.status;
|
|
220
232
|
var overlay = null;
|
|
221
233
|
|
|
222
234
|
if (!disableOverlay) {
|
|
@@ -237,15 +249,15 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
237
249
|
});
|
|
238
250
|
|
|
239
251
|
_defineProperty(_assertThisInitialized(_this), "renderSuccessCardOverlay", function () {
|
|
240
|
-
var _this$
|
|
241
|
-
status = _this$
|
|
242
|
-
mediaName = _this$
|
|
243
|
-
mediaType = _this$
|
|
244
|
-
fileSize = _this$
|
|
245
|
-
dataURI = _this$
|
|
246
|
-
selectable = _this$
|
|
247
|
-
selected = _this$
|
|
248
|
-
actions = _this$
|
|
252
|
+
var _this$props11 = _this.props,
|
|
253
|
+
status = _this$props11.status,
|
|
254
|
+
mediaName = _this$props11.mediaName,
|
|
255
|
+
mediaType = _this$props11.mediaType,
|
|
256
|
+
fileSize = _this$props11.fileSize,
|
|
257
|
+
dataURI = _this$props11.dataURI,
|
|
258
|
+
selectable = _this$props11.selectable,
|
|
259
|
+
selected = _this$props11.selected,
|
|
260
|
+
actions = _this$props11.actions;
|
|
249
261
|
var isPersistent = mediaType === 'doc' || !dataURI;
|
|
250
262
|
return /*#__PURE__*/React.createElement(CardOverlay, {
|
|
251
263
|
cardStatus: status,
|
|
@@ -265,14 +277,14 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
265
277
|
_createClass(FileCardImageView, [{
|
|
266
278
|
key: "render",
|
|
267
279
|
value: function render() {
|
|
268
|
-
var _this$
|
|
269
|
-
disableOverlay = _this$
|
|
270
|
-
selectable = _this$
|
|
271
|
-
selected = _this$
|
|
272
|
-
mediaType = _this$
|
|
273
|
-
progress = _this$
|
|
274
|
-
status = _this$
|
|
275
|
-
mediaName = _this$
|
|
280
|
+
var _this$props12 = this.props,
|
|
281
|
+
disableOverlay = _this$props12.disableOverlay,
|
|
282
|
+
selectable = _this$props12.selectable,
|
|
283
|
+
selected = _this$props12.selected,
|
|
284
|
+
mediaType = _this$props12.mediaType,
|
|
285
|
+
progress = _this$props12.progress,
|
|
286
|
+
status = _this$props12.status,
|
|
287
|
+
mediaName = _this$props12.mediaName;
|
|
276
288
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
277
289
|
"data-testid": "media-file-card-view",
|
|
278
290
|
"data-test-media-name": mediaName,
|
|
@@ -289,9 +301,9 @@ export var FileCardImageView = /*#__PURE__*/function (_Component) {
|
|
|
289
301
|
}, {
|
|
290
302
|
key: "isFileCardImageReadyForDisplay",
|
|
291
303
|
get: function get() {
|
|
292
|
-
var _this$
|
|
293
|
-
dataURI = _this$
|
|
294
|
-
status = _this$
|
|
304
|
+
var _this$props13 = this.props,
|
|
305
|
+
dataURI = _this$props13.dataURI,
|
|
306
|
+
status = _this$props13.status;
|
|
295
307
|
return !!dataURI || !['loading', 'processing', 'loading-preview'].includes(status);
|
|
296
308
|
}
|
|
297
309
|
}, {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { fireMediaCardEvent, getRenderSucceededEventPayload, getRenderErrorEventPayload, getRenderFailedFileStatusPayload, getCopiedFilePayload, getRenderCommencedEventPayload, getRenderPreviewableCardPayload } from '../../utils/analytics';
|
|
2
2
|
export var relevantFeatureFlagNames = ['newCardExperience', 'captions', 'timestampOnVideo'];
|
|
3
|
-
export var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, error) {
|
|
3
|
+
export var fireOperationalEvent = function fireOperationalEvent(createAnalyticsEvent, status, fileAttributes, performanceAttributes, ssrReliability, error) {
|
|
4
4
|
var fireEvent = function fireEvent(payload) {
|
|
5
5
|
return fireMediaCardEvent(payload, createAnalyticsEvent);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
switch (status) {
|
|
9
9
|
case 'complete':
|
|
10
|
-
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes));
|
|
10
|
+
fireEvent(getRenderSucceededEventPayload(fileAttributes, performanceAttributes, ssrReliability));
|
|
11
11
|
break;
|
|
12
12
|
|
|
13
13
|
case 'failed-processing':
|
|
14
|
-
fireEvent(getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes));
|
|
14
|
+
fireEvent(getRenderFailedFileStatusPayload(fileAttributes, performanceAttributes, ssrReliability));
|
|
15
15
|
break;
|
|
16
16
|
|
|
17
17
|
case 'error':
|
|
18
|
-
error && fireEvent(getRenderErrorEventPayload(fileAttributes, performanceAttributes, error));
|
|
18
|
+
error && fireEvent(getRenderErrorEventPayload(fileAttributes, performanceAttributes, error, ssrReliability));
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -208,6 +208,9 @@ export var isSSRClientPreview = function isSSRClientPreview(preview) {
|
|
|
208
208
|
var ssrClientSources = ['ssr-client', 'cache-ssr-client'];
|
|
209
209
|
return ssrClientSources.includes(preview.source);
|
|
210
210
|
};
|
|
211
|
+
export var isSSRDataPreview = function isSSRDataPreview(preview) {
|
|
212
|
+
return preview.source === 'ssr-data';
|
|
213
|
+
};
|
|
211
214
|
export var fetchAndCacheRemotePreview = /*#__PURE__*/function () {
|
|
212
215
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(mediaClient, id, dimensions, params, mediaBlobUrlAttrs) {
|
|
213
216
|
var remotePreview;
|