@atlaskit/media-card 77.7.2 → 77.7.4
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/externalImageCard.js +3 -2
- package/dist/cjs/card/v2/fileCard.js +7 -13
- package/dist/cjs/card/v2/performance.js +9 -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/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/externalImageCard.js +3 -2
- package/dist/es2019/card/v2/fileCard.js +8 -14
- package/dist/es2019/card/v2/performance.js +1 -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/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/externalImageCard.js +3 -2
- package/dist/esm/card/v2/fileCard.js +8 -14
- package/dist/esm/card/v2/performance.js +3 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/v2/performance.d.ts +1 -0
- package/dist/types-ts4.5/card/v2/performance.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#69809](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69809) [`8c7fda062747`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8c7fda062747) - Unskip MediaCardV2 tests for processing status
|
|
8
|
+
|
|
9
|
+
## 77.7.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#69372](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69372) [`c5868970426f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c5868970426f) - Simplified status set in Card v2
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 77.7.2
|
|
4
17
|
|
|
5
18
|
### Patch 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.4";
|
|
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.4";
|
|
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.4";
|
|
20
20
|
var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -23,6 +23,7 @@ var _cardDimensions = require("../../utils/cardDimensions");
|
|
|
23
23
|
var _usePrevious = require("../../utils/usePrevious");
|
|
24
24
|
var _cardAnalytics = require("../cardAnalytics");
|
|
25
25
|
var _cardViewV = require("./cardViewV2");
|
|
26
|
+
var _performance = require("./performance");
|
|
26
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
29
|
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; }
|
|
@@ -58,7 +59,7 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
58
59
|
return (0, _generateUniqueId.generateUniqueId)();
|
|
59
60
|
}, []);
|
|
60
61
|
var timeElapsedTillCommenced = (0, _react.useMemo)(function () {
|
|
61
|
-
return
|
|
62
|
+
return (0, _performance.performanceNow)();
|
|
62
63
|
}, []);
|
|
63
64
|
|
|
64
65
|
// Generate unique traceId for file
|
|
@@ -131,7 +132,7 @@ var ExternalImageCard = exports.ExternalImageCard = function ExternalImageCard(_
|
|
|
131
132
|
//----------------------------------------------------------------//
|
|
132
133
|
|
|
133
134
|
var fireOperationalEventRef = (0, _useCurrentValueRef.useCurrentValueRef)(function () {
|
|
134
|
-
var timeElapsedTillEvent =
|
|
135
|
+
var timeElapsedTillEvent = (0, _performance.performanceNow)();
|
|
135
136
|
var durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
136
137
|
var performanceAttributes = {
|
|
137
138
|
overall: {
|
|
@@ -34,6 +34,7 @@ var _cardViewV = require("./cardViewV2");
|
|
|
34
34
|
var _cardviews = require("./cardviews");
|
|
35
35
|
var _inlinePlayerLazyV = require("./inlinePlayerLazyV2");
|
|
36
36
|
var _mediaFilePreview = require("@atlaskit/media-file-preview");
|
|
37
|
+
var _performance = require("./performance");
|
|
37
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
39
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
40
|
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; }
|
|
@@ -120,7 +121,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
120
121
|
return (0, _generateUniqueId.generateUniqueId)();
|
|
121
122
|
}, []);
|
|
122
123
|
var timeElapsedTillCommenced = (0, _react.useMemo)(function () {
|
|
123
|
-
return
|
|
124
|
+
return (0, _performance.performanceNow)();
|
|
124
125
|
}, []);
|
|
125
126
|
var fileStateFlagsRef = (0, _react.useRef)({
|
|
126
127
|
wasStatusUploading: false,
|
|
@@ -181,6 +182,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
181
182
|
skipRemote: !isCardVisible
|
|
182
183
|
}),
|
|
183
184
|
preview = _useFilePreview.preview,
|
|
185
|
+
previewStatus = _useFilePreview.status,
|
|
184
186
|
previewError = _useFilePreview.error,
|
|
185
187
|
nonCriticalError = _useFilePreview.nonCriticalError,
|
|
186
188
|
ssrReliabilityRef = _useFilePreview.ssrReliabilityRef,
|
|
@@ -258,7 +260,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
258
260
|
//----------------------------------------------------------------//
|
|
259
261
|
|
|
260
262
|
var fireOperationalEventRef = (0, _useCurrentValueRef.useCurrentValueRef)(function () {
|
|
261
|
-
var timeElapsedTillEvent =
|
|
263
|
+
var timeElapsedTillEvent = (0, _performance.performanceNow)();
|
|
262
264
|
var durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
263
265
|
var performanceAttributes = {
|
|
264
266
|
overall: {
|
|
@@ -458,15 +460,6 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
458
460
|
return;
|
|
459
461
|
}
|
|
460
462
|
if (fileState.status !== 'error') {
|
|
461
|
-
var mediaType = 'mediaType' in fileState ? fileState.mediaType : undefined;
|
|
462
|
-
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
463
|
-
var isPreviewableFileState = !!fileState.preview;
|
|
464
|
-
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
465
|
-
var hasLocalPreview = isPreviewableFileState &&
|
|
466
|
-
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
467
|
-
isSupportedLocalPreview && !!fileState.mimeType && (0, _mediaCommon.isMimeTypeSupportedByBrowser)(fileState.mimeType);
|
|
468
|
-
var hasRemotePreview = (0, _mediaClient.isImageRepresentationReady)(fileState);
|
|
469
|
-
var hasPreview = hasLocalPreview || hasRemotePreview;
|
|
470
463
|
var newStatus;
|
|
471
464
|
switch (fileState.status) {
|
|
472
465
|
case 'uploading':
|
|
@@ -475,7 +468,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
475
468
|
newStatus = fileState.status;
|
|
476
469
|
break;
|
|
477
470
|
case 'processed':
|
|
478
|
-
if
|
|
471
|
+
// Set complete if processing is done and there is no preview
|
|
472
|
+
if (!preview && previewStatus === 'complete') {
|
|
479
473
|
newStatus = 'complete';
|
|
480
474
|
break;
|
|
481
475
|
}
|
|
@@ -497,7 +491,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
497
491
|
});
|
|
498
492
|
(0, _react.useEffect)(function () {
|
|
499
493
|
updateFileStateRef.current();
|
|
500
|
-
}, [fileState, updateFileStateRef]);
|
|
494
|
+
}, [fileState, preview, previewStatus, updateFileStateRef]);
|
|
501
495
|
|
|
502
496
|
//----------------------------------------------------------------//
|
|
503
497
|
//---------------------- Render Card Function --------------------//
|
|
@@ -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.4",
|
|
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.4";
|
|
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.4";
|
|
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.4";
|
|
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.4";
|
|
11
11
|
export const CardV2Base = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -13,6 +13,7 @@ import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
|
13
13
|
import { usePrevious } from '../../utils/usePrevious';
|
|
14
14
|
import { fireCommencedEvent, fireCopiedEvent, fireOperationalEvent, fireScreenEvent } from '../cardAnalytics';
|
|
15
15
|
import { CardViewV2 } from './cardViewV2';
|
|
16
|
+
import { performanceNow } from './performance';
|
|
16
17
|
export const ExternalImageCard = ({
|
|
17
18
|
mediaClient,
|
|
18
19
|
appearance = 'auto',
|
|
@@ -39,7 +40,7 @@ export const ExternalImageCard = ({
|
|
|
39
40
|
}) => {
|
|
40
41
|
const cardDimensions = dimensions || getDefaultCardDimensions(appearance);
|
|
41
42
|
const internalOccurrenceKey = useMemo(() => generateUniqueId(), []);
|
|
42
|
-
const timeElapsedTillCommenced = useMemo(() =>
|
|
43
|
+
const timeElapsedTillCommenced = useMemo(() => performanceNow(), []);
|
|
43
44
|
|
|
44
45
|
// Generate unique traceId for file
|
|
45
46
|
const traceContext = useMemo(() => ({
|
|
@@ -92,7 +93,7 @@ export const ExternalImageCard = ({
|
|
|
92
93
|
//----------------------------------------------------------------//
|
|
93
94
|
|
|
94
95
|
const fireOperationalEventRef = useCurrentValueRef(() => {
|
|
95
|
-
const timeElapsedTillEvent =
|
|
96
|
+
const timeElapsedTillEvent = performanceNow();
|
|
96
97
|
const durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
97
98
|
const performanceAttributes = {
|
|
98
99
|
overall: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
3
|
-
import { globalMediaEventEmitter,
|
|
3
|
+
import { globalMediaEventEmitter, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState } from '@atlaskit/media-client';
|
|
4
4
|
import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
5
5
|
import { getRandomHex, isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
@@ -23,6 +23,7 @@ import { CardViewV2 } from './cardViewV2';
|
|
|
23
23
|
import { CardViews } from './cardviews';
|
|
24
24
|
import { InlinePlayerLazyV2 } from './inlinePlayerLazyV2';
|
|
25
25
|
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
26
|
+
import { performanceNow } from './performance';
|
|
26
27
|
const LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardViewV2;
|
|
27
28
|
export const FileCard = ({
|
|
28
29
|
appearance = 'auto',
|
|
@@ -91,7 +92,7 @@ export const FileCard = ({
|
|
|
91
92
|
//----------------------------------------------------------------//
|
|
92
93
|
|
|
93
94
|
const internalOccurrenceKey = useMemo(() => generateUniqueId(), []);
|
|
94
|
-
const timeElapsedTillCommenced = useMemo(() =>
|
|
95
|
+
const timeElapsedTillCommenced = useMemo(() => performanceNow(), []);
|
|
95
96
|
const fileStateFlagsRef = useRef({
|
|
96
97
|
wasStatusUploading: false,
|
|
97
98
|
wasStatusProcessing: false
|
|
@@ -132,6 +133,7 @@ export const FileCard = ({
|
|
|
132
133
|
}, [alt, previewDimensions, contextId, fileStateValue, identifier, originalDimensions]);
|
|
133
134
|
const {
|
|
134
135
|
preview,
|
|
136
|
+
status: previewStatus,
|
|
135
137
|
error: previewError,
|
|
136
138
|
nonCriticalError,
|
|
137
139
|
ssrReliabilityRef,
|
|
@@ -210,7 +212,7 @@ export const FileCard = ({
|
|
|
210
212
|
//----------------------------------------------------------------//
|
|
211
213
|
|
|
212
214
|
const fireOperationalEventRef = useCurrentValueRef(() => {
|
|
213
|
-
const timeElapsedTillEvent =
|
|
215
|
+
const timeElapsedTillEvent = performanceNow();
|
|
214
216
|
const durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
215
217
|
const performanceAttributes = {
|
|
216
218
|
overall: {
|
|
@@ -411,15 +413,6 @@ export const FileCard = ({
|
|
|
411
413
|
return;
|
|
412
414
|
}
|
|
413
415
|
if (fileState.status !== 'error') {
|
|
414
|
-
const mediaType = 'mediaType' in fileState ? fileState.mediaType : undefined;
|
|
415
|
-
const isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
416
|
-
const isPreviewableFileState = !!fileState.preview;
|
|
417
|
-
const isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
418
|
-
const hasLocalPreview = isPreviewableFileState &&
|
|
419
|
-
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
420
|
-
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
421
|
-
const hasRemotePreview = isImageRepresentationReady(fileState);
|
|
422
|
-
const hasPreview = hasLocalPreview || hasRemotePreview;
|
|
423
416
|
let newStatus;
|
|
424
417
|
switch (fileState.status) {
|
|
425
418
|
case 'uploading':
|
|
@@ -428,7 +421,8 @@ export const FileCard = ({
|
|
|
428
421
|
newStatus = fileState.status;
|
|
429
422
|
break;
|
|
430
423
|
case 'processed':
|
|
431
|
-
if
|
|
424
|
+
// Set complete if processing is done and there is no preview
|
|
425
|
+
if (!preview && previewStatus === 'complete') {
|
|
432
426
|
newStatus = 'complete';
|
|
433
427
|
break;
|
|
434
428
|
}
|
|
@@ -450,7 +444,7 @@ export const FileCard = ({
|
|
|
450
444
|
});
|
|
451
445
|
useEffect(() => {
|
|
452
446
|
updateFileStateRef.current();
|
|
453
|
-
}, [fileState, updateFileStateRef]);
|
|
447
|
+
}, [fileState, preview, previewStatus, updateFileStateRef]);
|
|
454
448
|
|
|
455
449
|
//----------------------------------------------------------------//
|
|
456
450
|
//---------------------- Render Card Function --------------------//
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const performanceNow = () => performance.now();
|
|
@@ -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.4",
|
|
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.4";
|
|
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.4";
|
|
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.4";
|
|
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.4";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -17,6 +17,7 @@ import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
|
17
17
|
import { usePrevious } from '../../utils/usePrevious';
|
|
18
18
|
import { fireCommencedEvent, fireCopiedEvent, fireOperationalEvent, fireScreenEvent } from '../cardAnalytics';
|
|
19
19
|
import { CardViewV2 } from './cardViewV2';
|
|
20
|
+
import { performanceNow } from './performance';
|
|
20
21
|
export var ExternalImageCard = function ExternalImageCard(_ref) {
|
|
21
22
|
var mediaClient = _ref.mediaClient,
|
|
22
23
|
_ref$appearance = _ref.appearance,
|
|
@@ -48,7 +49,7 @@ export var ExternalImageCard = function ExternalImageCard(_ref) {
|
|
|
48
49
|
return generateUniqueId();
|
|
49
50
|
}, []);
|
|
50
51
|
var timeElapsedTillCommenced = useMemo(function () {
|
|
51
|
-
return
|
|
52
|
+
return performanceNow();
|
|
52
53
|
}, []);
|
|
53
54
|
|
|
54
55
|
// Generate unique traceId for file
|
|
@@ -121,7 +122,7 @@ export var ExternalImageCard = function ExternalImageCard(_ref) {
|
|
|
121
122
|
//----------------------------------------------------------------//
|
|
122
123
|
|
|
123
124
|
var fireOperationalEventRef = useCurrentValueRef(function () {
|
|
124
|
-
var timeElapsedTillEvent =
|
|
125
|
+
var timeElapsedTillEvent = performanceNow();
|
|
125
126
|
var durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
126
127
|
var performanceAttributes = {
|
|
127
128
|
overall: {
|
|
@@ -5,7 +5,7 @@ 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,
|
|
8
|
+
import { globalMediaEventEmitter, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState } from '@atlaskit/media-client';
|
|
9
9
|
import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
10
10
|
import { getRandomHex, isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
11
11
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
@@ -28,6 +28,7 @@ import { CardViewV2 } from './cardViewV2';
|
|
|
28
28
|
import { CardViews } from './cardviews';
|
|
29
29
|
import { InlinePlayerLazyV2 } from './inlinePlayerLazyV2';
|
|
30
30
|
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
31
|
+
import { performanceNow } from './performance';
|
|
31
32
|
var LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardViewV2;
|
|
32
33
|
export var FileCard = function FileCard(_ref) {
|
|
33
34
|
var _ref$appearance = _ref.appearance,
|
|
@@ -110,7 +111,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
110
111
|
return generateUniqueId();
|
|
111
112
|
}, []);
|
|
112
113
|
var timeElapsedTillCommenced = useMemo(function () {
|
|
113
|
-
return
|
|
114
|
+
return performanceNow();
|
|
114
115
|
}, []);
|
|
115
116
|
var fileStateFlagsRef = useRef({
|
|
116
117
|
wasStatusUploading: false,
|
|
@@ -171,6 +172,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
171
172
|
skipRemote: !isCardVisible
|
|
172
173
|
}),
|
|
173
174
|
preview = _useFilePreview.preview,
|
|
175
|
+
previewStatus = _useFilePreview.status,
|
|
174
176
|
previewError = _useFilePreview.error,
|
|
175
177
|
nonCriticalError = _useFilePreview.nonCriticalError,
|
|
176
178
|
ssrReliabilityRef = _useFilePreview.ssrReliabilityRef,
|
|
@@ -248,7 +250,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
248
250
|
//----------------------------------------------------------------//
|
|
249
251
|
|
|
250
252
|
var fireOperationalEventRef = useCurrentValueRef(function () {
|
|
251
|
-
var timeElapsedTillEvent =
|
|
253
|
+
var timeElapsedTillEvent = performanceNow();
|
|
252
254
|
var durationSinceCommenced = timeElapsedTillEvent - timeElapsedTillCommenced;
|
|
253
255
|
var performanceAttributes = {
|
|
254
256
|
overall: {
|
|
@@ -448,15 +450,6 @@ export var FileCard = function FileCard(_ref) {
|
|
|
448
450
|
return;
|
|
449
451
|
}
|
|
450
452
|
if (fileState.status !== 'error') {
|
|
451
|
-
var mediaType = 'mediaType' in fileState ? fileState.mediaType : undefined;
|
|
452
|
-
var isPreviewable = !!mediaType && ['audio', 'video', 'image', 'doc'].indexOf(mediaType) > -1;
|
|
453
|
-
var isPreviewableFileState = !!fileState.preview;
|
|
454
|
-
var isSupportedLocalPreview = mediaType === 'image' || mediaType === 'video';
|
|
455
|
-
var hasLocalPreview = isPreviewableFileState &&
|
|
456
|
-
// CXP-2723 TODO: isPreviewableFileState is most likely redundant
|
|
457
|
-
isSupportedLocalPreview && !!fileState.mimeType && isMimeTypeSupportedByBrowser(fileState.mimeType);
|
|
458
|
-
var hasRemotePreview = isImageRepresentationReady(fileState);
|
|
459
|
-
var hasPreview = hasLocalPreview || hasRemotePreview;
|
|
460
453
|
var newStatus;
|
|
461
454
|
switch (fileState.status) {
|
|
462
455
|
case 'uploading':
|
|
@@ -465,7 +458,8 @@ export var FileCard = function FileCard(_ref) {
|
|
|
465
458
|
newStatus = fileState.status;
|
|
466
459
|
break;
|
|
467
460
|
case 'processed':
|
|
468
|
-
if
|
|
461
|
+
// Set complete if processing is done and there is no preview
|
|
462
|
+
if (!preview && previewStatus === 'complete') {
|
|
469
463
|
newStatus = 'complete';
|
|
470
464
|
break;
|
|
471
465
|
}
|
|
@@ -487,7 +481,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
487
481
|
});
|
|
488
482
|
useEffect(function () {
|
|
489
483
|
updateFileStateRef.current();
|
|
490
|
-
}, [fileState, updateFileStateRef]);
|
|
484
|
+
}, [fileState, preview, previewStatus, updateFileStateRef]);
|
|
491
485
|
|
|
492
486
|
//----------------------------------------------------------------//
|
|
493
487
|
//---------------------- Render Card Function --------------------//
|
|
@@ -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.4",
|
|
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.4";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const performanceNow: () => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const performanceNow: () => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.7.
|
|
3
|
+
"version": "77.7.4",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
40
|
-
"@atlaskit/dropdown-menu": "^12.
|
|
40
|
+
"@atlaskit/dropdown-menu": "^12.2.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
42
42
|
"@atlaskit/icon": "^22.0.0",
|
|
43
43
|
"@atlaskit/media-client": "^26.1.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@atlaskit/media-core": "^34.1.0",
|
|
73
73
|
"@atlaskit/media-picker": "^66.2.0",
|
|
74
74
|
"@atlaskit/media-state": "^1.0.0",
|
|
75
|
-
"@atlaskit/media-test-data": "^1.
|
|
75
|
+
"@atlaskit/media-test-data": "^1.2.0",
|
|
76
76
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
77
77
|
"@atlaskit/ssr": "*",
|
|
78
78
|
"@atlaskit/visual-regression": "*",
|