@atlaskit/media-card 81.12.15 → 82.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/cjs/card/actions.js +1 -15
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +32 -22
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/errors.js +1 -96
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineCard.js +5 -6
- package/dist/cjs/types.js +1 -42
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/actions.js +1 -10
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +31 -20
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/errors.js +0 -54
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineCard.js +5 -6
- package/dist/es2019/types.js +1 -18
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/actions.js +1 -10
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +32 -22
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/errors.js +0 -54
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineCard.js +5 -6
- package/dist/esm/types.js +1 -18
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/actions.d.ts +0 -8
- package/dist/types/card/fileCard.d.ts +2 -1
- package/dist/types/errors.d.ts +0 -52
- package/dist/types/inline/mediaInlineCard.d.ts +1 -0
- package/dist/types/types.d.ts +1 -17
- package/package.json +22 -20
- package/dist/cjs/inline/mediaInlineCardAnalytics.js +0 -40
- package/dist/es2019/inline/mediaInlineCardAnalytics.js +0 -22
- package/dist/esm/inline/mediaInlineCardAnalytics.js +0 -22
- package/dist/types/inline/mediaInlineCardAnalytics.d.ts +0 -20
- package/mediaInlineCardAnalytics/package.json +0 -10
|
@@ -14,7 +14,6 @@ import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
|
14
14
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
16
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
17
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
17
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
19
18
|
import { MediaCardError } from '../MediaCardError';
|
|
20
19
|
import { fireMediaCardEvent } from '../utils/analytics/fireMediaCardEvent';
|
|
@@ -97,7 +96,7 @@ export const MediaInlineCardInternal = ({
|
|
|
97
96
|
selectedItem: identifier,
|
|
98
97
|
onClose: onMediaViewerClose,
|
|
99
98
|
viewerOptions: viewerOptions,
|
|
100
|
-
fallbackMediaNameFetcher:
|
|
99
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
101
100
|
}), document.body);
|
|
102
101
|
}
|
|
103
102
|
return null;
|
|
@@ -130,7 +129,7 @@ export const MediaInlineCardInternal = ({
|
|
|
130
129
|
};
|
|
131
130
|
}, [identifier.collectionName, identifier.id, mediaClient.file]);
|
|
132
131
|
useEffect(() => {
|
|
133
|
-
if (fileState && fileState.status !== 'error' && !fileState.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current
|
|
132
|
+
if (fileState && fileState.status !== 'error' && !fileState.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current) {
|
|
134
133
|
fallbackMediaNameFetchAttempted.current = true;
|
|
135
134
|
fallbackMediaNameFetcher(fileState.id).then(name => setFallbackMediaName(name), () => setFallbackMediaNameFetchFailed(true));
|
|
136
135
|
}
|
|
@@ -159,7 +158,7 @@ export const MediaInlineCardInternal = ({
|
|
|
159
158
|
|
|
160
159
|
// Empty file handling — try the fallback name fetcher first if available
|
|
161
160
|
if (fileState && !fileState.name) {
|
|
162
|
-
if (fallbackMediaNameFetcher && !fallbackMediaNameFetchFailed && !fallbackMediaName
|
|
161
|
+
if (fallbackMediaNameFetcher && !fallbackMediaNameFetchFailed && !fallbackMediaName) {
|
|
163
162
|
// Fetch not yet attempted or in flight — show loading
|
|
164
163
|
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
165
164
|
innerRef: copyNodeRef,
|
|
@@ -167,7 +166,7 @@ export const MediaInlineCardInternal = ({
|
|
|
167
166
|
isSelected: isSelected
|
|
168
167
|
});
|
|
169
168
|
}
|
|
170
|
-
if (!
|
|
169
|
+
if (!fallbackMediaName) {
|
|
171
170
|
// No fetcher provided or fetch failed — show error
|
|
172
171
|
const error = new MediaCardError('metadata-fetch', new FileFetcherError('emptyFileName', {
|
|
173
172
|
id: fileState.id
|
|
@@ -205,7 +204,7 @@ export const MediaInlineCardInternal = ({
|
|
|
205
204
|
name: fileStateName,
|
|
206
205
|
mimeType
|
|
207
206
|
} = fileState;
|
|
208
|
-
const name =
|
|
207
|
+
const name = fileStateName || fallbackMediaName;
|
|
209
208
|
const linkIcon = /*#__PURE__*/React.createElement(MimeTypeIcon, {
|
|
210
209
|
testId: 'media-inline-card-file-type-icon',
|
|
211
210
|
size: "small",
|
package/dist/es2019/types.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
1
|
/**
|
|
3
2
|
* Entry Point: @atlaskit/media-card/types
|
|
4
3
|
*/
|
|
@@ -7,20 +6,4 @@ export let MediaCardCursor = /*#__PURE__*/function (MediaCardCursor) {
|
|
|
7
6
|
MediaCardCursor["Action"] = "pointer";
|
|
8
7
|
MediaCardCursor["NotReady"] = "wait";
|
|
9
8
|
return MediaCardCursor;
|
|
10
|
-
}({});
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `import { isSSRPreview } from '@atlaskit/media-card/is-ssr-preview'` instead.
|
|
13
|
-
*/
|
|
14
|
-
export { isSSRPreview } from './isSSRPreview';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `import { isSSRServerPreview } from '@atlaskit/media-card/is-ssr-server-preview'` instead.
|
|
17
|
-
*/
|
|
18
|
-
export { isSSRServerPreview } from './isSSRServerPreview';
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `import { isSSRClientPreview } from '@atlaskit/media-card/is-ssr-client-preview'` instead.
|
|
21
|
-
*/
|
|
22
|
-
export { isSSRClientPreview } from './isSSRClientPreview';
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use `import { isSSRDataPreview } from '@atlaskit/media-card/is-ssr-data-preview'` instead.
|
|
25
|
-
*/
|
|
26
|
-
export { isSSRDataPreview } from './isSSRDataPreview';
|
|
9
|
+
}({});
|
|
@@ -12,7 +12,7 @@ import { extractErrorInfo } from './analytics/extractErrorInfo';
|
|
|
12
12
|
import { getRenderErrorRequestMetadata } from './analytics/getRenderErrorRequestMetadata';
|
|
13
13
|
import { getMediaGlobalScope } from './globalScope/getMediaGlobalScope';
|
|
14
14
|
const packageName = "@atlaskit/media-card";
|
|
15
|
-
const packageVersion = "
|
|
15
|
+
const packageVersion = "82.0.0";
|
|
16
16
|
const SAMPLE_RATE = 0.05;
|
|
17
17
|
|
|
18
18
|
/**
|
package/dist/esm/card/actions.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `import { attachDetailsToActions } from '@atlaskit/media-card/attach-details-to-actions'` instead.
|
|
5
|
-
*/
|
|
6
|
-
export { attachDetailsToActions } from './attachDetailsToActions';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use `import { createDownloadAction } from '@atlaskit/media-card/create-download-action'` instead.
|
|
9
|
-
*/
|
|
10
|
-
export { createDownloadAction } from './createDownloadAction';
|
|
1
|
+
export {};
|
package/dist/esm/card/card.js
CHANGED
|
@@ -2,7 +2,7 @@ import { injectIntl } from 'react-intl';
|
|
|
2
2
|
import { withMediaAnalyticsContext } from '@atlaskit/media-common';
|
|
3
3
|
import { CardWithPerformanceObserver } from './CardWithPerformanceObserver';
|
|
4
4
|
var packageName = "@atlaskit/media-card";
|
|
5
|
-
var packageVersion = "
|
|
5
|
+
var packageVersion = "82.0.0";
|
|
6
6
|
export var Card = withMediaAnalyticsContext({
|
|
7
7
|
packageVersion: packageVersion,
|
|
8
8
|
packageName: packageName,
|
|
@@ -18,10 +18,10 @@ import { isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, getRan
|
|
|
18
18
|
import { useFilePreview } from '@atlaskit/media-file-preview/use-file-preview';
|
|
19
19
|
import { AbuseModal } from '@atlaskit/media-ui/abuseModal';
|
|
20
20
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
21
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
21
22
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
23
|
import { getActiveTrace } from '@atlaskit/react-ufo/get-active-trace';
|
|
23
24
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
24
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
25
25
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
26
26
|
import { isSSRPreview } from '../isSSRPreview';
|
|
27
27
|
import { MediaCardError } from '../MediaCardError';
|
|
@@ -176,12 +176,10 @@ export var FileCard = function FileCard(_ref) {
|
|
|
176
176
|
useEffect(function () {
|
|
177
177
|
// Reset fetch state when the file identity changes
|
|
178
178
|
var currentId = fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.id;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
if (fileStateValue && !fileStateValue.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current && expValEquals('platform_editor_media_name_fallback_viewer_card', 'isEnabled', true)) {
|
|
179
|
+
fallbackMediaNameFetchAttempted.current = false;
|
|
180
|
+
setFallbackMediaName(undefined);
|
|
181
|
+
lastFetchedFileId.current = currentId;
|
|
182
|
+
if (fileStateValue && !fileStateValue.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current) {
|
|
185
183
|
fallbackMediaNameFetchAttempted.current = true;
|
|
186
184
|
fallbackMediaNameFetcher(fileStateValue.id).then(function (name) {
|
|
187
185
|
setFallbackMediaName(name);
|
|
@@ -283,10 +281,30 @@ export var FileCard = function FileCard(_ref) {
|
|
|
283
281
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
284
282
|
var finalError = error || (previewError && previewError.primaryReason !== 'failed-processing' && (fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.mimeType) !== 'image/svg+xml' ? previewError : undefined);
|
|
285
283
|
var finalStatus = finalError ? 'error' : status === 'failed-processing' && (fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.mimeType) === 'image/svg+xml' ? 'loading-preview' : status;
|
|
286
|
-
|
|
284
|
+
|
|
285
|
+
// Experiment gate for the Confluence comments-in-media-viewer work. Only the
|
|
286
|
+
// viewer-state persistence callbacks introduced by that series are gated —
|
|
287
|
+
// `mediaViewerExtensions` itself is still forwarded to MediaViewer so the
|
|
288
|
+
// previously shipped `sidebar` and `headerActions` keep working with the
|
|
289
|
+
// experiment off.
|
|
290
|
+
var _ref2 = isExperimentEnabled('cc_comments_media_viewer_sidebar') ? mediaViewerExtensions !== null && mediaViewerExtensions !== void 0 ? mediaViewerExtensions : {} : {},
|
|
291
|
+
getMediaViewerSelectedItem = _ref2.getMediaViewerSelectedItem,
|
|
292
|
+
onSelectedItemChange = _ref2.onSelectedItemChange;
|
|
293
|
+
var _useState17 = useState(function () {
|
|
294
|
+
var _getMediaViewerSelect;
|
|
295
|
+
return (_getMediaViewerSelect = getMediaViewerSelectedItem === null || getMediaViewerSelectedItem === void 0 ? void 0 : getMediaViewerSelectedItem(identifier)) !== null && _getMediaViewerSelect !== void 0 ? _getMediaViewerSelect : null;
|
|
296
|
+
}),
|
|
287
297
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
288
298
|
mediaViewerSelectedItem = _useState18[0],
|
|
289
299
|
setMediaViewerSelectedItem = _useState18[1];
|
|
300
|
+
var openMediaViewer = useCallback(function () {
|
|
301
|
+
setMediaViewerSelectedItem(identifier);
|
|
302
|
+
onSelectedItemChange === null || onSelectedItemChange === void 0 || onSelectedItemChange(identifier);
|
|
303
|
+
}, [identifier, onSelectedItemChange]);
|
|
304
|
+
var closeMediaViewer = useCallback(function () {
|
|
305
|
+
setMediaViewerSelectedItem(null);
|
|
306
|
+
onSelectedItemChange === null || onSelectedItemChange === void 0 || onSelectedItemChange(null);
|
|
307
|
+
}, [onSelectedItemChange]);
|
|
290
308
|
var uploadProgressRef = useRef();
|
|
291
309
|
|
|
292
310
|
// Store latest auth provider event (emit with fireOperationalEventRef)
|
|
@@ -302,12 +320,11 @@ export var FileCard = function FileCard(_ref) {
|
|
|
302
320
|
return 'failed';
|
|
303
321
|
}
|
|
304
322
|
};
|
|
305
|
-
var resolvedFallbackName = expValEquals('platform_editor_media_name_fallback_viewer_card', 'isEnabled', true) ? fallbackMediaName : undefined;
|
|
306
323
|
if (fg('dfo_attachments_late_render_fix')) {
|
|
307
324
|
if (fileStateValue) {
|
|
308
325
|
return {
|
|
309
326
|
id: fileStateValue.id,
|
|
310
|
-
name: fileStateValue.name ||
|
|
327
|
+
name: fileStateValue.name || fallbackMediaName || ssrItemDetails && ssrItemDetails.filename,
|
|
311
328
|
size: fileStateValue.size,
|
|
312
329
|
mimeType: fileStateValue.mimeType || ssrItemDetails && ssrItemDetails.mimetype,
|
|
313
330
|
createdAt: fileStateValue.createdAt || ssrItemDetails && ssrItemDetails.createdDate,
|
|
@@ -327,7 +344,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
327
344
|
if (fileStateValue) {
|
|
328
345
|
return {
|
|
329
346
|
id: fileStateValue.id,
|
|
330
|
-
name: fileStateValue.name ||
|
|
347
|
+
name: fileStateValue.name || fallbackMediaName,
|
|
331
348
|
size: fileStateValue.size,
|
|
332
349
|
mimeType: fileStateValue.mimeType,
|
|
333
350
|
createdAt: fileStateValue.createdAt,
|
|
@@ -377,7 +394,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
377
394
|
var computedActions = useMemo(function () {
|
|
378
395
|
if (finalStatus === 'failed-processing' || shouldEnableDownloadButton) {
|
|
379
396
|
var handler = /*#__PURE__*/function () {
|
|
380
|
-
var
|
|
397
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
381
398
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
382
399
|
while (1) switch (_context2.prev = _context2.next) {
|
|
383
400
|
case 0:
|
|
@@ -398,7 +415,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
398
415
|
}, _callee2);
|
|
399
416
|
}));
|
|
400
417
|
return function handler() {
|
|
401
|
-
return
|
|
418
|
+
return _ref4.apply(this, arguments);
|
|
402
419
|
};
|
|
403
420
|
}();
|
|
404
421
|
var downloadAction = createDownloadAction({
|
|
@@ -585,12 +602,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
585
602
|
setIsPlayingFile(true);
|
|
586
603
|
setShouldAutoplay(true);
|
|
587
604
|
} else if (shouldOpenMediaViewer) {
|
|
588
|
-
|
|
589
|
-
id: identifier.id,
|
|
590
|
-
mediaItemType: 'file',
|
|
591
|
-
collectionName: identifier.collectionName,
|
|
592
|
-
occurrenceKey: identifier.occurrenceKey
|
|
593
|
-
});
|
|
605
|
+
openMediaViewer();
|
|
594
606
|
}
|
|
595
607
|
|
|
596
608
|
// Abort VC when click file card
|
|
@@ -843,9 +855,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
843
855
|
items: mediaViewerItems || [],
|
|
844
856
|
mediaClientConfig: mediaClient.config,
|
|
845
857
|
selectedItem: mediaViewerSelectedItem,
|
|
846
|
-
onClose:
|
|
847
|
-
setMediaViewerSelectedItem(null);
|
|
848
|
-
},
|
|
858
|
+
onClose: closeMediaViewer,
|
|
849
859
|
contextId: contextId,
|
|
850
860
|
featureFlags: featureFlags,
|
|
851
861
|
viewerOptions: viewerOptions,
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "
|
|
83
|
+
var packageVersion = "82.0.0";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `import { MediaCardError } from '@atlaskit/media-card/media-card-error'` instead.
|
|
5
|
-
*/
|
|
6
|
-
export { MediaCardError } from './MediaCardError';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use `import { LocalPreviewError } from '@atlaskit/media-card/local-preview-error'` instead.
|
|
9
|
-
*/
|
|
10
|
-
export { LocalPreviewError } from './LocalPreviewError';
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `import { RemotePreviewError } from '@atlaskit/media-card/remote-preview-error'` instead.
|
|
13
|
-
*/
|
|
14
|
-
export { RemotePreviewError } from './RemotePreviewError';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `import { SsrPreviewError } from '@atlaskit/media-card/ssr-preview-error'` instead.
|
|
17
|
-
*/
|
|
18
|
-
export { SsrPreviewError } from './SsrPreviewError';
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `import { getImageLoadPrimaryReason } from '@atlaskit/media-card/get-image-load-primary-reason'` instead.
|
|
21
|
-
*/
|
|
22
|
-
export { getImageLoadPrimaryReason } from './getImageLoadPrimaryReason';
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use `import { ImageLoadError } from '@atlaskit/media-card/image-load-error'` instead.
|
|
25
|
-
*/
|
|
26
|
-
export { ImageLoadError } from './ImageLoadError';
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use `import { isMediaCardError } from '@atlaskit/media-card/is-media-card-error'` instead.
|
|
29
|
-
*/
|
|
30
|
-
export { isMediaCardError } from './isMediaCardError';
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Use `import { isLocalPreviewError } from '@atlaskit/media-card/is-local-preview-error'` instead.
|
|
33
|
-
*/
|
|
34
|
-
export { isLocalPreviewError } from './isLocalPreviewError';
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Use `import { isRemotePreviewError } from '@atlaskit/media-card/is-remote-preview-error'` instead.
|
|
37
|
-
*/
|
|
38
|
-
export { isRemotePreviewError } from './isRemotePreviewError';
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use `import { isUnsupportedLocalPreviewError } from '@atlaskit/media-card/is-unsupported-local-preview-error'` instead.
|
|
41
|
-
*/
|
|
42
|
-
export { isUnsupportedLocalPreviewError } from './isUnsupportedLocalPreviewError';
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `import { isImageLoadError } from '@atlaskit/media-card/is-image-load-error'` instead.
|
|
45
|
-
*/
|
|
46
|
-
export { isImageLoadError } from './isImageLoadError';
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Use `import { ensureMediaCardError } from '@atlaskit/media-card/ensure-media-card-error'` instead.
|
|
49
|
-
*/
|
|
50
|
-
export { ensureMediaCardError } from './ensureMediaCardError';
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated Use `import { isUploadError } from '@atlaskit/media-card/is-upload-error'` instead.
|
|
53
|
-
*/
|
|
54
|
-
export { isUploadError } from './isUploadError';
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "
|
|
104
|
+
packageName: "82.0.0",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -15,7 +15,6 @@ import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
|
15
15
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
17
17
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
18
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
18
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
20
19
|
import { MediaCardError } from '../MediaCardError';
|
|
21
20
|
import { fireMediaCardEvent } from '../utils/analytics/fireMediaCardEvent';
|
|
@@ -122,7 +121,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
122
121
|
selectedItem: identifier,
|
|
123
122
|
onClose: onMediaViewerClose,
|
|
124
123
|
viewerOptions: viewerOptions,
|
|
125
|
-
fallbackMediaNameFetcher:
|
|
124
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
126
125
|
}), document.body);
|
|
127
126
|
}
|
|
128
127
|
return null;
|
|
@@ -155,7 +154,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
155
154
|
};
|
|
156
155
|
}, [identifier.collectionName, identifier.id, mediaClient.file]);
|
|
157
156
|
useEffect(function () {
|
|
158
|
-
if (fileState && fileState.status !== 'error' && !fileState.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current
|
|
157
|
+
if (fileState && fileState.status !== 'error' && !fileState.name && fallbackMediaNameFetcher && !fallbackMediaNameFetchAttempted.current) {
|
|
159
158
|
fallbackMediaNameFetchAttempted.current = true;
|
|
160
159
|
fallbackMediaNameFetcher(fileState.id).then(function (name) {
|
|
161
160
|
return setFallbackMediaName(name);
|
|
@@ -188,7 +187,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
188
187
|
|
|
189
188
|
// Empty file handling — try the fallback name fetcher first if available
|
|
190
189
|
if (fileState && !fileState.name) {
|
|
191
|
-
if (fallbackMediaNameFetcher && !fallbackMediaNameFetchFailed && !fallbackMediaName
|
|
190
|
+
if (fallbackMediaNameFetcher && !fallbackMediaNameFetchFailed && !fallbackMediaName) {
|
|
192
191
|
// Fetch not yet attempted or in flight — show loading
|
|
193
192
|
return /*#__PURE__*/React.createElement(MediaInlineCardLoadingView, {
|
|
194
193
|
innerRef: copyNodeRef,
|
|
@@ -196,7 +195,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
196
195
|
isSelected: isSelected
|
|
197
196
|
});
|
|
198
197
|
}
|
|
199
|
-
if (!
|
|
198
|
+
if (!fallbackMediaName) {
|
|
200
199
|
// No fetcher provided or fetch failed — show error
|
|
201
200
|
var _error = new MediaCardError('metadata-fetch', new FileFetcherError('emptyFileName', {
|
|
202
201
|
id: fileState.id
|
|
@@ -232,7 +231,7 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
232
231
|
var mediaType = fileState.mediaType,
|
|
233
232
|
fileStateName = fileState.name,
|
|
234
233
|
mimeType = fileState.mimeType;
|
|
235
|
-
var name =
|
|
234
|
+
var name = fileStateName || fallbackMediaName;
|
|
236
235
|
var linkIcon = /*#__PURE__*/React.createElement(MimeTypeIcon, {
|
|
237
236
|
testId: 'media-inline-card-file-type-icon',
|
|
238
237
|
size: "small",
|
package/dist/esm/types.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
1
|
/**
|
|
3
2
|
* Entry Point: @atlaskit/media-card/types
|
|
4
3
|
*/
|
|
@@ -7,20 +6,4 @@ export var MediaCardCursor = /*#__PURE__*/function (MediaCardCursor) {
|
|
|
7
6
|
MediaCardCursor["Action"] = "pointer";
|
|
8
7
|
MediaCardCursor["NotReady"] = "wait";
|
|
9
8
|
return MediaCardCursor;
|
|
10
|
-
}({});
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `import { isSSRPreview } from '@atlaskit/media-card/is-ssr-preview'` instead.
|
|
13
|
-
*/
|
|
14
|
-
export { isSSRPreview } from './isSSRPreview';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `import { isSSRServerPreview } from '@atlaskit/media-card/is-ssr-server-preview'` instead.
|
|
17
|
-
*/
|
|
18
|
-
export { isSSRServerPreview } from './isSSRServerPreview';
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `import { isSSRClientPreview } from '@atlaskit/media-card/is-ssr-client-preview'` instead.
|
|
21
|
-
*/
|
|
22
|
-
export { isSSRClientPreview } from './isSSRClientPreview';
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use `import { isSSRDataPreview } from '@atlaskit/media-card/is-ssr-data-preview'` instead.
|
|
25
|
-
*/
|
|
26
|
-
export { isSSRDataPreview } from './isSSRDataPreview';
|
|
9
|
+
}({});
|
|
@@ -16,7 +16,7 @@ import { extractErrorInfo } from './analytics/extractErrorInfo';
|
|
|
16
16
|
import { getRenderErrorRequestMetadata } from './analytics/getRenderErrorRequestMetadata';
|
|
17
17
|
import { getMediaGlobalScope } from './globalScope/getMediaGlobalScope';
|
|
18
18
|
var packageName = "@atlaskit/media-card";
|
|
19
|
-
var packageVersion = "
|
|
19
|
+
var packageVersion = "82.0.0";
|
|
20
20
|
var SAMPLE_RATE = 0.05;
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -8,11 +8,3 @@ export interface CardAction {
|
|
|
8
8
|
tooltip?: string;
|
|
9
9
|
}
|
|
10
10
|
export type CardEventHandler = (item?: FileItem, event?: Event) => void;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `import { attachDetailsToActions } from '@atlaskit/media-card/attach-details-to-actions'` instead.
|
|
13
|
-
*/
|
|
14
|
-
export { attachDetailsToActions } from './attachDetailsToActions';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `import { createDownloadAction } from '@atlaskit/media-card/create-download-action'` instead.
|
|
17
|
-
*/
|
|
18
|
-
export { createDownloadAction } from './createDownloadAction';
|
|
@@ -89,12 +89,13 @@ export interface FileCardProps extends CardEventProps {
|
|
|
89
89
|
readonly ssrMediaItem?: SsrMediaItem;
|
|
90
90
|
/** General Error handling include status errors and display errors*/
|
|
91
91
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
92
|
-
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
92
|
+
/** Extensions for the media viewer (e.g. comment button in header, sidebar with comment indicator). */
|
|
93
93
|
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
94
94
|
/**
|
|
95
95
|
* Optional fallback fetcher to retrieve the media filename from another service.
|
|
96
96
|
* Workaround for #hot-301450 where media service is missing filenames for DC -> Cloud migrated media.
|
|
97
97
|
* Receives the file ID and should resolve to the filename string.
|
|
98
|
+
* TODO: Remove this prop when fallback-fetcher usage is sufficiently low.
|
|
98
99
|
*/
|
|
99
100
|
readonly fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
100
101
|
}
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -3,56 +3,4 @@ export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-previe
|
|
|
3
3
|
export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
4
4
|
export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
5
5
|
export type SvgPrimaryReason = 'svg-img-error' | 'svg-binary-fetch' | 'svg-blob-to-datauri' | 'svg-unknown-error';
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `import { MediaCardError } from '@atlaskit/media-card/media-card-error'` instead.
|
|
8
|
-
*/
|
|
9
|
-
export { MediaCardError } from './MediaCardError';
|
|
10
6
|
export type { MediaCardErrorPrimaryReason } from './MediaCardError';
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `import { LocalPreviewError } from '@atlaskit/media-card/local-preview-error'` instead.
|
|
13
|
-
*/
|
|
14
|
-
export { LocalPreviewError } from './LocalPreviewError';
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `import { RemotePreviewError } from '@atlaskit/media-card/remote-preview-error'` instead.
|
|
17
|
-
*/
|
|
18
|
-
export { RemotePreviewError } from './RemotePreviewError';
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `import { SsrPreviewError } from '@atlaskit/media-card/ssr-preview-error'` instead.
|
|
21
|
-
*/
|
|
22
|
-
export { SsrPreviewError } from './SsrPreviewError';
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use `import { getImageLoadPrimaryReason } from '@atlaskit/media-card/get-image-load-primary-reason'` instead.
|
|
25
|
-
*/
|
|
26
|
-
export { getImageLoadPrimaryReason } from './getImageLoadPrimaryReason';
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use `import { ImageLoadError } from '@atlaskit/media-card/image-load-error'` instead.
|
|
29
|
-
*/
|
|
30
|
-
export { ImageLoadError } from './ImageLoadError';
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Use `import { isMediaCardError } from '@atlaskit/media-card/is-media-card-error'` instead.
|
|
33
|
-
*/
|
|
34
|
-
export { isMediaCardError } from './isMediaCardError';
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Use `import { isLocalPreviewError } from '@atlaskit/media-card/is-local-preview-error'` instead.
|
|
37
|
-
*/
|
|
38
|
-
export { isLocalPreviewError } from './isLocalPreviewError';
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use `import { isRemotePreviewError } from '@atlaskit/media-card/is-remote-preview-error'` instead.
|
|
41
|
-
*/
|
|
42
|
-
export { isRemotePreviewError } from './isRemotePreviewError';
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `import { isUnsupportedLocalPreviewError } from '@atlaskit/media-card/is-unsupported-local-preview-error'` instead.
|
|
45
|
-
*/
|
|
46
|
-
export { isUnsupportedLocalPreviewError } from './isUnsupportedLocalPreviewError';
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Use `import { isImageLoadError } from '@atlaskit/media-card/is-image-load-error'` instead.
|
|
49
|
-
*/
|
|
50
|
-
export { isImageLoadError } from './isImageLoadError';
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated Use `import { ensureMediaCardError } from '@atlaskit/media-card/ensure-media-card-error'` instead.
|
|
53
|
-
*/
|
|
54
|
-
export { ensureMediaCardError } from './ensureMediaCardError';
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated Use `import { isUploadError } from '@atlaskit/media-card/is-upload-error'` instead.
|
|
57
|
-
*/
|
|
58
|
-
export { isUploadError } from './isUploadError';
|
|
@@ -17,6 +17,7 @@ export interface MediaInlineCardProps {
|
|
|
17
17
|
* Optional fallback fetcher to retrieve the media filename from another service
|
|
18
18
|
* Workaround for #hot-301450 where media service is missing filenames for DC -> Cloud migrated media
|
|
19
19
|
* Receives the file ID and should resolve to the filename string.
|
|
20
|
+
* TODO: Remove this prop when fallback-fetcher usage is sufficiently low.
|
|
20
21
|
*/
|
|
21
22
|
fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
22
23
|
/**
|
package/dist/types/types.d.ts
CHANGED
|
@@ -132,7 +132,7 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
132
132
|
readonly ssrMediaItem?: SsrMediaItem;
|
|
133
133
|
/** General Error handling include status errors and display errors*/
|
|
134
134
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
135
|
-
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
135
|
+
/** Extensions for the media viewer (e.g. comment button in header, sidebar with comment indicator). */
|
|
136
136
|
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
137
137
|
/**
|
|
138
138
|
* Optional fallback fetcher to retrieve the media filename from another service.
|
|
@@ -157,19 +157,3 @@ export interface CardState {
|
|
|
157
157
|
wasResolvedUpfrontPreview: boolean;
|
|
158
158
|
shouldUpdateStateForIdentifier?: boolean;
|
|
159
159
|
}
|
|
160
|
-
/**
|
|
161
|
-
* @deprecated Use `import { isSSRPreview } from '@atlaskit/media-card/is-ssr-preview'` instead.
|
|
162
|
-
*/
|
|
163
|
-
export { isSSRPreview } from './isSSRPreview';
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated Use `import { isSSRServerPreview } from '@atlaskit/media-card/is-ssr-server-preview'` instead.
|
|
166
|
-
*/
|
|
167
|
-
export { isSSRServerPreview } from './isSSRServerPreview';
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Use `import { isSSRClientPreview } from '@atlaskit/media-card/is-ssr-client-preview'` instead.
|
|
170
|
-
*/
|
|
171
|
-
export { isSSRClientPreview } from './isSSRClientPreview';
|
|
172
|
-
/**
|
|
173
|
-
* @deprecated Use `import { isSSRDataPreview } from '@atlaskit/media-card/is-ssr-data-preview'` instead.
|
|
174
|
-
*/
|
|
175
|
-
export { isSSRDataPreview } from './isSSRDataPreview';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "82.1.0",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,28 +36,29 @@
|
|
|
36
36
|
"@atlaskit/analytics-next": "^12.5.0",
|
|
37
37
|
"@atlaskit/dropdown-menu": "^18.3.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
39
|
-
"@atlaskit/icon": "^
|
|
39
|
+
"@atlaskit/icon": "^38.0.0",
|
|
40
40
|
"@atlaskit/interaction-context": "^4.1.0",
|
|
41
41
|
"@atlaskit/link": "^5.1.0",
|
|
42
|
-
"@atlaskit/media-client": "^
|
|
43
|
-
"@atlaskit/media-client-react": "^
|
|
42
|
+
"@atlaskit/media-client": "^39.0.0",
|
|
43
|
+
"@atlaskit/media-client-react": "^7.0.0",
|
|
44
44
|
"@atlaskit/media-common": "^14.6.0",
|
|
45
|
-
"@atlaskit/media-file-preview": "^
|
|
46
|
-
"@atlaskit/media-state": "^
|
|
47
|
-
"@atlaskit/media-svg": "^
|
|
48
|
-
"@atlaskit/media-ui": "^
|
|
49
|
-
"@atlaskit/media-viewer": "^54.
|
|
45
|
+
"@atlaskit/media-file-preview": "^2.0.0",
|
|
46
|
+
"@atlaskit/media-state": "^4.0.0",
|
|
47
|
+
"@atlaskit/media-svg": "^4.0.0",
|
|
48
|
+
"@atlaskit/media-ui": "^31.0.0",
|
|
49
|
+
"@atlaskit/media-viewer": "^54.9.0",
|
|
50
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
50
51
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
51
52
|
"@atlaskit/primitives": "^22.5.0",
|
|
52
53
|
"@atlaskit/progress-bar": "^5.3.0",
|
|
53
54
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
54
|
-
"@atlaskit/react-ufo": "^
|
|
55
|
+
"@atlaskit/react-ufo": "^8.0.0",
|
|
55
56
|
"@atlaskit/section-message": "^10.2.0",
|
|
56
57
|
"@atlaskit/theme": "^28.2.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
58
|
-
"@atlaskit/tokens": "^
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^206.0.0",
|
|
59
|
+
"@atlaskit/tokens": "^20.0.0",
|
|
59
60
|
"@atlaskit/tooltip": "^24.3.0",
|
|
60
|
-
"@atlaskit/ufo": "^
|
|
61
|
+
"@atlaskit/ufo": "^2.0.0",
|
|
61
62
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
62
63
|
"@babel/runtime": "^7.0.0",
|
|
63
64
|
"@compiled/react": "^1.0.2",
|
|
@@ -79,22 +80,23 @@
|
|
|
79
80
|
"@atlaskit/analytics-namespaced-context": "^8.2.0",
|
|
80
81
|
"@atlaskit/button": "^25.4.0",
|
|
81
82
|
"@atlaskit/checkbox": "^19.2.0",
|
|
82
|
-
"@atlaskit/form": "^
|
|
83
|
-
"@atlaskit/heading": "^
|
|
83
|
+
"@atlaskit/form": "^18.0.0",
|
|
84
|
+
"@atlaskit/heading": "^8.0.0",
|
|
84
85
|
"@atlaskit/inline-message": "^16.4.0",
|
|
85
|
-
"@atlaskit/media-core": "^
|
|
86
|
-
"@atlaskit/media-picker": "^
|
|
86
|
+
"@atlaskit/media-core": "^39.0.0",
|
|
87
|
+
"@atlaskit/media-picker": "^73.0.0",
|
|
87
88
|
"@atlaskit/media-test-data": "^4.0.0",
|
|
88
|
-
"@atlaskit/media-test-helpers": "^
|
|
89
|
+
"@atlaskit/media-test-helpers": "^43.0.0",
|
|
89
90
|
"@atlaskit/radio": "^10.2.0",
|
|
90
91
|
"@atlaskit/range": "^12.2.0",
|
|
91
|
-
"@atlaskit/select": "^
|
|
92
|
+
"@atlaskit/select": "^23.0.0",
|
|
92
93
|
"@atlaskit/ssr": "workspace:^",
|
|
93
94
|
"@atlaskit/toggle": "^17.3.0",
|
|
94
95
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
96
|
+
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
95
97
|
"@atlassian/feature-flags-test-utils": "^1.3.0",
|
|
96
98
|
"@atlassian/testing-library": "^0.11.0",
|
|
97
|
-
"@atlassian/ufo": "^0.
|
|
99
|
+
"@atlassian/ufo": "^1.0.0",
|
|
98
100
|
"@atlassian/workbench": "workspace:^",
|
|
99
101
|
"@testing-library/dom": "^10.1.0",
|
|
100
102
|
"@testing-library/react": "^16.3.0",
|