@atlaskit/media-card 77.1.2 → 77.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/useBreakpoint.js +29 -0
- package/dist/cjs/card/v2/cardV2.js +3 -5
- package/dist/cjs/card/v2/cardV2Loader.js +9 -16
- package/dist/cjs/card/v2/cardViewV2.js +5 -22
- package/dist/cjs/card/v2/inlinePlayerLazyV2.js +35 -0
- package/dist/cjs/card/v2/inlinePlayerV2.js +222 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/useBreakpoint.js +22 -0
- package/dist/es2019/card/v2/cardV2.js +3 -5
- package/dist/es2019/card/v2/cardV2Loader.js +10 -17
- package/dist/es2019/card/v2/cardViewV2.js +4 -18
- package/dist/es2019/card/v2/inlinePlayerLazyV2.js +10 -0
- package/dist/es2019/card/v2/inlinePlayerV2.js +164 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/useBreakpoint.js +24 -0
- package/dist/esm/card/v2/cardV2.js +3 -5
- package/dist/esm/card/v2/cardV2Loader.js +9 -16
- package/dist/esm/card/v2/cardViewV2.js +7 -24
- package/dist/esm/card/v2/inlinePlayerLazyV2.js +23 -0
- package/dist/esm/card/v2/inlinePlayerV2.js +212 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/useBreakpoint.d.ts +3 -0
- package/dist/types/card/v2/inlinePlayerLazyV2.d.ts +2 -0
- package/dist/types/card/v2/inlinePlayerV2.d.ts +23 -0
- package/dist/types-ts4.5/card/actions.d.ts +9 -0
- package/dist/types-ts4.5/card/card.d.ts +64 -0
- package/dist/types-ts4.5/card/cardAnalytics.d.ts +10 -0
- package/dist/types-ts4.5/card/cardConstants.d.ts +1 -0
- package/dist/types-ts4.5/card/cardLoader.d.ts +6 -0
- package/dist/types-ts4.5/card/cardState.d.ts +9 -0
- package/dist/types-ts4.5/card/cardSwitcher.d.ts +4 -0
- package/dist/types-ts4.5/card/cardView.d.ts +78 -0
- package/dist/types-ts4.5/card/classnames.d.ts +2 -0
- package/dist/types-ts4.5/card/getCardPreview/cache.d.ts +21 -0
- package/dist/types-ts4.5/card/getCardPreview/filePreviewStatus.d.ts +4 -0
- package/dist/types-ts4.5/card/getCardPreview/helpers.d.ts +10 -0
- package/dist/types-ts4.5/card/getCardPreview/index.d.ts +53 -0
- package/dist/types-ts4.5/card/getCardStatus.d.ts +4 -0
- package/dist/types-ts4.5/card/index.d.ts +1 -0
- package/dist/types-ts4.5/card/inlinePlayer.d.ts +52 -0
- package/dist/types-ts4.5/card/inlinePlayerLazy.d.ts +2 -0
- package/dist/types-ts4.5/card/inlinePlayerWrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/inlinePlayerWrapperStyles.d.ts +6 -0
- package/dist/types-ts4.5/card/media-card-analytics-error-boundary.d.ts +14 -0
- package/dist/types-ts4.5/card/types.d.ts +13 -0
- package/dist/types-ts4.5/card/ui/actionsBar/actionsBar.d.ts +5 -0
- package/dist/types-ts4.5/card/ui/actionsBar/actionsBarWrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionButton.d.ts +3 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +12 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +14 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsView.d.ts +16 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/index.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +18 -0
- package/dist/types-ts4.5/card/ui/actionsBar/styles.d.ts +6 -0
- package/dist/types-ts4.5/card/ui/actionsBar/types.d.ts +10 -0
- package/dist/types-ts4.5/card/ui/blanket/blanket.d.ts +6 -0
- package/dist/types-ts4.5/card/ui/blanket/styles.d.ts +6 -0
- package/dist/types-ts4.5/card/ui/common.d.ts +23 -0
- package/dist/types-ts4.5/card/ui/iconMessage/iconMessageWrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/iconMessage/index.d.ts +8 -0
- package/dist/types-ts4.5/card/ui/iconMessage/styles.d.ts +5 -0
- package/dist/types-ts4.5/card/ui/iconMessage/types.d.ts +19 -0
- package/dist/types-ts4.5/card/ui/iconWrapper/iconWrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/iconWrapper/types.d.ts +6 -0
- package/dist/types-ts4.5/card/ui/imageRenderer/imageRenderer.d.ts +15 -0
- package/dist/types-ts4.5/card/ui/imageRenderer/resizeModeToMediaImageProps.d.ts +5 -0
- package/dist/types-ts4.5/card/ui/playButton/playButton.d.ts +2 -0
- package/dist/types-ts4.5/card/ui/playButton/playButtonBackground.d.ts +3 -0
- package/dist/types-ts4.5/card/ui/playButton/playButtonWrapper.d.ts +3 -0
- package/dist/types-ts4.5/card/ui/playButton/styles.d.ts +5 -0
- package/dist/types-ts4.5/card/ui/progressBar/progressBar.d.ts +10 -0
- package/dist/types-ts4.5/card/ui/progressBar/styledBar.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/progressBar/styles.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/progressBar/types.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/styles.d.ts +13 -0
- package/dist/types-ts4.5/card/ui/tickBox/styles.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/tickBox/tickBox.d.ts +3 -0
- package/dist/types-ts4.5/card/ui/tickBox/tickBoxWrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/tickBox/types.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/titleBox/failedTitleBox.d.ts +3 -0
- package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +15 -0
- package/dist/types-ts4.5/card/ui/titleBox/titleBox.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/titleBox/titleBoxComponents.d.ts +8 -0
- package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +34 -0
- package/dist/types-ts4.5/card/ui/unhandledErrorCard/index.d.ts +7 -0
- package/dist/types-ts4.5/card/ui/unhandledErrorCard/types.d.ts +6 -0
- package/dist/types-ts4.5/card/ui/wrapper/index.d.ts +1 -0
- package/dist/types-ts4.5/card/ui/wrapper/styles.d.ts +5 -0
- package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +25 -0
- package/dist/types-ts4.5/card/ui/wrapper/wrapper.d.ts +4 -0
- package/dist/types-ts4.5/card/useBreakpoint.d.ts +3 -0
- package/dist/types-ts4.5/card/v2/cardV2.d.ts +63 -0
- package/dist/types-ts4.5/card/v2/cardV2Loader.d.ts +4 -0
- package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +44 -0
- package/dist/types-ts4.5/card/v2/inlinePlayerLazyV2.d.ts +2 -0
- package/dist/types-ts4.5/card/v2/inlinePlayerV2.d.ts +23 -0
- package/dist/types-ts4.5/classnames.d.ts +5 -0
- package/dist/types-ts4.5/errors.d.ts +53 -0
- package/dist/types-ts4.5/index.d.ts +15 -0
- package/dist/types-ts4.5/inline/index.d.ts +1 -0
- package/dist/types-ts4.5/inline/loader.d.ts +26 -0
- package/dist/types-ts4.5/inline/mediaInlineAnalyticsErrorBoundary.d.ts +12 -0
- package/dist/types-ts4.5/inline/mediaInlineCard.d.ts +15 -0
- package/dist/types-ts4.5/inline/mediaInlineCardAnalytics.d.ts +6 -0
- package/dist/types-ts4.5/types.d.ts +105 -0
- package/dist/types-ts4.5/utils/analytics.d.ts +101 -0
- package/dist/types-ts4.5/utils/cardDimensions.d.ts +14 -0
- package/dist/types-ts4.5/utils/containsPixelUnit.d.ts +1 -0
- package/dist/types-ts4.5/utils/dimensionComparer.d.ts +3 -0
- package/dist/types-ts4.5/utils/document.d.ts +2 -0
- package/dist/types-ts4.5/utils/generateUniqueId.d.ts +1 -0
- package/dist/types-ts4.5/utils/getCSSUnitValue.d.ts +1 -0
- package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +9 -0
- package/dist/types-ts4.5/utils/getElementDimension.d.ts +2 -0
- package/dist/types-ts4.5/utils/getMediaCardCursor.d.ts +6 -0
- package/dist/types-ts4.5/utils/globalScope/getSSRData.d.ts +3 -0
- package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +21 -0
- package/dist/types-ts4.5/utils/globalScope/index.d.ts +4 -0
- package/dist/types-ts4.5/utils/globalScope/types.d.ts +8 -0
- package/dist/types-ts4.5/utils/index.d.ts +6 -0
- package/dist/types-ts4.5/utils/isRetina.d.ts +1 -0
- package/dist/types-ts4.5/utils/isValidPercentageUnit.d.ts +1 -0
- package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +12 -0
- package/dist/types-ts4.5/utils/lightCards/cardLoading.d.ts +5 -0
- package/dist/types-ts4.5/utils/lightCards/errorIcon/index.d.ts +12 -0
- package/dist/types-ts4.5/utils/lightCards/errorIcon/styles.d.ts +1 -0
- package/dist/types-ts4.5/utils/lightCards/getDimensionsWithDefault.d.ts +2 -0
- package/dist/types-ts4.5/utils/lightCards/lightCardWrappers.d.ts +4 -0
- package/dist/types-ts4.5/utils/lightCards/styles.d.ts +2 -0
- package/dist/types-ts4.5/utils/lightCards/types.d.ts +15 -0
- package/dist/types-ts4.5/utils/metadata.d.ts +2 -0
- package/dist/types-ts4.5/utils/mockIntersectionObserver.d.ts +20 -0
- package/dist/types-ts4.5/utils/objectURLCache.d.ts +12 -0
- package/dist/types-ts4.5/utils/preventClickThrough.d.ts +8 -0
- package/dist/types-ts4.5/utils/printScript.d.ts +2 -0
- package/dist/types-ts4.5/utils/ufoExperiences.d.ts +14 -0
- package/dist/types-ts4.5/utils/videoIsPlayable.d.ts +2 -0
- package/dist/types-ts4.5/utils/videoSnapshot.d.ts +1 -0
- package/dist/types-ts4.5/utils/viewportDetector.d.ts +6 -0
- package/package.json +5 -4
- package/tmp/api-report-tmp.d.ts +345 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
6
|
+
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
7
|
+
import { CustomMediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
8
|
+
import { defaultImageCardDimensions } from '../../utils';
|
|
9
|
+
import { CardLoading } from '../../utils/lightCards/cardLoading';
|
|
10
|
+
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
11
|
+
import { InlinePlayerWrapper } from '../inlinePlayerWrapper';
|
|
12
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
13
|
+
import { useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
14
|
+
export var getPreferredVideoArtifact = function getPreferredVideoArtifact(fileState) {
|
|
15
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
16
|
+
var artifacts = fileState.artifacts;
|
|
17
|
+
if (!artifacts) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return artifacts['video_1280.mp4'] ? 'video_1280.mp4' : artifacts['video_640.mp4'] ? 'video_640.mp4' : undefined;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
export var InlinePlayerBaseV2 = function InlinePlayerBaseV2(_ref) {
|
|
25
|
+
var identifier = _ref.identifier,
|
|
26
|
+
onError = _ref.onError,
|
|
27
|
+
onClick = _ref.onClick,
|
|
28
|
+
_ref$dimensions = _ref.dimensions,
|
|
29
|
+
dimensions = _ref$dimensions === void 0 ? defaultImageCardDimensions : _ref$dimensions,
|
|
30
|
+
originalDimensions = _ref.originalDimensions,
|
|
31
|
+
selected = _ref.selected,
|
|
32
|
+
testId = _ref.testId,
|
|
33
|
+
forwardRef = _ref.forwardRef,
|
|
34
|
+
autoplay = _ref.autoplay,
|
|
35
|
+
cardPreview = _ref.cardPreview,
|
|
36
|
+
onFullscreenChange = _ref.onFullscreenChange;
|
|
37
|
+
// === States ===
|
|
38
|
+
var _useState = useState(),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
fileSrc = _useState2[0],
|
|
41
|
+
setFileSrc = _useState2[1];
|
|
42
|
+
var _useState3 = useState(),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
isUploading = _useState4[0],
|
|
45
|
+
setIsUploading = _useState4[1];
|
|
46
|
+
var _useState5 = useState(),
|
|
47
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
|
+
progress = _useState6[0],
|
|
49
|
+
setProgress = _useState6[1];
|
|
50
|
+
|
|
51
|
+
// === Refs and Local Variables ===
|
|
52
|
+
var divRef = useRef(null);
|
|
53
|
+
var onErrorRef = useRef(onError);
|
|
54
|
+
onErrorRef.current = onError;
|
|
55
|
+
var id = identifier.id,
|
|
56
|
+
collectionName = identifier.collectionName,
|
|
57
|
+
occurrenceKey = identifier.occurrenceKey;
|
|
58
|
+
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
59
|
+
var mediaClient = useMediaClient();
|
|
60
|
+
var _useFileState = useFileState(id, {
|
|
61
|
+
collectionName: collectionName,
|
|
62
|
+
occurrenceKey: occurrenceKey
|
|
63
|
+
}),
|
|
64
|
+
fileState = _useFileState.fileState;
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
var subscribeFileState = /*#__PURE__*/function () {
|
|
67
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileState) {
|
|
68
|
+
var _yield$fileState$prev, value, newFileSrc, artifactName, artifacts, _newFileSrc, _newFileSrc2;
|
|
69
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
70
|
+
while (1) switch (_context.prev = _context.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (fileState.status === 'uploading') {
|
|
73
|
+
setIsUploading(true);
|
|
74
|
+
setProgress(fileState.progress);
|
|
75
|
+
} else {
|
|
76
|
+
setIsUploading(false);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// We reuse the existing fileSrc to prevent re renders, therefore we only perform fileSrc updates when there isn't any
|
|
80
|
+
if (!fileSrc) {
|
|
81
|
+
_context.next = 3;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return _context.abrupt("return");
|
|
85
|
+
case 3:
|
|
86
|
+
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
87
|
+
_context.next = 12;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
_context.next = 6;
|
|
91
|
+
return fileState.preview;
|
|
92
|
+
case 6:
|
|
93
|
+
_yield$fileState$prev = _context.sent;
|
|
94
|
+
value = _yield$fileState$prev.value;
|
|
95
|
+
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
96
|
+
_context.next = 12;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
newFileSrc = URL.createObjectURL(value);
|
|
100
|
+
setFileSrc(newFileSrc);
|
|
101
|
+
return _context.abrupt("return");
|
|
102
|
+
case 12:
|
|
103
|
+
if (!(fileState.status === 'processed' || fileState.status === 'processing')) {
|
|
104
|
+
_context.next = 37;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
artifactName = getPreferredVideoArtifact(fileState);
|
|
108
|
+
artifacts = fileState.artifacts;
|
|
109
|
+
if (!(!artifactName || !artifacts)) {
|
|
110
|
+
_context.next = 27;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
_context.prev = 16;
|
|
114
|
+
_context.next = 19;
|
|
115
|
+
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
116
|
+
case 19:
|
|
117
|
+
_newFileSrc = _context.sent;
|
|
118
|
+
setFileSrc(_newFileSrc);
|
|
119
|
+
_context.next = 26;
|
|
120
|
+
break;
|
|
121
|
+
case 23:
|
|
122
|
+
_context.prev = 23;
|
|
123
|
+
_context.t0 = _context["catch"](16);
|
|
124
|
+
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
125
|
+
onErrorRef.current(_context.t0);
|
|
126
|
+
}
|
|
127
|
+
case 26:
|
|
128
|
+
return _context.abrupt("return");
|
|
129
|
+
case 27:
|
|
130
|
+
_context.prev = 27;
|
|
131
|
+
_context.next = 30;
|
|
132
|
+
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
133
|
+
case 30:
|
|
134
|
+
_newFileSrc2 = _context.sent;
|
|
135
|
+
setFileSrc(_newFileSrc2);
|
|
136
|
+
_context.next = 37;
|
|
137
|
+
break;
|
|
138
|
+
case 34:
|
|
139
|
+
_context.prev = 34;
|
|
140
|
+
_context.t1 = _context["catch"](27);
|
|
141
|
+
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
142
|
+
onErrorRef.current(_context.t1);
|
|
143
|
+
}
|
|
144
|
+
case 37:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}, _callee, null, [[16, 23], [27, 34]]);
|
|
149
|
+
}));
|
|
150
|
+
return function subscribeFileState(_x) {
|
|
151
|
+
return _ref2.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
154
|
+
if (fileState) {
|
|
155
|
+
subscribeFileState(fileState);
|
|
156
|
+
}
|
|
157
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
158
|
+
useEffect(function () {
|
|
159
|
+
return function () {
|
|
160
|
+
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
161
|
+
};
|
|
162
|
+
}, [fileSrc]);
|
|
163
|
+
|
|
164
|
+
// === Render ===
|
|
165
|
+
return fileSrc ? /*#__PURE__*/React.createElement(InlinePlayerWrapper, {
|
|
166
|
+
testId: testId || 'media-card-inline-player',
|
|
167
|
+
selected: {
|
|
168
|
+
selected: selected
|
|
169
|
+
},
|
|
170
|
+
onClick: onClick,
|
|
171
|
+
innerRef: forwardRef || undefined,
|
|
172
|
+
dimensions: dimensions
|
|
173
|
+
}, /*#__PURE__*/React.createElement(InactivityDetector, null, function (checkMouseMovement) {
|
|
174
|
+
return /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
175
|
+
type: "video",
|
|
176
|
+
src: fileSrc,
|
|
177
|
+
onFullscreenChange: onFullscreenChange,
|
|
178
|
+
fileId: id,
|
|
179
|
+
isAutoPlay: autoplay,
|
|
180
|
+
isHDAvailable: false,
|
|
181
|
+
onDownloadClick: function onDownloadClick() {
|
|
182
|
+
mediaClient.file.downloadBinary(id, undefined, collectionName);
|
|
183
|
+
},
|
|
184
|
+
onFirstPlay: function onFirstPlay() {
|
|
185
|
+
globalMediaEventEmitter.emit('media-viewed', {
|
|
186
|
+
fileId: id,
|
|
187
|
+
viewingLevel: 'full'
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
lastWatchTimeConfig: {
|
|
191
|
+
contentId: id
|
|
192
|
+
},
|
|
193
|
+
originalDimensions: originalDimensions,
|
|
194
|
+
showControls: checkMouseMovement,
|
|
195
|
+
poster: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI
|
|
196
|
+
});
|
|
197
|
+
}), isUploading && /*#__PURE__*/React.createElement(ProgressBar, {
|
|
198
|
+
progress: progress,
|
|
199
|
+
breakpoint: breakpoint,
|
|
200
|
+
positionBottom: true,
|
|
201
|
+
showOnTop: true
|
|
202
|
+
})) : /*#__PURE__*/React.createElement(CardLoading, {
|
|
203
|
+
testId: testId,
|
|
204
|
+
dimensions: dimensions
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
var InlinePlayerForwardRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
208
|
+
return /*#__PURE__*/React.createElement(InlinePlayerBaseV2, _extends({}, props, {
|
|
209
|
+
forwardRef: ref
|
|
210
|
+
}));
|
|
211
|
+
});
|
|
212
|
+
export var InlinePlayerV2 = InlinePlayerForwardRef;
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "77.1
|
|
106
|
+
packageName: "77.2.1",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
7
7
|
import { MediaCardError } from '../errors';
|
|
8
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
9
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "77.1
|
|
10
|
+
var packageVersion = "77.2.1";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const InlinePlayerLazyV2: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("./inlinePlayerV2").InlinePlayerProps, "createAnalyticsEvent" | keyof import("./inlinePlayerV2").InlinePlayerOwnProps> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileIdentifier, FileState, MediaFileArtifacts } from '@atlaskit/media-client';
|
|
3
|
+
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
+
import { CardDimensions } from '../../types';
|
|
5
|
+
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
+
import type { CardPreview } from '../../types';
|
|
7
|
+
export interface InlinePlayerOwnProps {
|
|
8
|
+
identifier: FileIdentifier;
|
|
9
|
+
dimensions?: CardDimensions;
|
|
10
|
+
originalDimensions?: NumericalCardDimensions;
|
|
11
|
+
autoplay: boolean;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
14
|
+
onError?: (error: Error) => void;
|
|
15
|
+
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
16
|
+
testId?: string;
|
|
17
|
+
readonly cardPreview?: CardPreview;
|
|
18
|
+
readonly forwardRef?: React.Ref<HTMLDivElement>;
|
|
19
|
+
}
|
|
20
|
+
export type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
|
|
21
|
+
export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
|
|
22
|
+
export declare const InlinePlayerBaseV2: ({ identifier, onError, onClick, dimensions, originalDimensions, selected, testId, forwardRef, autoplay, cardPreview, onFullscreenChange, }: InlinePlayerProps) => JSX.Element;
|
|
23
|
+
export declare const InlinePlayerV2: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "createAnalyticsEvent" | keyof InlinePlayerOwnProps> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FileItem, FileDetails } from '@atlaskit/media-client';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface CardAction {
|
|
4
|
+
label?: string;
|
|
5
|
+
handler: CardEventHandler;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export type CardEventHandler = (item?: FileItem, event?: Event) => void;
|
|
9
|
+
export declare function attachDetailsToActions(actions: Array<CardAction>, details: FileDetails): Array<CardAction>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
import { FileIdentifier, FileState, MediaSubscription } from '@atlaskit/media-client';
|
|
4
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import { CardAction } from './actions';
|
|
6
|
+
import { CardProps, CardState, CardStatus } from '../types';
|
|
7
|
+
export type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
8
|
+
export declare class CardBase extends Component<CardBaseProps, CardState> {
|
|
9
|
+
private internalOccurrenceKey;
|
|
10
|
+
private hasBeenMounted;
|
|
11
|
+
private fileStateFlags;
|
|
12
|
+
private ssrReliability;
|
|
13
|
+
private timeElapsedTillCommenced;
|
|
14
|
+
subscription?: MediaSubscription;
|
|
15
|
+
private ssrData?;
|
|
16
|
+
private traceContext;
|
|
17
|
+
static defaultProps: Partial<CardProps>;
|
|
18
|
+
constructor(props: CardBaseProps);
|
|
19
|
+
private getSSRPreview;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
22
|
+
componentWillUnmount(): void;
|
|
23
|
+
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
24
|
+
private getImageURLParams;
|
|
25
|
+
private getMediaBlobUrlAttrs;
|
|
26
|
+
private getCardPreviewParams;
|
|
27
|
+
private setCacheSSRPreview;
|
|
28
|
+
private refetchSSRPreview;
|
|
29
|
+
private resolveUpfrontPreview;
|
|
30
|
+
private fetchAndCacheRemotePreview;
|
|
31
|
+
private resolvePreview;
|
|
32
|
+
updateFileStateFlag(fileState?: FileState): void;
|
|
33
|
+
subscribeInternalFile(identifier: FileIdentifier): void;
|
|
34
|
+
private get requestedDimensions();
|
|
35
|
+
private get metadata();
|
|
36
|
+
private get fileAttributes();
|
|
37
|
+
private getPerformanceAttributes;
|
|
38
|
+
private logSSRImageError;
|
|
39
|
+
private onImageError;
|
|
40
|
+
private onImageLoad;
|
|
41
|
+
private fireOperationalEvent;
|
|
42
|
+
private fireAbortedEvent;
|
|
43
|
+
private fireCommencedEvent;
|
|
44
|
+
private fireCopiedEvent;
|
|
45
|
+
private fireScreenEvent;
|
|
46
|
+
private fireNonCriticalErrorEvent;
|
|
47
|
+
private safeSetState;
|
|
48
|
+
unsubscribe: () => void;
|
|
49
|
+
get actions(): CardAction[];
|
|
50
|
+
onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
51
|
+
onInlinePlayerError: () => void;
|
|
52
|
+
setRef: (cardRef: HTMLDivElement | null) => void;
|
|
53
|
+
renderInlinePlayer: () => JSX.Element;
|
|
54
|
+
onMediaViewerClose: () => void;
|
|
55
|
+
private onDisplayImage;
|
|
56
|
+
renderMediaViewer: () => React.ReactPortal | undefined;
|
|
57
|
+
renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
|
|
58
|
+
private storeSSRData;
|
|
59
|
+
render(): JSX.Element;
|
|
60
|
+
private onCardInViewport;
|
|
61
|
+
onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
62
|
+
onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
63
|
+
}
|
|
64
|
+
export declare const Card: React.ComponentType<CardBaseProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileAttributes, MediaTraceContext, PerformanceAttributes } from '@atlaskit/media-common';
|
|
2
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { SSRStatus } from '../utils/analytics';
|
|
4
|
+
import { CardStatus } from '../types';
|
|
5
|
+
import { MediaCardError } from '../errors';
|
|
6
|
+
export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, error: MediaCardError | undefined, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => void;
|
|
7
|
+
export declare const fireCommencedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, traceContext: MediaTraceContext) => void;
|
|
8
|
+
export declare const fireCopiedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileId: string, cardRef: HTMLDivElement) => void;
|
|
9
|
+
export declare const fireScreenEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes) => void;
|
|
10
|
+
export declare const fireNonCriticalErrorEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, cardStatus: CardStatus, fileAttributes: FileAttributes, ssrReliability: SSRStatus, error: MediaCardError | undefined, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const newFileExperienceClassName = "new-file-experience-wrapper";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
3
|
+
import type { CardBaseProps } from './card';
|
|
4
|
+
export type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardBaseProps>;
|
|
5
|
+
declare const CardLoader: React.FC<CardWithMediaClientConfigProps>;
|
|
6
|
+
export default CardLoader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FileState } from '@atlaskit/media-client';
|
|
2
|
+
import { CardState } from '../types';
|
|
3
|
+
import { MediaCardError } from '../errors';
|
|
4
|
+
/**
|
|
5
|
+
* From docs: "Both state and props received by the updater function are guaranteed to be up-to-date.
|
|
6
|
+
* The output of the updater is shallowly merged with state."
|
|
7
|
+
*/
|
|
8
|
+
export declare const createStateUpdater: (newState: Partial<CardState>, fireErrorEvent: (error: MediaCardError) => void) => (prevState: CardState) => Partial<CardState>;
|
|
9
|
+
export declare const getCardStateFromFileState: (fileState: FileState, isBannedLocalPreview: boolean) => Partial<CardState>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React, { MouseEvent } from 'react';
|
|
4
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
5
|
+
import { MediaItemType, FileDetails } from '@atlaskit/media-client';
|
|
6
|
+
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
+
import { SharedCardProps, CardStatus } from '../types';
|
|
8
|
+
import { MediaCardError } from '../errors';
|
|
9
|
+
import { CardPreview } from '../types';
|
|
10
|
+
import { MediaCardCursor } from '../types';
|
|
11
|
+
export interface CardViewOwnProps extends SharedCardProps {
|
|
12
|
+
readonly status: CardStatus;
|
|
13
|
+
readonly mediaItemType: MediaItemType;
|
|
14
|
+
readonly mediaCardCursor?: MediaCardCursor;
|
|
15
|
+
readonly metadata?: FileDetails;
|
|
16
|
+
readonly error?: MediaCardError;
|
|
17
|
+
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
18
|
+
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
19
|
+
readonly onDisplayImage?: () => void;
|
|
20
|
+
readonly cardPreview?: CardPreview;
|
|
21
|
+
readonly progress?: number;
|
|
22
|
+
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
23
|
+
readonly onImageLoad: (cardPreview: CardPreview) => void;
|
|
24
|
+
readonly onImageError: (cardPreview: CardPreview) => void;
|
|
25
|
+
readonly nativeLazyLoad?: boolean;
|
|
26
|
+
readonly forceSyncDisplay?: boolean;
|
|
27
|
+
disableAnimation?: boolean;
|
|
28
|
+
shouldHideTooltip?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface CardViewState {
|
|
31
|
+
elementWidth?: number;
|
|
32
|
+
didImageRender: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
|
|
35
|
+
export interface RenderConfigByStatus {
|
|
36
|
+
renderTypeIcon?: boolean;
|
|
37
|
+
iconMessage?: JSX.Element;
|
|
38
|
+
renderImageRenderer?: boolean;
|
|
39
|
+
renderPlayButton?: boolean;
|
|
40
|
+
renderTitleBox?: boolean;
|
|
41
|
+
renderBlanket?: boolean;
|
|
42
|
+
isFixedBlanket?: boolean;
|
|
43
|
+
renderProgressBar?: boolean;
|
|
44
|
+
renderSpinner?: boolean;
|
|
45
|
+
renderFailedTitleBox?: boolean;
|
|
46
|
+
renderTickBox?: boolean;
|
|
47
|
+
customTitleMessage?: MessageDescriptor;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* This is classic vanilla CardView class. To create an instance of class one would need to supply
|
|
51
|
+
* `createAnalyticsEvent` prop to satisfy it's Analytics Events needs.
|
|
52
|
+
*/
|
|
53
|
+
export declare class CardViewBase extends React.Component<CardViewProps, CardViewState> {
|
|
54
|
+
state: CardViewState;
|
|
55
|
+
divRef: React.RefObject<HTMLDivElement>;
|
|
56
|
+
static defaultProps: Partial<CardViewOwnProps>;
|
|
57
|
+
componentDidMount(): void;
|
|
58
|
+
componentDidUpdate({ cardPreview: prevCardPreview }: CardViewProps): void;
|
|
59
|
+
private onImageLoad;
|
|
60
|
+
private onImageError;
|
|
61
|
+
private get breakpoint();
|
|
62
|
+
private saveElementWidth;
|
|
63
|
+
private renderSpinner;
|
|
64
|
+
private shouldRenderPlayButton;
|
|
65
|
+
private renderPlayButton;
|
|
66
|
+
private renderBlanket;
|
|
67
|
+
private renderTitleBox;
|
|
68
|
+
private renderFailedTitleBox;
|
|
69
|
+
private renderProgressBar;
|
|
70
|
+
private renderImageRenderer;
|
|
71
|
+
private renderTickBox;
|
|
72
|
+
private renderMediaTypeIcon;
|
|
73
|
+
private renderActionsBar;
|
|
74
|
+
render(): jsx.JSX.Element;
|
|
75
|
+
private getRenderConfigByStatus;
|
|
76
|
+
private renderContents;
|
|
77
|
+
}
|
|
78
|
+
export declare const CardView: React.ForwardRefExoticComponent<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, keyof CardViewOwnProps>> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ImageResizeMode } from '@atlaskit/media-client';
|
|
2
|
+
import { ObjectURLCache } from '../../utils/objectURLCache';
|
|
3
|
+
import { CardPreview } from '../../types';
|
|
4
|
+
type Mode = ImageResizeMode | undefined;
|
|
5
|
+
export declare const getCacheKey: (id: string, mode: Mode) => string;
|
|
6
|
+
export interface CardPreviewCache {
|
|
7
|
+
get(id: string, mode: Mode): CardPreview | undefined;
|
|
8
|
+
set(id: string, mode: Mode, cardPreview: CardPreview): void;
|
|
9
|
+
remove(id: string, mode: Mode): void;
|
|
10
|
+
clear(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class CardPreviewCacheImpl implements CardPreviewCache {
|
|
13
|
+
private previewCache;
|
|
14
|
+
constructor(previewCache: ObjectURLCache);
|
|
15
|
+
get: (id: string, mode: Mode) => CardPreview | undefined;
|
|
16
|
+
set: (id: string, mode: Mode, cardPreview: CardPreview) => void;
|
|
17
|
+
remove: (id: string, mode: Mode) => void;
|
|
18
|
+
clear: () => void;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: CardPreviewCacheImpl;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CardStatus, FilePreviewStatus } from '../../types';
|
|
2
|
+
import { FileState } from '@atlaskit/media-client';
|
|
3
|
+
export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean) => FilePreviewStatus;
|
|
4
|
+
export declare const isPreviewableStatus: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MediaClient, FilePreview, MediaStoreGetFileImageParams, MediaType } from '@atlaskit/media-client';
|
|
2
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { CardPreview } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* This method tells the support for the media
|
|
6
|
+
* types covered in getCardPreviewFromFilePreview
|
|
7
|
+
*/
|
|
8
|
+
export declare const isSupportedLocalPreview: (mediaType?: MediaType) => boolean;
|
|
9
|
+
export declare const getCardPreviewFromFilePreview: (filePreview: FilePreview | Promise<FilePreview>) => Promise<CardPreview>;
|
|
10
|
+
export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<CardPreview>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
2
|
+
import { SSR, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { ImageResizeMode } from '@atlaskit/media-client';
|
|
4
|
+
import { CardDimensions } from '../../types';
|
|
5
|
+
import { MediaCardError } from '../../errors';
|
|
6
|
+
import { CardStatus, CardPreview } from '../../types';
|
|
7
|
+
export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview, } from './helpers';
|
|
8
|
+
export { extractFilePreviewStatus } from './filePreviewStatus';
|
|
9
|
+
export declare const getCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => CardPreview | undefined;
|
|
10
|
+
export declare const removeCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Will return the preview if available and supported by the browser
|
|
13
|
+
* See extractFilePreviewStatus "hasLocalPreview" logic
|
|
14
|
+
*/
|
|
15
|
+
export declare const getFilePreviewFromFileState: (fileState: FileState) => FilePreview | Promise<FilePreview> | undefined;
|
|
16
|
+
export type CardPreviewParams = {
|
|
17
|
+
mediaClient: MediaClient;
|
|
18
|
+
id: string;
|
|
19
|
+
dimensions?: CardDimensions;
|
|
20
|
+
filePreview?: FilePreview | Promise<FilePreview>;
|
|
21
|
+
onLocalPreviewError: (error: MediaCardError) => void;
|
|
22
|
+
isRemotePreviewReady: boolean;
|
|
23
|
+
imageUrlParams: MediaStoreGetFileImageParams;
|
|
24
|
+
mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
|
|
25
|
+
traceContext?: MediaTraceContext;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* This function will try to return a Card preview, either from cache, local preview or remote preview.
|
|
29
|
+
* It should only be called if there is a chance to get either a remote or a local preview, or both.
|
|
30
|
+
* This, in order to ensure there is always going to be a valid return value OR throw an error if the process fails.
|
|
31
|
+
* It is worth noting that local preview failures break the process if there is no remote preview available.
|
|
32
|
+
* In that case we throw an error immediately.
|
|
33
|
+
* Otherwise, if the local preview fails but there is a remote preview available, the failure does not break the process.
|
|
34
|
+
* In that case, we still want to report the local preview error to the caller, for feature realiability track.
|
|
35
|
+
* hence the use of the optional callback onLocalPreviewError
|
|
36
|
+
*/
|
|
37
|
+
export declare const getCardPreview: ({ mediaClient, id, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, traceContext, }: CardPreviewParams) => Promise<CardPreview>;
|
|
38
|
+
export declare const shouldResolvePreview: ({ status, fileState, prevDimensions, dimensions, hasCardPreview, isBannedLocalPreview, wasResolvedUpfrontPreview, }: {
|
|
39
|
+
status: CardStatus;
|
|
40
|
+
fileState: FileState;
|
|
41
|
+
prevDimensions?: CardDimensions | undefined;
|
|
42
|
+
dimensions?: CardDimensions | undefined;
|
|
43
|
+
hasCardPreview: boolean;
|
|
44
|
+
isBannedLocalPreview: boolean;
|
|
45
|
+
wasResolvedUpfrontPreview: boolean;
|
|
46
|
+
}) => boolean;
|
|
47
|
+
export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs) => CardPreview;
|
|
48
|
+
export declare const isLocalPreview: (preview: CardPreview) => boolean;
|
|
49
|
+
export declare const isSSRPreview: (preview: CardPreview) => boolean;
|
|
50
|
+
export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
|
|
51
|
+
export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
|
|
52
|
+
export declare const isSSRDataPreview: (preview: CardPreview) => boolean;
|
|
53
|
+
export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs, traceContext?: MediaTraceContext) => Promise<CardPreview>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FileStatus } from '@atlaskit/media-client';
|
|
2
|
+
import { CardStatus, FilePreviewStatus } from '../types';
|
|
3
|
+
export declare const isFinalCardStatus: (status: CardStatus) => boolean;
|
|
4
|
+
export declare const getCardStatus: (fileStatus: FileStatus, { isPreviewable, hasPreview }: FilePreviewStatus) => CardStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Card } from './cardSwitcher';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { MediaClient, FileIdentifier, FileState, MediaFileArtifacts, MediaSubscription } from '@atlaskit/media-client';
|
|
4
|
+
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
5
|
+
import { CardDimensions } from '../types';
|
|
6
|
+
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
+
import type { CardPreview } from '../types';
|
|
8
|
+
export interface InlinePlayerOwnProps {
|
|
9
|
+
identifier: FileIdentifier;
|
|
10
|
+
mediaClient: MediaClient;
|
|
11
|
+
dimensions?: CardDimensions;
|
|
12
|
+
originalDimensions?: NumericalCardDimensions;
|
|
13
|
+
autoplay: boolean;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
18
|
+
testId?: string;
|
|
19
|
+
readonly cardPreview?: CardPreview;
|
|
20
|
+
readonly forwardRef?: React.Ref<HTMLDivElement>;
|
|
21
|
+
}
|
|
22
|
+
export type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
|
|
23
|
+
export interface InlinePlayerState {
|
|
24
|
+
fileSrc?: string;
|
|
25
|
+
isUploading?: boolean;
|
|
26
|
+
progress?: number;
|
|
27
|
+
elementWidth?: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
|
|
30
|
+
export declare class InlinePlayerBase extends Component<InlinePlayerProps, InlinePlayerState> {
|
|
31
|
+
subscription?: MediaSubscription;
|
|
32
|
+
state: InlinePlayerState;
|
|
33
|
+
divRef: React.RefObject<HTMLDivElement>;
|
|
34
|
+
static defaultProps: {
|
|
35
|
+
dimensions: {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
componentDidMount(): void;
|
|
41
|
+
setFileSrc: (fileSrc: string) => void;
|
|
42
|
+
setBinaryURL: () => Promise<void>;
|
|
43
|
+
unsubscribe: () => void;
|
|
44
|
+
revoke: () => void;
|
|
45
|
+
componentWillUnmount(): void;
|
|
46
|
+
onDownloadClick: () => void;
|
|
47
|
+
onFirstPlay: () => void;
|
|
48
|
+
private get breakpoint();
|
|
49
|
+
saveElementWidth: () => void;
|
|
50
|
+
render(): JSX.Element;
|
|
51
|
+
}
|
|
52
|
+
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "createAnalyticsEvent" | keyof InlinePlayerOwnProps> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const InlinePlayerLazy: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("./inlinePlayer").InlinePlayerProps, "createAnalyticsEvent" | keyof import("./inlinePlayer").InlinePlayerOwnProps> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InlinePlayerWrapperProps } from './types';
|
|
2
|
+
export declare const inlinePlayerClassName = "media-card-inline-player";
|
|
3
|
+
export declare const inlinePlayerWrapperStyles: {
|
|
4
|
+
({ dimensions, selected, }: InlinePlayerWrapperProps): import("@emotion/react").SerializedStyles;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|