@atlaskit/media-card 77.7.0 → 77.7.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 +6 -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/fileCard.js +13 -19
- 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/fileCard.js +5 -8
- 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/fileCard.js +15 -21
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
3
9
|
## 77.7.0
|
|
4
10
|
|
|
5
11
|
### 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.1";
|
|
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.1";
|
|
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.1";
|
|
20
20
|
var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -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 () {
|
|
@@ -193,18 +188,18 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
193
188
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
194
189
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
195
190
|
getScriptProps = _useFilePreview.getScriptProps;
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
error =
|
|
199
|
-
setError =
|
|
191
|
+
var _useState13 = (0, _react.useState)(),
|
|
192
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
193
|
+
error = _useState14[0],
|
|
194
|
+
setError = _useState14[1];
|
|
200
195
|
|
|
201
196
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
202
197
|
var finalError = error || previewError;
|
|
203
198
|
var finalStatus = finalError ? 'error' : status;
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
mediaViewerSelectedItem =
|
|
207
|
-
setMediaViewerSelectedItem =
|
|
199
|
+
var _useState15 = (0, _react.useState)(null),
|
|
200
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
201
|
+
mediaViewerSelectedItem = _useState16[0],
|
|
202
|
+
setMediaViewerSelectedItem = _useState16[1];
|
|
208
203
|
var uploadProgressRef = (0, _react.useRef)();
|
|
209
204
|
var metadata = (0, _react.useMemo)(function () {
|
|
210
205
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
@@ -407,7 +402,6 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
407
402
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
408
403
|
setStatus('complete');
|
|
409
404
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
410
|
-
setIsBannedLocalPreview(false);
|
|
411
405
|
}
|
|
412
406
|
}, [previewDidRender, finalStatus]);
|
|
413
407
|
|
|
@@ -419,7 +413,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
419
413
|
var isVideo = fileAttributes.fileMediatype === 'video';
|
|
420
414
|
var _getFileDetails2 = (0, _metadata.getFileDetails)(identifier, fileStateValue),
|
|
421
415
|
mimeType = _getFileDetails2.mimeType;
|
|
422
|
-
var isVideoPlayable = (0,
|
|
416
|
+
var isVideoPlayable = mimeType && (0, _mediaCommon.isVideoMimeTypeSupportedByBrowser)(mimeType) || fileStateValue && (0, _mediaClient.isProcessedFileState)(fileStateValue);
|
|
423
417
|
if (
|
|
424
418
|
/**
|
|
425
419
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -429,7 +423,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
429
423
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
430
424
|
setIsPlayingFile(true);
|
|
431
425
|
}
|
|
432
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
426
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
433
427
|
|
|
434
428
|
//----------------------------------------------------------------//
|
|
435
429
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -469,7 +463,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
469
463
|
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
470
464
|
var isPreviewableFileState = !!fileState.preview;
|
|
471
465
|
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
472
|
-
var hasLocalPreview =
|
|
466
|
+
var hasLocalPreview = isPreviewableFileState &&
|
|
473
467
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
474
468
|
isSupportedLocalPreview && !!fileState.mimeType && (0, _mediaCommon.isMimeTypeSupportedByBrowser)(fileState.mimeType);
|
|
475
469
|
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.1",
|
|
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.1";
|
|
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.1";
|
|
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.1";
|
|
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.1";
|
|
11
11
|
export const CardV2Base = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -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
|
|
@@ -356,7 +354,6 @@ export const FileCard = ({
|
|
|
356
354
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
357
355
|
setStatus('complete');
|
|
358
356
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
359
|
-
setIsBannedLocalPreview(false);
|
|
360
357
|
}
|
|
361
358
|
}, [previewDidRender, finalStatus]);
|
|
362
359
|
|
|
@@ -369,7 +366,7 @@ export const FileCard = ({
|
|
|
369
366
|
const {
|
|
370
367
|
mimeType
|
|
371
368
|
} = getFileDetails(identifier, fileStateValue);
|
|
372
|
-
const isVideoPlayable =
|
|
369
|
+
const isVideoPlayable = mimeType && isVideoMimeTypeSupportedByBrowser(mimeType) || fileStateValue && isProcessedFileState(fileStateValue);
|
|
373
370
|
if (
|
|
374
371
|
/**
|
|
375
372
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -379,7 +376,7 @@ export const FileCard = ({
|
|
|
379
376
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
380
377
|
setIsPlayingFile(true);
|
|
381
378
|
}
|
|
382
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
379
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
383
380
|
|
|
384
381
|
//----------------------------------------------------------------//
|
|
385
382
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -419,7 +416,7 @@ export const FileCard = ({
|
|
|
419
416
|
const isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
420
417
|
const isPreviewableFileState = !!fileState.preview;
|
|
421
418
|
const isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
422
|
-
const hasLocalPreview =
|
|
419
|
+
const hasLocalPreview = isPreviewableFileState &&
|
|
423
420
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
424
421
|
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
425
422
|
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.1",
|
|
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.1";
|
|
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.1";
|
|
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.1";
|
|
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.1";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -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 () {
|
|
@@ -183,18 +178,18 @@ export var FileCard = function FileCard(_ref) {
|
|
|
183
178
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
184
179
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
185
180
|
getScriptProps = _useFilePreview.getScriptProps;
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
error =
|
|
189
|
-
setError =
|
|
181
|
+
var _useState13 = useState(),
|
|
182
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
183
|
+
error = _useState14[0],
|
|
184
|
+
setError = _useState14[1];
|
|
190
185
|
|
|
191
186
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
192
187
|
var finalError = error || previewError;
|
|
193
188
|
var finalStatus = finalError ? 'error' : status;
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
mediaViewerSelectedItem =
|
|
197
|
-
setMediaViewerSelectedItem =
|
|
189
|
+
var _useState15 = useState(null),
|
|
190
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
191
|
+
mediaViewerSelectedItem = _useState16[0],
|
|
192
|
+
setMediaViewerSelectedItem = _useState16[1];
|
|
198
193
|
var uploadProgressRef = useRef();
|
|
199
194
|
var metadata = useMemo(function () {
|
|
200
195
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
@@ -397,7 +392,6 @@ export var FileCard = function FileCard(_ref) {
|
|
|
397
392
|
['loading-preview', 'processing'].includes(finalStatus)) {
|
|
398
393
|
setStatus('complete');
|
|
399
394
|
// TODO MEX-788: add test for "do not remove the card preview when unsubscribing".
|
|
400
|
-
setIsBannedLocalPreview(false);
|
|
401
395
|
}
|
|
402
396
|
}, [previewDidRender, finalStatus]);
|
|
403
397
|
|
|
@@ -409,7 +403,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
409
403
|
var isVideo = fileAttributes.fileMediatype === 'video';
|
|
410
404
|
var _getFileDetails2 = getFileDetails(identifier, fileStateValue),
|
|
411
405
|
mimeType = _getFileDetails2.mimeType;
|
|
412
|
-
var isVideoPlayable =
|
|
406
|
+
var isVideoPlayable = mimeType && isVideoMimeTypeSupportedByBrowser(mimeType) || fileStateValue && isProcessedFileState(fileStateValue);
|
|
413
407
|
if (
|
|
414
408
|
/**
|
|
415
409
|
* We need to check that the card is visible before switching to inline player
|
|
@@ -419,7 +413,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
419
413
|
isCardVisible && isVideo && !isPlayingFile && disableOverlay && useInlinePlayer && isVideoPlayable && finalStatus !== 'error') {
|
|
420
414
|
setIsPlayingFile(true);
|
|
421
415
|
}
|
|
422
|
-
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier,
|
|
416
|
+
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
423
417
|
|
|
424
418
|
//----------------------------------------------------------------//
|
|
425
419
|
//----------------- fireScreenEvent ------------------------------//
|
|
@@ -459,7 +453,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
459
453
|
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
460
454
|
var isPreviewableFileState = !!fileState.preview;
|
|
461
455
|
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
462
|
-
var hasLocalPreview =
|
|
456
|
+
var hasLocalPreview = isPreviewableFileState &&
|
|
463
457
|
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
464
458
|
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
465
459
|
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.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.7.
|
|
10
|
+
var packageVersion = "77.7.1";
|
|
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.1",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
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.34.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.1.0",
|
|
54
54
|
"@atlaskit/ufo": "^0.2.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|