@atlaskit/media-card 80.6.0 → 80.7.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 +22 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardView.js +6 -3
- package/dist/cjs/card/fileCard.js +11 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/svgView/svgImage-compiled.js +6 -3
- package/dist/cjs/card/svgView/svgViewV2.js +4 -2
- package/dist/cjs/card/ui/imageRenderer/imageRendererV2.js +2 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineCard.js +12 -2
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardView.js +6 -3
- package/dist/es2019/card/fileCard.js +11 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/svgView/svgImage-compiled.js +6 -3
- package/dist/es2019/card/svgView/svgViewV2.js +4 -2
- package/dist/es2019/card/ui/imageRenderer/imageRendererV2.js +2 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineCard.js +12 -2
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/cardView.js +6 -3
- package/dist/esm/card/fileCard.js +11 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/svgView/svgImage-compiled.js +6 -3
- package/dist/esm/card/svgView/svgViewV2.js +4 -2
- package/dist/esm/card/ui/imageRenderer/imageRendererV2.js +2 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineCard.js +12 -2
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/cardView.d.ts +2 -1
- package/dist/types/card/fileCard.d.ts +15 -3
- package/dist/types/card/svgView/svgImage-compiled.d.ts +1 -1
- package/dist/types/card/svgView/svgViewV2.d.ts +1 -1
- package/dist/types/card/svgView/types.d.ts +1 -0
- package/dist/types/card/ui/imageRenderer/imageRendererV2.d.ts +1 -1
- package/dist/types/card/ui/imageRenderer/types.d.ts +1 -0
- package/dist/types/inline/mediaInlineCard.d.ts +9 -1
- package/dist/types/types.d.ts +9 -0
- package/dist/types-ts4.5/card/cardView.d.ts +2 -1
- package/dist/types-ts4.5/card/fileCard.d.ts +15 -3
- package/dist/types-ts4.5/card/svgView/svgImage-compiled.d.ts +1 -1
- package/dist/types-ts4.5/card/svgView/svgViewV2.d.ts +1 -1
- package/dist/types-ts4.5/card/svgView/types.d.ts +1 -0
- package/dist/types-ts4.5/card/ui/imageRenderer/imageRendererV2.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/imageRenderer/types.d.ts +1 -0
- package/dist/types-ts4.5/inline/mediaInlineCard.d.ts +9 -1
- package/dist/types-ts4.5/types.d.ts +9 -0
- package/package.json +13 -10
- package/report.api.md +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 80.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2c10000a3bba9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2c10000a3bba9) -
|
|
8
|
+
Adding `backgroundColor` prop to allow overriding background color
|
|
9
|
+
- [`a68f551856a81`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a68f551856a81) -
|
|
10
|
+
Add ssrFileState prop to FileCard and MediaInlineCard for SSR metadata seeding via Relay
|
|
11
|
+
fragments. Deprecate ssrItemDetails in favour of ssrFileState. Cards now use initialFileState in
|
|
12
|
+
useFileState to display pre-hydrated data immediately without an items() API call when
|
|
13
|
+
platform_media_ssr_data_seed gate is on.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 80.6.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 80.6.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -20,7 +20,7 @@ var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
|
|
|
20
20
|
var _excluded = ["identifier"];
|
|
21
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
22
|
var packageName = "@atlaskit/media-card";
|
|
23
|
-
var packageVersion = "80.
|
|
23
|
+
var packageVersion = "80.6.1";
|
|
24
24
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
25
25
|
var identifier = _ref.identifier,
|
|
26
26
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -90,7 +90,8 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
90
90
|
onSvgError = _ref.onSvgError,
|
|
91
91
|
onSvgLoad = _ref.onSvgLoad,
|
|
92
92
|
traceId = _ref.traceId,
|
|
93
|
-
isAIGenerating = _ref.isAIGenerating
|
|
93
|
+
isAIGenerating = _ref.isAIGenerating,
|
|
94
|
+
backgroundColor = _ref.backgroundColor;
|
|
94
95
|
var intl = (0, _reactIntl.useIntl)();
|
|
95
96
|
var _useState = (0, _react.useState)(false),
|
|
96
97
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -311,7 +312,8 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
311
312
|
resizeMode: resizeMode || 'crop',
|
|
312
313
|
onError: onSvgError,
|
|
313
314
|
onLoad: onSvgLoadBase,
|
|
314
|
-
wrapperRef: divRef
|
|
315
|
+
wrapperRef: divRef,
|
|
316
|
+
backgroundColor: backgroundColor
|
|
315
317
|
}), renderImageRenderer && identifier && /*#__PURE__*/_react.default.createElement(_imageRenderer.ImageRenderer, {
|
|
316
318
|
cardPreview: cardPreview,
|
|
317
319
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
@@ -323,7 +325,8 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
323
325
|
nativeLazyLoad: nativeLazyLoad,
|
|
324
326
|
forceSyncDisplay: forceSyncDisplay,
|
|
325
327
|
identifier: identifier,
|
|
326
|
-
wrapperRef: divRef
|
|
328
|
+
wrapperRef: divRef,
|
|
329
|
+
backgroundColor: backgroundColor
|
|
327
330
|
}), renderPlayButton && /*#__PURE__*/_react.default.createElement(_iconWrapper.IconWrapper, {
|
|
328
331
|
breakpoint: breakpoint,
|
|
329
332
|
hasTitleBox: hasVisibleTitleBox
|
|
@@ -85,6 +85,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
85
85
|
testId = _ref.testId,
|
|
86
86
|
titleBoxBgColor = _ref.titleBoxBgColor,
|
|
87
87
|
titleBoxIcon = _ref.titleBoxIcon,
|
|
88
|
+
backgroundColor = _ref.backgroundColor,
|
|
88
89
|
isAIGenerating = _ref.isAIGenerating,
|
|
89
90
|
onPreviewRender = _ref.onPreviewRender,
|
|
90
91
|
shouldHideTooltip = _ref.shouldHideTooltip,
|
|
@@ -95,6 +96,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
95
96
|
viewerOptions = _ref.viewerOptions,
|
|
96
97
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
97
98
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
99
|
+
ssrFileState = _ref.ssrFileState,
|
|
98
100
|
onError = _ref.onError,
|
|
99
101
|
mediaViewerExtensions = _ref.mediaViewerExtensions;
|
|
100
102
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
@@ -135,11 +137,17 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
135
137
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
136
138
|
isCardVisible = _useState6[0],
|
|
137
139
|
setIsCardVisible = _useState6[1];
|
|
140
|
+
|
|
141
|
+
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
142
|
+
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
143
|
+
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
144
|
+
var initialFileState = (0, _platformFeatureFlags.fg)('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
138
145
|
var _useFileState = (0, _mediaClientReact.useFileState)(identifier.id, {
|
|
139
146
|
skipRemote: !isCardVisible,
|
|
140
147
|
collectionName: identifier.collectionName,
|
|
141
148
|
occurrenceKey: identifier.occurrenceKey,
|
|
142
|
-
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
149
|
+
includeHashForDuplicateFiles: includeHashForDuplicateFiles,
|
|
150
|
+
initialFileState: initialFileState
|
|
143
151
|
}),
|
|
144
152
|
fileState = _useFileState.fileState;
|
|
145
153
|
var prevFileState = (0, _usePrevious.usePrevious)(fileState && (0, _mediaClient.isErrorFileState)(fileState) ? undefined : fileState);
|
|
@@ -206,6 +214,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
206
214
|
}) : undefined;
|
|
207
215
|
}, [alt, previewDimensions, contextId, fileStateValue, identifier, originalDimensions]);
|
|
208
216
|
var _useFilePreview = (0, _mediaFilePreview.useFilePreview)({
|
|
217
|
+
initialFileState: initialFileState,
|
|
209
218
|
useSrcSet: true,
|
|
210
219
|
mediaBlobUrlAttrs: mediaBlobUrlAttrs,
|
|
211
220
|
resizeMode: (0, _mediaClient.imageResizeModeToFileImageMode)(resizeMode),
|
|
@@ -732,6 +741,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
732
741
|
testId: testId,
|
|
733
742
|
titleBoxBgColor: titleBoxBgColor,
|
|
734
743
|
titleBoxIcon: titleBoxIcon,
|
|
744
|
+
backgroundColor: backgroundColor,
|
|
735
745
|
onImageError: withCallbacks ? onImageError : undefined,
|
|
736
746
|
onImageLoad: withCallbacks ? onImageLoad : undefined,
|
|
737
747
|
onSvgError: onSvgError,
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "80.
|
|
90
|
+
var packageVersion = "80.6.1";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -30,7 +30,8 @@ var getErrorReason = function getErrorReason(svgReason) {
|
|
|
30
30
|
return 'svg-unknown-error';
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
var
|
|
33
|
+
var svgRendererBaseStyles = null;
|
|
34
|
+
var svgRendererWhiteBgStyles = null;
|
|
34
35
|
var svgRendererMaxDimensionStyles = null;
|
|
35
36
|
var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
36
37
|
var identifier = _ref.identifier,
|
|
@@ -38,7 +39,8 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
|
38
39
|
onLoad = _ref.onLoad,
|
|
39
40
|
onError = _ref.onError,
|
|
40
41
|
wrapperRef = _ref.wrapperRef,
|
|
41
|
-
alt = _ref.alt
|
|
42
|
+
alt = _ref.alt,
|
|
43
|
+
backgroundColor = _ref.backgroundColor;
|
|
42
44
|
var _useState = (0, _react.useState)(false),
|
|
43
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
46
|
didSvgRender = _useState2[0],
|
|
@@ -81,6 +83,7 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
|
81
83
|
src: svgUrl,
|
|
82
84
|
alt: alt,
|
|
83
85
|
style: _objectSpread({
|
|
86
|
+
backgroundColor: backgroundColor,
|
|
84
87
|
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
85
88
|
}, svgDimensions),
|
|
86
89
|
onLoad: onSvgLoad,
|
|
@@ -88,6 +91,6 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
|
88
91
|
onSvgError(new _mediaSvg.MediaSVGError('img-error'));
|
|
89
92
|
},
|
|
90
93
|
ref: imgRef,
|
|
91
|
-
className: (0, _runtime.ax)(["_5ral1f51 _bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
94
|
+
className: (0, _runtime.ax)(["_5ral1f51", !backgroundColor && "_bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
92
95
|
}) : null;
|
|
93
96
|
};
|
|
@@ -36,7 +36,8 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
|
36
36
|
onLoad = _ref.onLoad,
|
|
37
37
|
onError = _ref.onError,
|
|
38
38
|
wrapperRef = _ref.wrapperRef,
|
|
39
|
-
alt = _ref.alt
|
|
39
|
+
alt = _ref.alt,
|
|
40
|
+
backgroundColor = _ref.backgroundColor;
|
|
40
41
|
var onSvgError = function onSvgError(err) {
|
|
41
42
|
var error = new _errors.MediaCardError(getErrorReason(err.primaryReason), err.secondaryError);
|
|
42
43
|
onError === null || onError === void 0 || onError(error);
|
|
@@ -62,6 +63,7 @@ var SvgView = exports.SvgView = function SvgView(_ref) {
|
|
|
62
63
|
},
|
|
63
64
|
wrapperRef: wrapperRef,
|
|
64
65
|
mediaType: "image",
|
|
65
|
-
useWhiteBackground:
|
|
66
|
+
useWhiteBackground: !backgroundColor,
|
|
67
|
+
backgroundColor: backgroundColor
|
|
66
68
|
}) : null;
|
|
67
69
|
};
|
|
@@ -40,6 +40,7 @@ var ImageRenderer = exports.ImageRenderer = function ImageRenderer(_ref) {
|
|
|
40
40
|
identifier = _ref.identifier,
|
|
41
41
|
wrapperRef = _ref.wrapperRef,
|
|
42
42
|
useWhiteBackground = _ref.useWhiteBackground,
|
|
43
|
+
backgroundColor = _ref.backgroundColor,
|
|
43
44
|
testId = _ref.testId;
|
|
44
45
|
var onDisplayImageRef = (0, _useCurrentValueRef.useCurrentValueRef)(onDisplayImage);
|
|
45
46
|
var ufoContext = (0, _interactionContext.useInteractionContext)();
|
|
@@ -112,6 +113,7 @@ var ImageRenderer = exports.ImageRenderer = function ImageRenderer(_ref) {
|
|
|
112
113
|
onError: onError,
|
|
113
114
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
114
115
|
style: _objectSpread({
|
|
116
|
+
backgroundColor: backgroundColor,
|
|
115
117
|
visibility: didRender || forceSyncDisplay ? 'visible' : 'hidden'
|
|
116
118
|
}, resolvedDimensions),
|
|
117
119
|
className: (0, _runtime.ax)(["_5ral1f51", useWhiteBackground && "_bfhku67f"])
|
|
@@ -116,7 +116,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
116
116
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
117
117
|
var analyticsContext = {
|
|
118
118
|
packageVersion: "@atlaskit/media-card",
|
|
119
|
-
packageName: "80.
|
|
119
|
+
packageName: "80.6.1",
|
|
120
120
|
componentName: 'mediaInlineCard',
|
|
121
121
|
component: 'mediaInlineCard'
|
|
122
122
|
};
|
|
@@ -13,6 +13,7 @@ var _mediaUi = require("@atlaskit/media-ui");
|
|
|
13
13
|
var _formatDate = require("@atlaskit/media-ui/formatDate");
|
|
14
14
|
var _mimeTypeIcon = require("@atlaskit/media-ui/mime-type-icon");
|
|
15
15
|
var _mediaViewer = require("@atlaskit/media-viewer");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
19
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -35,8 +36,14 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
35
36
|
mediaViewerItems = _ref.mediaViewerItems,
|
|
36
37
|
intl = _ref.intl,
|
|
37
38
|
viewerOptions = _ref.viewerOptions,
|
|
38
|
-
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher
|
|
39
|
-
|
|
39
|
+
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
40
|
+
ssrFileState = _ref.ssrFileState;
|
|
41
|
+
var initialFileState = (0, _platformFeatureFlags.fg)('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
42
|
+
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
43
|
+
// the useEffect dependency array (including it would cause repeated
|
|
44
|
+
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
45
|
+
var initialFileStateRef = (0, _react.useRef)(initialFileState);
|
|
46
|
+
var _useState = (0, _react.useState)(initialFileState),
|
|
40
47
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
41
48
|
fileState = _useState2[0],
|
|
42
49
|
setFileState = _useState2[1];
|
|
@@ -128,6 +135,9 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
128
135
|
});
|
|
129
136
|
(0, _react.useEffect)(function () {
|
|
130
137
|
var subscription = mediaClient.file.getFileState(identifier.id, {
|
|
138
|
+
// Use the ref value so this effect doesn't re-run when ssrFileState
|
|
139
|
+
// changes object reference — initialFileState is a one-time SSR seed.
|
|
140
|
+
initialFileState: initialFileStateRef.current,
|
|
131
141
|
collectionName: identifier.collectionName
|
|
132
142
|
}).subscribe({
|
|
133
143
|
next: function next(fileState) {
|
|
@@ -19,7 +19,7 @@ var _globalScope = require("./globalScope/globalScope");
|
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
21
|
var packageName = "@atlaskit/media-card";
|
|
22
|
-
var packageVersion = "80.
|
|
22
|
+
var packageVersion = "80.6.1";
|
|
23
23
|
var SAMPLE_RATE = 0.05;
|
|
24
24
|
|
|
25
25
|
/**
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "80.
|
|
12
|
+
const packageVersion = "80.6.1";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -75,7 +75,8 @@ export const CardViewBase = ({
|
|
|
75
75
|
onSvgError,
|
|
76
76
|
onSvgLoad,
|
|
77
77
|
traceId,
|
|
78
|
-
isAIGenerating
|
|
78
|
+
isAIGenerating,
|
|
79
|
+
backgroundColor
|
|
79
80
|
}) => {
|
|
80
81
|
const intl = useIntl();
|
|
81
82
|
const [didSvgRender, setDidSvgRender] = useState(false);
|
|
@@ -300,7 +301,8 @@ export const CardViewBase = ({
|
|
|
300
301
|
resizeMode: resizeMode || 'crop',
|
|
301
302
|
onError: onSvgError,
|
|
302
303
|
onLoad: onSvgLoadBase,
|
|
303
|
-
wrapperRef: divRef
|
|
304
|
+
wrapperRef: divRef,
|
|
305
|
+
backgroundColor: backgroundColor
|
|
304
306
|
}), renderImageRenderer && identifier && /*#__PURE__*/React.createElement(ImageRenderer, {
|
|
305
307
|
cardPreview: cardPreview,
|
|
306
308
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
@@ -312,7 +314,8 @@ export const CardViewBase = ({
|
|
|
312
314
|
nativeLazyLoad: nativeLazyLoad,
|
|
313
315
|
forceSyncDisplay: forceSyncDisplay,
|
|
314
316
|
identifier: identifier,
|
|
315
|
-
wrapperRef: divRef
|
|
317
|
+
wrapperRef: divRef,
|
|
318
|
+
backgroundColor: backgroundColor
|
|
316
319
|
}), renderPlayButton && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
317
320
|
breakpoint: breakpoint,
|
|
318
321
|
hasTitleBox: hasVisibleTitleBox
|
|
@@ -66,6 +66,7 @@ export const FileCard = ({
|
|
|
66
66
|
testId,
|
|
67
67
|
titleBoxBgColor,
|
|
68
68
|
titleBoxIcon,
|
|
69
|
+
backgroundColor,
|
|
69
70
|
isAIGenerating,
|
|
70
71
|
onPreviewRender,
|
|
71
72
|
shouldHideTooltip,
|
|
@@ -76,6 +77,7 @@ export const FileCard = ({
|
|
|
76
77
|
viewerOptions,
|
|
77
78
|
includeHashForDuplicateFiles,
|
|
78
79
|
ssrItemDetails,
|
|
80
|
+
ssrFileState,
|
|
79
81
|
onError,
|
|
80
82
|
mediaViewerExtensions
|
|
81
83
|
}) => {
|
|
@@ -107,13 +109,19 @@ export const FileCard = ({
|
|
|
107
109
|
element: cardElement
|
|
108
110
|
}), [cardDimensions, cardElement]);
|
|
109
111
|
const [isCardVisible, setIsCardVisible] = useState(!isLazy);
|
|
112
|
+
|
|
113
|
+
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
114
|
+
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
115
|
+
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
116
|
+
const initialFileState = fg('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
110
117
|
const {
|
|
111
118
|
fileState
|
|
112
119
|
} = useFileState(identifier.id, {
|
|
113
120
|
skipRemote: !isCardVisible,
|
|
114
121
|
collectionName: identifier.collectionName,
|
|
115
122
|
occurrenceKey: identifier.occurrenceKey,
|
|
116
|
-
includeHashForDuplicateFiles
|
|
123
|
+
includeHashForDuplicateFiles,
|
|
124
|
+
initialFileState
|
|
117
125
|
});
|
|
118
126
|
const prevFileState = usePrevious(fileState && isErrorFileState(fileState) ? undefined : fileState);
|
|
119
127
|
const fileStateValue = useMemo(() => {
|
|
@@ -176,6 +184,7 @@ export const FileCard = ({
|
|
|
176
184
|
getSsrScriptProps,
|
|
177
185
|
copyNodeRef
|
|
178
186
|
} = useFilePreview({
|
|
187
|
+
initialFileState: initialFileState,
|
|
179
188
|
useSrcSet: true,
|
|
180
189
|
mediaBlobUrlAttrs,
|
|
181
190
|
resizeMode: imageResizeModeToFileImageMode(resizeMode),
|
|
@@ -652,6 +661,7 @@ export const FileCard = ({
|
|
|
652
661
|
testId: testId,
|
|
653
662
|
titleBoxBgColor: titleBoxBgColor,
|
|
654
663
|
titleBoxIcon: titleBoxIcon,
|
|
664
|
+
backgroundColor: backgroundColor,
|
|
655
665
|
onImageError: withCallbacks ? onImageError : undefined,
|
|
656
666
|
onImageLoad: withCallbacks ? onImageLoad : undefined,
|
|
657
667
|
onSvgError: onSvgError,
|
|
@@ -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 = "80.
|
|
69
|
+
const packageVersion = "80.6.1";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -17,7 +17,8 @@ const getErrorReason = svgReason => {
|
|
|
17
17
|
return 'svg-unknown-error';
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const svgRendererBaseStyles = null;
|
|
21
|
+
const svgRendererWhiteBgStyles = null;
|
|
21
22
|
const svgRendererMaxDimensionStyles = null;
|
|
22
23
|
export const SvgView = ({
|
|
23
24
|
identifier,
|
|
@@ -25,7 +26,8 @@ export const SvgView = ({
|
|
|
25
26
|
onLoad,
|
|
26
27
|
onError,
|
|
27
28
|
wrapperRef,
|
|
28
|
-
alt
|
|
29
|
+
alt,
|
|
30
|
+
backgroundColor
|
|
29
31
|
}) => {
|
|
30
32
|
const [didSvgRender, setDidSvgRender] = useState(false);
|
|
31
33
|
const [svgDimensions, setSvgDimensions] = useState({});
|
|
@@ -66,6 +68,7 @@ export const SvgView = ({
|
|
|
66
68
|
src: svgUrl,
|
|
67
69
|
alt: alt,
|
|
68
70
|
style: {
|
|
71
|
+
backgroundColor,
|
|
69
72
|
visibility: didSvgRender ? 'visible' : 'hidden',
|
|
70
73
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
71
74
|
...svgDimensions
|
|
@@ -75,6 +78,6 @@ export const SvgView = ({
|
|
|
75
78
|
onSvgError(new MediaSVGError('img-error'));
|
|
76
79
|
},
|
|
77
80
|
ref: imgRef,
|
|
78
|
-
className: ax(["_5ral1f51 _bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
81
|
+
className: ax(["_5ral1f51", !backgroundColor && "_bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
79
82
|
}) : null;
|
|
80
83
|
};
|
|
@@ -27,7 +27,8 @@ export const SvgView = ({
|
|
|
27
27
|
onLoad,
|
|
28
28
|
onError,
|
|
29
29
|
wrapperRef,
|
|
30
|
-
alt
|
|
30
|
+
alt,
|
|
31
|
+
backgroundColor
|
|
31
32
|
}) => {
|
|
32
33
|
const onSvgError = err => {
|
|
33
34
|
const error = new MediaCardError(getErrorReason(err.primaryReason), err.secondaryError);
|
|
@@ -53,6 +54,7 @@ export const SvgView = ({
|
|
|
53
54
|
},
|
|
54
55
|
wrapperRef: wrapperRef,
|
|
55
56
|
mediaType: "image",
|
|
56
|
-
useWhiteBackground:
|
|
57
|
+
useWhiteBackground: !backgroundColor,
|
|
58
|
+
backgroundColor: backgroundColor
|
|
57
59
|
}) : null;
|
|
58
60
|
};
|
|
@@ -25,6 +25,7 @@ export const ImageRenderer = ({
|
|
|
25
25
|
identifier,
|
|
26
26
|
wrapperRef,
|
|
27
27
|
useWhiteBackground,
|
|
28
|
+
backgroundColor,
|
|
28
29
|
testId
|
|
29
30
|
}) => {
|
|
30
31
|
const onDisplayImageRef = useCurrentValueRef(onDisplayImage);
|
|
@@ -92,6 +93,7 @@ export const ImageRenderer = ({
|
|
|
92
93
|
onError: onError,
|
|
93
94
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
94
95
|
style: {
|
|
96
|
+
backgroundColor,
|
|
95
97
|
visibility: didRender || forceSyncDisplay ? 'visible' : 'hidden',
|
|
96
98
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
97
99
|
...resolvedDimensions
|
|
@@ -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: "80.
|
|
40
|
+
packageName: "80.6.1",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -4,6 +4,7 @@ import { MediaInlineCardErroredView, MediaInlineCardLoadedView, MediaInlineCardL
|
|
|
4
4
|
import { formatDate } from '@atlaskit/media-ui/formatDate';
|
|
5
5
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
9
|
import React, { useEffect, useRef, useState } from 'react';
|
|
9
10
|
import ReactDOM from 'react-dom';
|
|
@@ -25,9 +26,15 @@ export const MediaInlineCardInternal = ({
|
|
|
25
26
|
mediaViewerItems,
|
|
26
27
|
intl,
|
|
27
28
|
viewerOptions,
|
|
28
|
-
fallbackMediaNameFetcher
|
|
29
|
+
fallbackMediaNameFetcher,
|
|
30
|
+
ssrFileState
|
|
29
31
|
}) => {
|
|
30
|
-
const
|
|
32
|
+
const initialFileState = fg('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
33
|
+
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
34
|
+
// the useEffect dependency array (including it would cause repeated
|
|
35
|
+
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
36
|
+
const initialFileStateRef = useRef(initialFileState);
|
|
37
|
+
const [fileState, setFileState] = useState(initialFileState);
|
|
31
38
|
const [subscribeError, setSubscribeError] = useState();
|
|
32
39
|
const [isSucceededEventSent, setIsSucceededEventSent] = useState(false);
|
|
33
40
|
const [isFailedEventSent, setIsFailedEventSent] = useState(false);
|
|
@@ -96,6 +103,9 @@ export const MediaInlineCardInternal = ({
|
|
|
96
103
|
});
|
|
97
104
|
useEffect(() => {
|
|
98
105
|
const subscription = mediaClient.file.getFileState(identifier.id, {
|
|
106
|
+
// Use the ref value so this effect doesn't re-run when ssrFileState
|
|
107
|
+
// changes object reference — initialFileState is a one-time SSR seed.
|
|
108
|
+
initialFileState: initialFileStateRef.current,
|
|
99
109
|
collectionName: identifier.collectionName
|
|
100
110
|
}).subscribe({
|
|
101
111
|
next: fileState => {
|
|
@@ -9,7 +9,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
9
9
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
10
10
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "80.
|
|
12
|
+
const packageVersion = "80.6.1";
|
|
13
13
|
const SAMPLE_RATE = 0.05;
|
|
14
14
|
|
|
15
15
|
/**
|
package/dist/esm/card/card.js
CHANGED
|
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "80.
|
|
14
|
+
var packageVersion = "80.6.1";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -81,7 +81,8 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
81
81
|
onSvgError = _ref.onSvgError,
|
|
82
82
|
onSvgLoad = _ref.onSvgLoad,
|
|
83
83
|
traceId = _ref.traceId,
|
|
84
|
-
isAIGenerating = _ref.isAIGenerating
|
|
84
|
+
isAIGenerating = _ref.isAIGenerating,
|
|
85
|
+
backgroundColor = _ref.backgroundColor;
|
|
85
86
|
var intl = useIntl();
|
|
86
87
|
var _useState = useState(false),
|
|
87
88
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -302,7 +303,8 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
302
303
|
resizeMode: resizeMode || 'crop',
|
|
303
304
|
onError: onSvgError,
|
|
304
305
|
onLoad: onSvgLoadBase,
|
|
305
|
-
wrapperRef: divRef
|
|
306
|
+
wrapperRef: divRef,
|
|
307
|
+
backgroundColor: backgroundColor
|
|
306
308
|
}), renderImageRenderer && identifier && /*#__PURE__*/React.createElement(ImageRenderer, {
|
|
307
309
|
cardPreview: cardPreview,
|
|
308
310
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
@@ -314,7 +316,8 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
314
316
|
nativeLazyLoad: nativeLazyLoad,
|
|
315
317
|
forceSyncDisplay: forceSyncDisplay,
|
|
316
318
|
identifier: identifier,
|
|
317
|
-
wrapperRef: divRef
|
|
319
|
+
wrapperRef: divRef,
|
|
320
|
+
backgroundColor: backgroundColor
|
|
318
321
|
}), renderPlayButton && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
319
322
|
breakpoint: breakpoint,
|
|
320
323
|
hasTitleBox: hasVisibleTitleBox
|
|
@@ -77,6 +77,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
77
77
|
testId = _ref.testId,
|
|
78
78
|
titleBoxBgColor = _ref.titleBoxBgColor,
|
|
79
79
|
titleBoxIcon = _ref.titleBoxIcon,
|
|
80
|
+
backgroundColor = _ref.backgroundColor,
|
|
80
81
|
isAIGenerating = _ref.isAIGenerating,
|
|
81
82
|
onPreviewRender = _ref.onPreviewRender,
|
|
82
83
|
shouldHideTooltip = _ref.shouldHideTooltip,
|
|
@@ -87,6 +88,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
87
88
|
viewerOptions = _ref.viewerOptions,
|
|
88
89
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
89
90
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
91
|
+
ssrFileState = _ref.ssrFileState,
|
|
90
92
|
onError = _ref.onError,
|
|
91
93
|
mediaViewerExtensions = _ref.mediaViewerExtensions;
|
|
92
94
|
var _useIntl = useIntl(),
|
|
@@ -127,11 +129,17 @@ export var FileCard = function FileCard(_ref) {
|
|
|
127
129
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
128
130
|
isCardVisible = _useState6[0],
|
|
129
131
|
setIsCardVisible = _useState6[1];
|
|
132
|
+
|
|
133
|
+
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
134
|
+
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
135
|
+
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
136
|
+
var initialFileState = fg('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
130
137
|
var _useFileState = useFileState(identifier.id, {
|
|
131
138
|
skipRemote: !isCardVisible,
|
|
132
139
|
collectionName: identifier.collectionName,
|
|
133
140
|
occurrenceKey: identifier.occurrenceKey,
|
|
134
|
-
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
141
|
+
includeHashForDuplicateFiles: includeHashForDuplicateFiles,
|
|
142
|
+
initialFileState: initialFileState
|
|
135
143
|
}),
|
|
136
144
|
fileState = _useFileState.fileState;
|
|
137
145
|
var prevFileState = usePrevious(fileState && isErrorFileState(fileState) ? undefined : fileState);
|
|
@@ -198,6 +206,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
198
206
|
}) : undefined;
|
|
199
207
|
}, [alt, previewDimensions, contextId, fileStateValue, identifier, originalDimensions]);
|
|
200
208
|
var _useFilePreview = useFilePreview({
|
|
209
|
+
initialFileState: initialFileState,
|
|
201
210
|
useSrcSet: true,
|
|
202
211
|
mediaBlobUrlAttrs: mediaBlobUrlAttrs,
|
|
203
212
|
resizeMode: imageResizeModeToFileImageMode(resizeMode),
|
|
@@ -724,6 +733,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
724
733
|
testId: testId,
|
|
725
734
|
titleBoxBgColor: titleBoxBgColor,
|
|
726
735
|
titleBoxIcon: titleBoxIcon,
|
|
736
|
+
backgroundColor: backgroundColor,
|
|
727
737
|
onImageError: withCallbacks ? onImageError : undefined,
|
|
728
738
|
onImageLoad: withCallbacks ? onImageLoad : undefined,
|
|
729
739
|
onSvgError: onSvgError,
|
|
@@ -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 = "80.
|
|
83
|
+
var packageVersion = "80.6.1";
|
|
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({
|
|
@@ -21,7 +21,8 @@ var getErrorReason = function getErrorReason(svgReason) {
|
|
|
21
21
|
return 'svg-unknown-error';
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
var
|
|
24
|
+
var svgRendererBaseStyles = null;
|
|
25
|
+
var svgRendererWhiteBgStyles = null;
|
|
25
26
|
var svgRendererMaxDimensionStyles = null;
|
|
26
27
|
export var SvgView = function SvgView(_ref) {
|
|
27
28
|
var identifier = _ref.identifier,
|
|
@@ -29,7 +30,8 @@ export var SvgView = function SvgView(_ref) {
|
|
|
29
30
|
onLoad = _ref.onLoad,
|
|
30
31
|
onError = _ref.onError,
|
|
31
32
|
wrapperRef = _ref.wrapperRef,
|
|
32
|
-
alt = _ref.alt
|
|
33
|
+
alt = _ref.alt,
|
|
34
|
+
backgroundColor = _ref.backgroundColor;
|
|
33
35
|
var _useState = useState(false),
|
|
34
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
37
|
didSvgRender = _useState2[0],
|
|
@@ -72,6 +74,7 @@ export var SvgView = function SvgView(_ref) {
|
|
|
72
74
|
src: svgUrl,
|
|
73
75
|
alt: alt,
|
|
74
76
|
style: _objectSpread({
|
|
77
|
+
backgroundColor: backgroundColor,
|
|
75
78
|
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
76
79
|
}, svgDimensions),
|
|
77
80
|
onLoad: onSvgLoad,
|
|
@@ -79,6 +82,6 @@ export var SvgView = function SvgView(_ref) {
|
|
|
79
82
|
onSvgError(new MediaSVGError('img-error'));
|
|
80
83
|
},
|
|
81
84
|
ref: imgRef,
|
|
82
|
-
className: ax(["_5ral1f51 _bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
85
|
+
className: ax(["_5ral1f51", !backgroundColor && "_bfhku67f", !width && !height && "_p12f1osq _c71l1osq"])
|
|
83
86
|
}) : null;
|
|
84
87
|
};
|
|
@@ -27,7 +27,8 @@ export var SvgView = function SvgView(_ref) {
|
|
|
27
27
|
onLoad = _ref.onLoad,
|
|
28
28
|
onError = _ref.onError,
|
|
29
29
|
wrapperRef = _ref.wrapperRef,
|
|
30
|
-
alt = _ref.alt
|
|
30
|
+
alt = _ref.alt,
|
|
31
|
+
backgroundColor = _ref.backgroundColor;
|
|
31
32
|
var onSvgError = function onSvgError(err) {
|
|
32
33
|
var error = new MediaCardError(getErrorReason(err.primaryReason), err.secondaryError);
|
|
33
34
|
onError === null || onError === void 0 || onError(error);
|
|
@@ -53,6 +54,7 @@ export var SvgView = function SvgView(_ref) {
|
|
|
53
54
|
},
|
|
54
55
|
wrapperRef: wrapperRef,
|
|
55
56
|
mediaType: "image",
|
|
56
|
-
useWhiteBackground:
|
|
57
|
+
useWhiteBackground: !backgroundColor,
|
|
58
|
+
backgroundColor: backgroundColor
|
|
57
59
|
}) : null;
|
|
58
60
|
};
|
|
@@ -31,6 +31,7 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
31
31
|
identifier = _ref.identifier,
|
|
32
32
|
wrapperRef = _ref.wrapperRef,
|
|
33
33
|
useWhiteBackground = _ref.useWhiteBackground,
|
|
34
|
+
backgroundColor = _ref.backgroundColor,
|
|
34
35
|
testId = _ref.testId;
|
|
35
36
|
var onDisplayImageRef = useCurrentValueRef(onDisplayImage);
|
|
36
37
|
var ufoContext = useInteractionContext();
|
|
@@ -103,6 +104,7 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
103
104
|
onError: onError,
|
|
104
105
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
105
106
|
style: _objectSpread({
|
|
107
|
+
backgroundColor: backgroundColor,
|
|
106
108
|
visibility: didRender || forceSyncDisplay ? 'visible' : 'hidden'
|
|
107
109
|
}, resolvedDimensions),
|
|
108
110
|
className: ax(["_5ral1f51", useWhiteBackground && "_bfhku67f"])
|
|
@@ -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: "80.
|
|
104
|
+
packageName: "80.6.1",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -5,6 +5,7 @@ import { MediaInlineCardErroredView, MediaInlineCardLoadedView, MediaInlineCardL
|
|
|
5
5
|
import { formatDate } from '@atlaskit/media-ui/formatDate';
|
|
6
6
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
7
7
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
10
|
import React, { useEffect, useRef, useState } from 'react';
|
|
10
11
|
import ReactDOM from 'react-dom';
|
|
@@ -26,8 +27,14 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
26
27
|
mediaViewerItems = _ref.mediaViewerItems,
|
|
27
28
|
intl = _ref.intl,
|
|
28
29
|
viewerOptions = _ref.viewerOptions,
|
|
29
|
-
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher
|
|
30
|
-
|
|
30
|
+
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
31
|
+
ssrFileState = _ref.ssrFileState;
|
|
32
|
+
var initialFileState = fg('platform_media_ssr_data_seed') ? ssrFileState : undefined;
|
|
33
|
+
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
34
|
+
// the useEffect dependency array (including it would cause repeated
|
|
35
|
+
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
36
|
+
var initialFileStateRef = useRef(initialFileState);
|
|
37
|
+
var _useState = useState(initialFileState),
|
|
31
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
39
|
fileState = _useState2[0],
|
|
33
40
|
setFileState = _useState2[1];
|
|
@@ -119,6 +126,9 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
119
126
|
});
|
|
120
127
|
useEffect(function () {
|
|
121
128
|
var subscription = mediaClient.file.getFileState(identifier.id, {
|
|
129
|
+
// Use the ref value so this effect doesn't re-run when ssrFileState
|
|
130
|
+
// changes object reference — initialFileState is a one-time SSR seed.
|
|
131
|
+
initialFileState: initialFileStateRef.current,
|
|
122
132
|
collectionName: identifier.collectionName
|
|
123
133
|
}).subscribe({
|
|
124
134
|
next: function next(fileState) {
|
|
@@ -13,7 +13,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
13
13
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
14
14
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
15
15
|
var packageName = "@atlaskit/media-card";
|
|
16
|
-
var packageVersion = "80.
|
|
16
|
+
var packageVersion = "80.6.1";
|
|
17
17
|
var SAMPLE_RATE = 0.05;
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -18,6 +18,7 @@ export interface CardViewProps {
|
|
|
18
18
|
readonly testId?: string;
|
|
19
19
|
readonly titleBoxBgColor?: string;
|
|
20
20
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
21
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
21
22
|
readonly status: CardStatus;
|
|
22
23
|
readonly mediaItemType: MediaItemType;
|
|
23
24
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
@@ -62,6 +63,6 @@ export interface RenderConfigByStatus {
|
|
|
62
63
|
customTitleMessage?: MessageDescriptor;
|
|
63
64
|
traceTooltipVariant?: TraceTooltipVariant;
|
|
64
65
|
}
|
|
65
|
-
export declare const CardViewBase: ({ identifier, innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, openMediaViewerButtonRef, shouldOpenMediaViewer, overriddenCreationDate, onSvgError, onSvgLoad, traceId, isAIGenerating, }: CardViewBaseProps) => React.JSX.Element;
|
|
66
|
+
export declare const CardViewBase: ({ identifier, innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, openMediaViewerButtonRef, shouldOpenMediaViewer, overriddenCreationDate, onSvgError, onSvgLoad, traceId, isAIGenerating, backgroundColor, }: CardViewBaseProps) => React.JSX.Element;
|
|
66
67
|
export declare const CardView: React.ForwardRefExoticComponent<Omit<CardViewProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
67
68
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
1
|
+
import { type FileIdentifier, type FileState, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
3
|
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
@@ -33,6 +33,8 @@ export interface FileCardProps extends CardEventProps {
|
|
|
33
33
|
readonly titleBoxBgColor?: string;
|
|
34
34
|
/** Sets the title box icon. */
|
|
35
35
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
36
|
+
/** Overrides the background color for media rendering (e.g. the default white background used for SVG transparency). */
|
|
37
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
36
38
|
/** Indicates the media card is being generated by AI (e.g. Rovo image-create). */
|
|
37
39
|
readonly isAIGenerating?: boolean;
|
|
38
40
|
/** Callback fired when the media card's image preview has rendered. */
|
|
@@ -59,11 +61,21 @@ export interface FileCardProps extends CardEventProps {
|
|
|
59
61
|
readonly viewerOptions?: ViewerOptionsProps;
|
|
60
62
|
/** Sets options for viewer **/
|
|
61
63
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
62
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `ssrFileState` instead (Phase 5b). Will be removed in a future major.
|
|
66
|
+
*/
|
|
63
67
|
readonly ssrItemDetails?: SsrItemDetails;
|
|
68
|
+
/**
|
|
69
|
+
* Pre-hydrated SSR metadata from a Relay fragment (Media Platform Phase 5b).
|
|
70
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
71
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
72
|
+
* whose `processingStatus` is `succeeded`.
|
|
73
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
74
|
+
*/
|
|
75
|
+
readonly ssrFileState?: FileState;
|
|
64
76
|
/** General Error handling include status errors and display errors*/
|
|
65
77
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
66
78
|
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
67
79
|
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
68
80
|
}
|
|
69
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, isAIGenerating, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
|
81
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, backgroundColor, isAIGenerating, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, ssrFileState, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SvgViewProps } from './types';
|
|
2
|
-
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, }: SvgViewProps) => JSX.Element | null;
|
|
2
|
+
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, backgroundColor, }: SvgViewProps) => JSX.Element | null;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { SvgViewProps } from './types';
|
|
7
|
-
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, }: SvgViewProps) => React.JSX.Element | null;
|
|
7
|
+
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, backgroundColor, }: SvgViewProps) => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ImageRendererProps } from './types';
|
|
2
|
-
export declare const ImageRenderer: ({ cardPreview, alt, resizeMode, onImageLoad, onImageError, onDisplayImage, mediaType, nativeLazyLoad, forceSyncDisplay, identifier, wrapperRef, useWhiteBackground, testId, }: ImageRendererProps) => JSX.Element | null;
|
|
2
|
+
export declare const ImageRenderer: ({ cardPreview, alt, resizeMode, onImageLoad, onImageError, onDisplayImage, mediaType, nativeLazyLoad, forceSyncDisplay, identifier, wrapperRef, useWhiteBackground, backgroundColor, testId, }: ImageRendererProps) => JSX.Element | null;
|
|
@@ -13,5 +13,6 @@ export type ImageRendererProps = {
|
|
|
13
13
|
readonly wrapperRef: React.RefObject<HTMLDivElement>;
|
|
14
14
|
readonly identifier: Identifier;
|
|
15
15
|
readonly useWhiteBackground?: boolean;
|
|
16
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
16
17
|
readonly testId?: string;
|
|
17
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FileIdentifier, type Identifier, type MediaClient } from '@atlaskit/media-client';
|
|
1
|
+
import { type FileIdentifier, type FileState, type Identifier, type MediaClient } from '@atlaskit/media-client';
|
|
2
2
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
3
3
|
import React, { type FC } from 'react';
|
|
4
4
|
import { type WrappedComponentProps } from 'react-intl';
|
|
@@ -18,6 +18,14 @@ export interface MediaInlineCardProps {
|
|
|
18
18
|
* Receives the file ID and should resolve to the filename string.
|
|
19
19
|
*/
|
|
20
20
|
fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Pre-hydrated SSR metadata from a Relay fragment (Media Platform Phase 5b).
|
|
23
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
24
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
25
|
+
* whose `processingStatus` is `succeeded`.
|
|
26
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
27
|
+
*/
|
|
28
|
+
readonly ssrFileState?: FileState;
|
|
21
29
|
}
|
|
22
30
|
export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
|
|
23
31
|
export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export interface SharedCardProps {
|
|
|
65
65
|
readonly alt?: string;
|
|
66
66
|
readonly testId?: string;
|
|
67
67
|
readonly titleBoxBgColor?: string;
|
|
68
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
68
69
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
69
70
|
readonly isAIGenerating?: boolean;
|
|
70
71
|
readonly onPreviewRender?: (fileId: string) => void;
|
|
@@ -111,6 +112,14 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
111
112
|
readonly shouldHideTooltip?: boolean;
|
|
112
113
|
/** General Media Settings */
|
|
113
114
|
readonly mediaSettings?: MediaSettings;
|
|
115
|
+
/**
|
|
116
|
+
* Pre-hydrated SSR metadata from a Relay fragment.
|
|
117
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
118
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
119
|
+
* whose `processingStatus` is `succeeded`.
|
|
120
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
121
|
+
*/
|
|
122
|
+
readonly ssrFileState?: FileState;
|
|
114
123
|
/** General Error handling include status errors and display errors*/
|
|
115
124
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
116
125
|
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
@@ -18,6 +18,7 @@ export interface CardViewProps {
|
|
|
18
18
|
readonly testId?: string;
|
|
19
19
|
readonly titleBoxBgColor?: string;
|
|
20
20
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
21
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
21
22
|
readonly status: CardStatus;
|
|
22
23
|
readonly mediaItemType: MediaItemType;
|
|
23
24
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
@@ -62,6 +63,6 @@ export interface RenderConfigByStatus {
|
|
|
62
63
|
customTitleMessage?: MessageDescriptor;
|
|
63
64
|
traceTooltipVariant?: TraceTooltipVariant;
|
|
64
65
|
}
|
|
65
|
-
export declare const CardViewBase: ({ identifier, innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, openMediaViewerButtonRef, shouldOpenMediaViewer, overriddenCreationDate, onSvgError, onSvgLoad, traceId, isAIGenerating, }: CardViewBaseProps) => React.JSX.Element;
|
|
66
|
+
export declare const CardViewBase: ({ identifier, innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, openMediaViewerButtonRef, shouldOpenMediaViewer, overriddenCreationDate, onSvgError, onSvgLoad, traceId, isAIGenerating, backgroundColor, }: CardViewBaseProps) => React.JSX.Element;
|
|
66
67
|
export declare const CardView: React.ForwardRefExoticComponent<Omit<CardViewProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
67
68
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
1
|
+
import { type FileIdentifier, type FileState, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
3
|
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
@@ -33,6 +33,8 @@ export interface FileCardProps extends CardEventProps {
|
|
|
33
33
|
readonly titleBoxBgColor?: string;
|
|
34
34
|
/** Sets the title box icon. */
|
|
35
35
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
36
|
+
/** Overrides the background color for media rendering (e.g. the default white background used for SVG transparency). */
|
|
37
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
36
38
|
/** Indicates the media card is being generated by AI (e.g. Rovo image-create). */
|
|
37
39
|
readonly isAIGenerating?: boolean;
|
|
38
40
|
/** Callback fired when the media card's image preview has rendered. */
|
|
@@ -59,11 +61,21 @@ export interface FileCardProps extends CardEventProps {
|
|
|
59
61
|
readonly viewerOptions?: ViewerOptionsProps;
|
|
60
62
|
/** Sets options for viewer **/
|
|
61
63
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
62
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `ssrFileState` instead (Phase 5b). Will be removed in a future major.
|
|
66
|
+
*/
|
|
63
67
|
readonly ssrItemDetails?: SsrItemDetails;
|
|
68
|
+
/**
|
|
69
|
+
* Pre-hydrated SSR metadata from a Relay fragment (Media Platform Phase 5b).
|
|
70
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
71
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
72
|
+
* whose `processingStatus` is `succeeded`.
|
|
73
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
74
|
+
*/
|
|
75
|
+
readonly ssrFileState?: FileState;
|
|
64
76
|
/** General Error handling include status errors and display errors*/
|
|
65
77
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
66
78
|
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
67
79
|
readonly mediaViewerExtensions?: MediaViewerExtensions;
|
|
68
80
|
}
|
|
69
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, isAIGenerating, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
|
81
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, backgroundColor, isAIGenerating, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, ssrFileState, onError, mediaViewerExtensions, }: FileCardProps) => React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SvgViewProps } from './types';
|
|
2
|
-
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, }: SvgViewProps) => JSX.Element | null;
|
|
2
|
+
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, backgroundColor, }: SvgViewProps) => JSX.Element | null;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { SvgViewProps } from './types';
|
|
7
|
-
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, }: SvgViewProps) => React.JSX.Element | null;
|
|
7
|
+
export declare const SvgView: ({ identifier, resizeMode, onLoad, onError, wrapperRef, alt, backgroundColor, }: SvgViewProps) => React.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ImageRendererProps } from './types';
|
|
2
|
-
export declare const ImageRenderer: ({ cardPreview, alt, resizeMode, onImageLoad, onImageError, onDisplayImage, mediaType, nativeLazyLoad, forceSyncDisplay, identifier, wrapperRef, useWhiteBackground, testId, }: ImageRendererProps) => JSX.Element | null;
|
|
2
|
+
export declare const ImageRenderer: ({ cardPreview, alt, resizeMode, onImageLoad, onImageError, onDisplayImage, mediaType, nativeLazyLoad, forceSyncDisplay, identifier, wrapperRef, useWhiteBackground, backgroundColor, testId, }: ImageRendererProps) => JSX.Element | null;
|
|
@@ -13,5 +13,6 @@ export type ImageRendererProps = {
|
|
|
13
13
|
readonly wrapperRef: React.RefObject<HTMLDivElement>;
|
|
14
14
|
readonly identifier: Identifier;
|
|
15
15
|
readonly useWhiteBackground?: boolean;
|
|
16
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
16
17
|
readonly testId?: string;
|
|
17
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FileIdentifier, type Identifier, type MediaClient } from '@atlaskit/media-client';
|
|
1
|
+
import { type FileIdentifier, type FileState, type Identifier, type MediaClient } from '@atlaskit/media-client';
|
|
2
2
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
3
3
|
import React, { type FC } from 'react';
|
|
4
4
|
import { type WrappedComponentProps } from 'react-intl';
|
|
@@ -18,6 +18,14 @@ export interface MediaInlineCardProps {
|
|
|
18
18
|
* Receives the file ID and should resolve to the filename string.
|
|
19
19
|
*/
|
|
20
20
|
fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Pre-hydrated SSR metadata from a Relay fragment (Media Platform Phase 5b).
|
|
23
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
24
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
25
|
+
* whose `processingStatus` is `succeeded`.
|
|
26
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
27
|
+
*/
|
|
28
|
+
readonly ssrFileState?: FileState;
|
|
21
29
|
}
|
|
22
30
|
export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
|
|
23
31
|
export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
|
|
@@ -65,6 +65,7 @@ export interface SharedCardProps {
|
|
|
65
65
|
readonly alt?: string;
|
|
66
66
|
readonly testId?: string;
|
|
67
67
|
readonly titleBoxBgColor?: string;
|
|
68
|
+
readonly backgroundColor?: React.CSSProperties['backgroundColor'];
|
|
68
69
|
readonly titleBoxIcon?: TitleBoxIcon;
|
|
69
70
|
readonly isAIGenerating?: boolean;
|
|
70
71
|
readonly onPreviewRender?: (fileId: string) => void;
|
|
@@ -111,6 +112,14 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
111
112
|
readonly shouldHideTooltip?: boolean;
|
|
112
113
|
/** General Media Settings */
|
|
113
114
|
readonly mediaSettings?: MediaSettings;
|
|
115
|
+
/**
|
|
116
|
+
* Pre-hydrated SSR metadata from a Relay fragment.
|
|
117
|
+
* When provided and `fg('platform_media_ssr_data_seed')` is on, the card seeds
|
|
118
|
+
* `useFileState` with this data and skips the `items()` API call for files
|
|
119
|
+
* whose `processingStatus` is `succeeded`.
|
|
120
|
+
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
121
|
+
*/
|
|
122
|
+
readonly ssrFileState?: FileState;
|
|
114
123
|
/** General Error handling include status errors and display errors*/
|
|
115
124
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
116
125
|
/** Extensions for the media viewer (e.g. comment button in header). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "80.
|
|
3
|
+
"version": "80.7.0",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
42
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
42
|
+
"@atlaskit/dropdown-menu": "^16.10.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
44
44
|
"@atlaskit/icon": "^35.3.0",
|
|
45
45
|
"@atlaskit/link": "^3.4.0",
|
|
46
46
|
"@atlaskit/media-client": "^36.3.0",
|
|
47
|
-
"@atlaskit/media-client-react": "^5.
|
|
47
|
+
"@atlaskit/media-client-react": "^5.2.0",
|
|
48
48
|
"@atlaskit/media-common": "^13.3.0",
|
|
49
|
-
"@atlaskit/media-file-preview": "^0.
|
|
50
|
-
"@atlaskit/media-state": "^2.
|
|
49
|
+
"@atlaskit/media-file-preview": "^0.18.0",
|
|
50
|
+
"@atlaskit/media-state": "^2.2.0",
|
|
51
51
|
"@atlaskit/media-svg": "^2.3.0",
|
|
52
52
|
"@atlaskit/media-ui": "^29.3.0",
|
|
53
53
|
"@atlaskit/media-viewer": "^53.2.0",
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^19.0.0",
|
|
56
56
|
"@atlaskit/progress-bar": "^4.2.0",
|
|
57
|
-
"@atlaskit/react-ufo": "^6.
|
|
57
|
+
"@atlaskit/react-ufo": "^6.5.0",
|
|
58
58
|
"@atlaskit/spinner": "^19.1.0",
|
|
59
59
|
"@atlaskit/theme": "^25.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
61
|
-
"@atlaskit/tokens": "^13.
|
|
62
|
-
"@atlaskit/tooltip": "^22.
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^85.0.0",
|
|
61
|
+
"@atlaskit/tokens": "^13.1.0",
|
|
62
|
+
"@atlaskit/tooltip": "^22.5.0",
|
|
63
63
|
"@atlaskit/ufo": "^0.5.0",
|
|
64
64
|
"@atlaskit/visually-hidden": "^3.1.0",
|
|
65
65
|
"@babel/runtime": "^7.0.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@atlaskit/radio": "^8.6.0",
|
|
90
90
|
"@atlaskit/range": "^10.1.0",
|
|
91
91
|
"@atlaskit/ssr": "workspace:^",
|
|
92
|
-
"@atlaskit/toggle": "^16.
|
|
92
|
+
"@atlaskit/toggle": "^16.1.0",
|
|
93
93
|
"@atlassian/a11y-jest-testing": "^0.11.0",
|
|
94
94
|
"@atlassian/feature-flags-test-utils": "^1.1.0",
|
|
95
95
|
"@atlassian/react-compiler-gating": "workspace:^",
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
},
|
|
175
175
|
"platform_media_a11y_suppression_fixes": {
|
|
176
176
|
"type": "boolean"
|
|
177
|
+
},
|
|
178
|
+
"platform_media_ssr_data_seed": {
|
|
179
|
+
"type": "boolean"
|
|
177
180
|
}
|
|
178
181
|
},
|
|
179
182
|
"techstack": {
|
package/report.api.md
CHANGED
|
@@ -27,6 +27,7 @@ import { Identifier } from '@atlaskit/media-client';
|
|
|
27
27
|
import { ImageResizeMode } from '@atlaskit/media-client';
|
|
28
28
|
import { MediaClient } from '@atlaskit/media-client';
|
|
29
29
|
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
30
|
+
import { MediaItemSSRData } from '@atlaskit/media-common';
|
|
30
31
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
31
32
|
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
32
33
|
import { default as React_2 } from 'react';
|
|
@@ -157,6 +158,8 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
157
158
|
// (undocumented)
|
|
158
159
|
readonly ssr?: SSR;
|
|
159
160
|
// (undocumented)
|
|
161
|
+
readonly ssrFileState?: FileState;
|
|
162
|
+
// (undocumented)
|
|
160
163
|
readonly useInlinePlayer?: boolean;
|
|
161
164
|
}
|
|
162
165
|
|