@atlaskit/media-card 77.7.0 → 77.7.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 +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/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/cardViewV2.js +2 -1
- package/dist/cjs/card/v2/fileCard.js +13 -20
- 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/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/cardViewV2.js +2 -1
- package/dist/es2019/card/v2/fileCard.js +5 -9
- 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/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/cardViewV2.js +2 -1
- package/dist/esm/card/v2/fileCard.js +15 -22
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#65817](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65817) [`3be0ec786219`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3be0ec786219) - Added data test preview source
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 77.7.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#67886](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67886) [`18c0c2f52a54`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18c0c2f52a54) - CXP-2880 remove isBannedLocalPreview state from fileCard
|
|
15
|
+
|
|
3
16
|
## 77.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -50,7 +50,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
50
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
51
51
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
52
52
|
var packageName = "@atlaskit/media-card";
|
|
53
|
-
var packageVersion = "77.7.
|
|
53
|
+
var packageVersion = "77.7.2";
|
|
54
54
|
var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
|
|
55
55
|
(0, _inherits2.default)(CardBase, _Component);
|
|
56
56
|
var _super = _createSuper(CardBase);
|
|
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
90
90
|
}(_react.default.Component);
|
|
91
91
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "77.7.
|
|
93
|
+
var packageVersion = "77.7.2";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
|
|
|
16
16
|
var _fileCard = require("./fileCard");
|
|
17
17
|
var _excluded = ["identifier"];
|
|
18
18
|
var packageName = "@atlaskit/media-card";
|
|
19
|
-
var packageVersion = "77.7.
|
|
19
|
+
var packageVersion = "77.7.2";
|
|
20
20
|
var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -212,7 +212,8 @@ var CardViewV2Base = exports.CardViewV2Base = function CardViewV2Base(_ref) {
|
|
|
212
212
|
"data-test-media-name": name,
|
|
213
213
|
"data-test-status": status,
|
|
214
214
|
"data-test-progress": progress,
|
|
215
|
-
"data-test-selected": selected
|
|
215
|
+
"data-test-selected": selected,
|
|
216
|
+
"data-test-source": cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
216
217
|
}, renderTypeIcon && (0, _react.jsx)(_iconWrapper.IconWrapper, {
|
|
217
218
|
breakpoint: breakpoint,
|
|
218
219
|
hasTitleBox: hasTitleBox
|
|
@@ -26,7 +26,6 @@ var _metadata = require("../../utils/metadata");
|
|
|
26
26
|
var _ufoExperiences = require("../../utils/ufoExperiences");
|
|
27
27
|
var _useCurrentValueRef = require("../../utils/useCurrentValueRef");
|
|
28
28
|
var _usePrevious = require("../../utils/usePrevious");
|
|
29
|
-
var _videoIsPlayable = require("../../utils/videoIsPlayable");
|
|
30
29
|
var _viewportDetector = require("../../utils/viewportDetector");
|
|
31
30
|
var _cardDimensions = require("../../utils/cardDimensions");
|
|
32
31
|
var _cardAnalytics = require("../cardAnalytics");
|
|
@@ -150,12 +149,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
150
149
|
// CXP-2723 TODO: remove isBannedLocalPreview
|
|
151
150
|
var _useState11 = (0, _react.useState)(false),
|
|
152
151
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var _useState13 = (0, _react.useState)(false),
|
|
156
|
-
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
157
|
-
previewDidRender = _useState14[0],
|
|
158
|
-
setPreviewDidRender = _useState14[1];
|
|
152
|
+
previewDidRender = _useState12[0],
|
|
153
|
+
setPreviewDidRender = _useState12[1];
|
|
159
154
|
|
|
160
155
|
// CXP-2723 TODO: Do we have tests to validate the use of the below attributes
|
|
161
156
|
var mediaBlobUrlAttrs = (0, _react.useMemo)(function () {
|
|
@@ -183,7 +178,6 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
183
178
|
ssr: ssr,
|
|
184
179
|
dimensions: previewDimensions,
|
|
185
180
|
traceContext: traceContext,
|
|
186
|
-
previewDidRender: previewDidRender,
|
|
187
181
|
skipRemote: !isCardVisible
|
|
188
182
|
}),
|
|
189
183
|
preview = _useFilePreview.preview,
|
|
@@ -193,18 +187,18 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
193
187
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
194
188
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
195
189
|
getScriptProps = _useFilePreview.getScriptProps;
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
error =
|
|
199
|
-
setError =
|
|
190
|
+
var _useState13 = (0, _react.useState)(),
|
|
191
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
192
|
+
error = _useState14[0],
|
|
193
|
+
setError = _useState14[1];
|
|
200
194
|
|
|
201
195
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
202
196
|
var finalError = error || previewError;
|
|
203
197
|
var finalStatus = finalError ? 'error' : status;
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
mediaViewerSelectedItem =
|
|
207
|
-
setMediaViewerSelectedItem =
|
|
198
|
+
var _useState15 = (0, _react.useState)(null),
|
|
199
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
200
|
+
mediaViewerSelectedItem = _useState16[0],
|
|
201
|
+
setMediaViewerSelectedItem = _useState16[1];
|
|
208
202
|
var uploadProgressRef = (0, _react.useRef)();
|
|
209
203
|
var metadata = (0, _react.useMemo)(function () {
|
|
210
204
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
@@ -407,7 +401,6 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
407
401
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
408
402
|
setStatus('complete');
|
|
409
403
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
410
|
-
setIsBannedLocalPreview(false);
|
|
411
404
|
}
|
|
412
405
|
}, [previewDidRender, finalStatus]);
|
|
413
406
|
|
|
@@ -419,7 +412,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
419
412
|
var isVideo = fileAttributes.fileMediatype === 'video';
|
|
420
413
|
var _getFileDetails2 = (0, _metadata.getFileDetails)(identifier, fileStateValue),
|
|
421
414
|
mimeType = _getFileDetails2.mimeType;
|
|
422
|
-
var isVideoPlayable = (0,
|
|
415
|
+
var isVideoPlayable = mimeType && (0, _mediaCommon.isVideoMimeTypeSupportedByBrowser)(mimeType) || fileStateValue && (0, _mediaClient.isProcessedFileState)(fileStateValue);
|
|
423
416
|
if (
|
|
424
417
|
/**
|
|
425
418
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -429,7 +422,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
429
422
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
430
423
|
setIsPlayingFile(true);
|
|
431
424
|
}
|
|
432
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
425
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
433
426
|
|
|
434
427
|
//----------------------------------------------------------------//
|
|
435
428
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -469,7 +462,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
469
462
|
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
470
463
|
var isPreviewableFileState = !!fileState.preview;
|
|
471
464
|
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
472
|
-
var hasLocalPreview =
|
|
465
|
+
var hasLocalPreview = isPreviewableFileState &&
|
|
473
466
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
474
467
|
isSupportedLocalPreview && !!fileState.mimeType && (0, _mediaCommon.isMimeTypeSupportedByBrowser)(fileState.mimeType);
|
|
475
468
|
var hasRemotePreview = (0, _mediaClient.isImageRepresentationReady)(fileState);
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "77.7.
|
|
122
|
+
packageName: "77.7.2",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "77.7.
|
|
17
|
+
var packageVersion = "77.7.2";
|
|
18
18
|
var concurrentExperience;
|
|
19
19
|
var getExperience = function getExperience(id) {
|
|
20
20
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -28,7 +28,7 @@ import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '.
|
|
|
28
28
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
29
29
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
30
30
|
const packageName = "@atlaskit/media-card";
|
|
31
|
-
const packageVersion = "77.7.
|
|
31
|
+
const packageVersion = "77.7.2";
|
|
32
32
|
export class CardBase extends Component {
|
|
33
33
|
constructor(props) {
|
|
34
34
|
super(props);
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "77.7.
|
|
69
|
+
const packageVersion = "77.7.2";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { ExternalImageCard } from './externalImageCard';
|
|
8
8
|
import { FileCard } from './fileCard';
|
|
9
9
|
const packageName = "@atlaskit/media-card";
|
|
10
|
-
const packageVersion = "77.7.
|
|
10
|
+
const packageVersion = "77.7.2";
|
|
11
11
|
export const CardV2Base = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -208,7 +208,8 @@ export const CardViewV2Base = ({
|
|
|
208
208
|
"data-test-media-name": name,
|
|
209
209
|
"data-test-status": status,
|
|
210
210
|
"data-test-progress": progress,
|
|
211
|
-
"data-test-selected": selected
|
|
211
|
+
"data-test-selected": selected,
|
|
212
|
+
"data-test-source": cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
212
213
|
}, renderTypeIcon && jsx(IconWrapper, {
|
|
213
214
|
breakpoint: breakpoint,
|
|
214
215
|
hasTitleBox: hasTitleBox
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
3
|
-
import { globalMediaEventEmitter, isImageRepresentationReady, RECENTS_COLLECTION, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
|
|
3
|
+
import { globalMediaEventEmitter, isImageRepresentationReady, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState } from '@atlaskit/media-client';
|
|
4
4
|
import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
5
|
-
import { getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
5
|
+
import { getRandomHex, isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
7
|
import React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
@@ -15,7 +15,6 @@ import { getFileDetails } from '../../utils/metadata';
|
|
|
15
15
|
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '../../utils/ufoExperiences';
|
|
16
16
|
import { useCurrentValueRef } from '../../utils/useCurrentValueRef';
|
|
17
17
|
import { usePrevious } from '../../utils/usePrevious';
|
|
18
|
-
import { videoIsPlayable } from '../../utils/videoIsPlayable';
|
|
19
18
|
import { ViewportDetector } from '../../utils/viewportDetector';
|
|
20
19
|
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
21
20
|
import { fireCommencedEvent, fireCopiedEvent, fireNonCriticalErrorEvent, fireOperationalEvent, fireScreenEvent } from '../cardAnalytics';
|
|
@@ -107,7 +106,6 @@ export const FileCard = ({
|
|
|
107
106
|
const [shouldAutoplay, setShouldAutoplay] = useState(false);
|
|
108
107
|
|
|
109
108
|
// CXP-2723 TODO: remove isBannedLocalPreview
|
|
110
|
-
const [isBannedLocalPreview, setIsBannedLocalPreview] = useState(false);
|
|
111
109
|
const [previewDidRender, setPreviewDidRender] = useState(false);
|
|
112
110
|
|
|
113
111
|
// CXP-2723 TODO: Do we have tests to validate the use of the below attributes
|
|
@@ -147,7 +145,6 @@ export const FileCard = ({
|
|
|
147
145
|
ssr,
|
|
148
146
|
dimensions: previewDimensions,
|
|
149
147
|
traceContext,
|
|
150
|
-
previewDidRender,
|
|
151
148
|
skipRemote: !isCardVisible
|
|
152
149
|
});
|
|
153
150
|
const [error, setError] = useState();
|
|
@@ -356,7 +353,6 @@ export const FileCard = ({
|
|
|
356
353
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
357
354
|
setStatus('complete');
|
|
358
355
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
359
|
-
setIsBannedLocalPreview(false);
|
|
360
356
|
}
|
|
361
357
|
}, [previewDidRender, finalStatus]);
|
|
362
358
|
|
|
@@ -369,7 +365,7 @@ export const FileCard = ({
|
|
|
369
365
|
const {
|
|
370
366
|
mimeType
|
|
371
367
|
} = getFileDetails(identifier, fileStateValue);
|
|
372
|
-
const isVideoPlayable =
|
|
368
|
+
const isVideoPlayable = mimeType && isVideoMimeTypeSupportedByBrowser(mimeType) || fileStateValue && isProcessedFileState(fileStateValue);
|
|
373
369
|
if (
|
|
374
370
|
/**
|
|
375
371
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -379,7 +375,7 @@ export const FileCard = ({
|
|
|
379
375
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
380
376
|
setIsPlayingFile(true);
|
|
381
377
|
}
|
|
382
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
378
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
383
379
|
|
|
384
380
|
//----------------------------------------------------------------//
|
|
385
381
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -419,7 +415,7 @@ export const FileCard = ({
|
|
|
419
415
|
const isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
420
416
|
const isPreviewableFileState = !!fileState.preview;
|
|
421
417
|
const isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
422
|
-
const hasLocalPreview =
|
|
418
|
+
const hasLocalPreview = isPreviewableFileState &&
|
|
423
419
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
424
420
|
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
425
421
|
const hasRemotePreview = isImageRepresentationReady(fileState);
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "77.7.
|
|
40
|
+
packageName: "77.7.2",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
4
4
|
import { MediaCardError } from '../errors';
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
const packageName = "@atlaskit/media-card";
|
|
7
|
-
const packageVersion = "77.7.
|
|
7
|
+
const packageVersion = "77.7.2";
|
|
8
8
|
let concurrentExperience;
|
|
9
9
|
const getExperience = id => {
|
|
10
10
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -41,7 +41,7 @@ import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '.
|
|
|
41
41
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
42
42
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
43
43
|
var packageName = "@atlaskit/media-card";
|
|
44
|
-
var packageVersion = "77.7.
|
|
44
|
+
var packageVersion = "77.7.2";
|
|
45
45
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
46
46
|
_inherits(CardBase, _Component);
|
|
47
47
|
var _super = _createSuper(CardBase);
|
|
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
83
83
|
}(React.Component);
|
|
84
84
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
85
85
|
var packageName = "@atlaskit/media-card";
|
|
86
|
-
var packageVersion = "77.7.
|
|
86
|
+
var packageVersion = "77.7.2";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { ExternalImageCard } from './externalImageCard';
|
|
10
10
|
import { FileCard } from './fileCard';
|
|
11
11
|
var packageName = "@atlaskit/media-card";
|
|
12
|
-
var packageVersion = "77.7.
|
|
12
|
+
var packageVersion = "77.7.2";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -203,7 +203,8 @@ export var CardViewV2Base = function CardViewV2Base(_ref) {
|
|
|
203
203
|
"data-test-media-name": name,
|
|
204
204
|
"data-test-status": status,
|
|
205
205
|
"data-test-progress": progress,
|
|
206
|
-
"data-test-selected": selected
|
|
206
|
+
"data-test-selected": selected,
|
|
207
|
+
"data-test-source": cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
207
208
|
}, renderTypeIcon && jsx(IconWrapper, {
|
|
208
209
|
breakpoint: breakpoint,
|
|
209
210
|
hasTitleBox: hasTitleBox
|
|
@@ -5,9 +5,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
8
|
-
import { globalMediaEventEmitter, isImageRepresentationReady, RECENTS_COLLECTION, imageResizeModeToFileImageMode } from '@atlaskit/media-client';
|
|
8
|
+
import { globalMediaEventEmitter, isImageRepresentationReady, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState } from '@atlaskit/media-client';
|
|
9
9
|
import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
10
|
-
import { getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
10
|
+
import { getRandomHex, isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
11
11
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
12
12
|
import React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import ReactDOM from 'react-dom';
|
|
@@ -20,7 +20,6 @@ import { getFileDetails } from '../../utils/metadata';
|
|
|
20
20
|
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '../../utils/ufoExperiences';
|
|
21
21
|
import { useCurrentValueRef } from '../../utils/useCurrentValueRef';
|
|
22
22
|
import { usePrevious } from '../../utils/usePrevious';
|
|
23
|
-
import { videoIsPlayable } from '../../utils/videoIsPlayable';
|
|
24
23
|
import { ViewportDetector } from '../../utils/viewportDetector';
|
|
25
24
|
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
26
25
|
import { fireCommencedEvent, fireCopiedEvent, fireNonCriticalErrorEvent, fireOperationalEvent, fireScreenEvent } from '../cardAnalytics';
|
|
@@ -140,12 +139,8 @@ export var FileCard = function FileCard(_ref) {
|
|
|
140
139
|
// CXP-2723 TODO: remove isBannedLocalPreview
|
|
141
140
|
var _useState11 = useState(false),
|
|
142
141
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var _useState13 = useState(false),
|
|
146
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
147
|
-
previewDidRender = _useState14[0],
|
|
148
|
-
setPreviewDidRender = _useState14[1];
|
|
142
|
+
previewDidRender = _useState12[0],
|
|
143
|
+
setPreviewDidRender = _useState12[1];
|
|
149
144
|
|
|
150
145
|
// CXP-2723 TODO: Do we have tests to validate the use of the below attributes
|
|
151
146
|
var mediaBlobUrlAttrs = useMemo(function () {
|
|
@@ -173,7 +168,6 @@ export var FileCard = function FileCard(_ref) {
|
|
|
173
168
|
ssr: ssr,
|
|
174
169
|
dimensions: previewDimensions,
|
|
175
170
|
traceContext: traceContext,
|
|
176
|
-
previewDidRender: previewDidRender,
|
|
177
171
|
skipRemote: !isCardVisible
|
|
178
172
|
}),
|
|
179
173
|
preview = _useFilePreview.preview,
|
|
@@ -183,18 +177,18 @@ export var FileCard = function FileCard(_ref) {
|
|
|
183
177
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
184
178
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
185
179
|
getScriptProps = _useFilePreview.getScriptProps;
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
error =
|
|
189
|
-
setError =
|
|
180
|
+
var _useState13 = useState(),
|
|
181
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
182
|
+
error = _useState14[0],
|
|
183
|
+
setError = _useState14[1];
|
|
190
184
|
|
|
191
185
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
192
186
|
var finalError = error || previewError;
|
|
193
187
|
var finalStatus = finalError ? 'error' : status;
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
mediaViewerSelectedItem =
|
|
197
|
-
setMediaViewerSelectedItem =
|
|
188
|
+
var _useState15 = useState(null),
|
|
189
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
190
|
+
mediaViewerSelectedItem = _useState16[0],
|
|
191
|
+
setMediaViewerSelectedItem = _useState16[1];
|
|
198
192
|
var uploadProgressRef = useRef();
|
|
199
193
|
var metadata = useMemo(function () {
|
|
200
194
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
@@ -397,7 +391,6 @@ export var FileCard = function FileCard(_ref) {
|
|
|
397
391
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
398
392
|
setStatus('complete');
|
|
399
393
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
400
|
-
setIsBannedLocalPreview(false);
|
|
401
394
|
}
|
|
402
395
|
}, [previewDidRender, finalStatus]);
|
|
403
396
|
|
|
@@ -409,7 +402,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
409
402
|
var isVideo = fileAttributes.fileMediatype === 'video';
|
|
410
403
|
var _getFileDetails2 = getFileDetails(identifier, fileStateValue),
|
|
411
404
|
mimeType = _getFileDetails2.mimeType;
|
|
412
|
-
var isVideoPlayable =
|
|
405
|
+
var isVideoPlayable = mimeType && isVideoMimeTypeSupportedByBrowser(mimeType) || fileStateValue && isProcessedFileState(fileStateValue);
|
|
413
406
|
if (
|
|
414
407
|
/**
|
|
415
408
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -419,7 +412,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
419
412
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
420
413
|
setIsPlayingFile(true);
|
|
421
414
|
}
|
|
422
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
415
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
423
416
|
|
|
424
417
|
//----------------------------------------------------------------//
|
|
425
418
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -459,7 +452,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
459
452
|
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
460
453
|
var isPreviewableFileState = !!fileState.preview;
|
|
461
454
|
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
462
|
-
var hasLocalPreview =
|
|
455
|
+
var hasLocalPreview = isPreviewableFileState &&
|
|
463
456
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
464
457
|
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
465
458
|
var hasRemotePreview = isImageRepresentationReady(fileState);
|
|
@@ -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.7.
|
|
106
|
+
packageName: "77.7.2",
|
|
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.7.
|
|
10
|
+
var packageVersion = "77.7.2";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.7.
|
|
3
|
+
"version": "77.7.2",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@atlaskit/media-client": "^26.1.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
45
45
|
"@atlaskit/media-common": "^11.0.0",
|
|
46
|
-
"@atlaskit/media-file-preview": "^0.
|
|
46
|
+
"@atlaskit/media-file-preview": "^0.2.0",
|
|
47
47
|
"@atlaskit/media-ui": "^25.0.0",
|
|
48
48
|
"@atlaskit/media-viewer": "^48.2.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
50
50
|
"@atlaskit/spinner": "^16.0.0",
|
|
51
51
|
"@atlaskit/theme": "^12.6.0",
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
52
|
+
"@atlaskit/tokens": "^1.35.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.1.0",
|
|
54
54
|
"@atlaskit/ufo": "^0.2.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|