@atlaskit/media-card 81.9.5 → 81.10.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 +43 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +6 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineCard.js +7 -2
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +4 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineCard.js +6 -3
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +6 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineCard.js +8 -3
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/fileCard.d.ts +8 -1
- package/dist/types/inline/mediaInlineCard.d.ts +7 -0
- package/dist/types/types.d.ts +7 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 81.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`be8a71519cbc2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be8a71519cbc2) -
|
|
8
|
+
Add support for seeding media card file state from SSR media node metadata, behind the
|
|
9
|
+
`platform_media_ssr_data_seed` feature gate.
|
|
10
|
+
|
|
11
|
+
`@atlaskit/media-client` gains a Relay-free `mapSsrMediaItemToFileState`. Malformed, partial, or
|
|
12
|
+
non-array input yields `undefined` rather than throwing.
|
|
13
|
+
|
|
14
|
+
`@atlaskit/media-card` accepts an optional `ssrMediaItem` prop. When `ssrFileState` is absent and
|
|
15
|
+
the gate is on, the card converts `ssrMediaItem` to FileState via `mapSsrMediaItemToFileState` and
|
|
16
|
+
seeds `useFileState`. `ssrFileState` still wins when both are provided (Relay / media-card-relay).
|
|
17
|
+
|
|
18
|
+
`@atlaskit/renderer` extends `MediaSSR` with `ssrMediaItems` — the host's SSR media payload,
|
|
19
|
+
passed through untouched. The renderer finds the matching item by id and forwards it as
|
|
20
|
+
`ssrMediaItem` to Card. Hosts need no knowledge of `FileState` or of media internals. The field is
|
|
21
|
+
optional and additive: hosts that do not supply it, and media ids without an entry, keep the
|
|
22
|
+
current fetch behaviour.
|
|
23
|
+
|
|
24
|
+
`@atlaskit/media-card-relay`'s `MediaCardRelay` / `MediaInlineCardRelay` now call the shared
|
|
25
|
+
`mapSsrMediaItemToFileState` mapper directly (the Relay fragment data is structurally assignable
|
|
26
|
+
to `SsrMediaItem`, so no cast or wrapper is needed). Its public API and behaviour are unchanged.
|
|
27
|
+
|
|
28
|
+
`@atlaskit/media-file-preview` now forwards an SSR-seeded pre-signed `previewCdnUrl` to the new
|
|
29
|
+
optional `MediaClient.getImageUrlSync(id, params, seededCdnUrl)` argument when
|
|
30
|
+
`platform_media_ssr_data_seed` is enabled and CDN delivery is in use. `@atlaskit/media-client`
|
|
31
|
+
preserves the signed CDN asset URL and inserts supported image parameters before the `wm-ari` /
|
|
32
|
+
`wm-v` watermark anchor, avoiding query-string rebuilding or re-encoding that can invalidate
|
|
33
|
+
CloudFront signatures. Path-based routing, isolated cloud, GCP, and callers without a seeded URL
|
|
34
|
+
retain the existing URL-generation behaviour.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
|
|
40
|
+
## 81.9.6
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies
|
|
45
|
+
|
|
3
46
|
## 81.9.5
|
|
4
47
|
|
|
5
48
|
### Patch 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 = "81.9.
|
|
23
|
+
var packageVersion = "81.9.6";
|
|
24
24
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
25
25
|
var identifier = _ref.identifier,
|
|
26
26
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -15,6 +15,7 @@ var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents"
|
|
|
15
15
|
var _mediaClient = require("@atlaskit/media-client");
|
|
16
16
|
var _useFileState2 = require("@atlaskit/media-client-react/use-file-state");
|
|
17
17
|
var _useMediaClient = require("@atlaskit/media-client-react/use-media-client");
|
|
18
|
+
var _ssrMediaItem = require("@atlaskit/media-client/ssr-media-item");
|
|
18
19
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
19
20
|
var _mediaViewer = require("@atlaskit/media-viewer");
|
|
20
21
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -102,6 +103,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
102
103
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
103
104
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
104
105
|
ssrFileState = _ref.ssrFileState,
|
|
106
|
+
ssrMediaItem = _ref.ssrMediaItem,
|
|
105
107
|
onError = _ref.onError,
|
|
106
108
|
mediaViewerExtensions = _ref.mediaViewerExtensions,
|
|
107
109
|
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher;
|
|
@@ -147,7 +149,10 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
147
149
|
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
148
150
|
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
149
151
|
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
150
|
-
|
|
152
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
153
|
+
var initialFileState = (0, _react.useMemo)(function () {
|
|
154
|
+
return (0, _fg.fg)('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : (0, _ssrMediaItem.mapSsrMediaItemToFileState)(ssrMediaItem) : undefined;
|
|
155
|
+
}, [ssrFileState, ssrMediaItem]);
|
|
151
156
|
var _useFileState = (0, _useFileState2.useFileState)(identifier.id, {
|
|
152
157
|
skipRemote: !isCardVisible,
|
|
153
158
|
collectionName: identifier.collectionName,
|
|
@@ -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 = "81.9.
|
|
90
|
+
var packageVersion = "81.9.6";
|
|
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)({
|
|
@@ -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: "81.9.
|
|
119
|
+
packageName: "81.9.6",
|
|
120
120
|
componentName: 'mediaInlineCard',
|
|
121
121
|
component: 'mediaInlineCard'
|
|
122
122
|
};
|
|
@@ -9,6 +9,7 @@ exports.MediaInlineCardInternal = exports.MediaInlineCard = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
11
11
|
var _mediaClient = require("@atlaskit/media-client");
|
|
12
|
+
var _ssrMediaItem = require("@atlaskit/media-client/ssr-media-item");
|
|
12
13
|
var _ErroredView = require("@atlaskit/media-ui/ErroredView");
|
|
13
14
|
var _LoadedView = require("@atlaskit/media-ui/LoadedView");
|
|
14
15
|
var _LoadingView = require("@atlaskit/media-ui/LoadingView");
|
|
@@ -40,8 +41,12 @@ var MediaInlineCardInternal = exports.MediaInlineCardInternal = function MediaIn
|
|
|
40
41
|
intl = _ref.intl,
|
|
41
42
|
viewerOptions = _ref.viewerOptions,
|
|
42
43
|
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
43
|
-
ssrFileState = _ref.ssrFileState
|
|
44
|
-
|
|
44
|
+
ssrFileState = _ref.ssrFileState,
|
|
45
|
+
ssrMediaItem = _ref.ssrMediaItem;
|
|
46
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
47
|
+
var initialFileState = (0, _react.useMemo)(function () {
|
|
48
|
+
return (0, _fg.fg)('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : (0, _ssrMediaItem.mapSsrMediaItemToFileState)(ssrMediaItem) : undefined;
|
|
49
|
+
}, [ssrFileState, ssrMediaItem]);
|
|
45
50
|
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
46
51
|
// the useEffect dependency array (including it would cause repeated
|
|
47
52
|
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
@@ -22,7 +22,7 @@ var _globalScope = require("./globalScope/globalScope");
|
|
|
22
22
|
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; }
|
|
23
23
|
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; }
|
|
24
24
|
var packageName = "@atlaskit/media-card";
|
|
25
|
-
var packageVersion = "81.9.
|
|
25
|
+
var packageVersion = "81.9.6";
|
|
26
26
|
var SAMPLE_RATE = 0.05;
|
|
27
27
|
|
|
28
28
|
/**
|
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/useAnalyticsEvents';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "81.9.
|
|
12
|
+
const packageVersion = "81.9.6";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -2,6 +2,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
|
|
|
2
2
|
import { globalMediaEventEmitter, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState, isErrorFileState, toCommonMediaClientError } from '@atlaskit/media-client';
|
|
3
3
|
import { useFileState } from '@atlaskit/media-client-react/use-file-state';
|
|
4
4
|
import { useMediaClient } from '@atlaskit/media-client-react/use-media-client';
|
|
5
|
+
import { mapSsrMediaItemToFileState } from '@atlaskit/media-client/ssr-media-item';
|
|
5
6
|
import { isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, getRandomTelemetryId } from '@atlaskit/media-common';
|
|
6
7
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
8
|
import React, { Suspense, useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
@@ -83,6 +84,7 @@ export const FileCard = ({
|
|
|
83
84
|
includeHashForDuplicateFiles,
|
|
84
85
|
ssrItemDetails,
|
|
85
86
|
ssrFileState,
|
|
87
|
+
ssrMediaItem,
|
|
86
88
|
onError,
|
|
87
89
|
mediaViewerExtensions,
|
|
88
90
|
fallbackMediaNameFetcher
|
|
@@ -119,7 +121,8 @@ export const FileCard = ({
|
|
|
119
121
|
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
120
122
|
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
121
123
|
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
122
|
-
|
|
124
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
125
|
+
const initialFileState = useMemo(() => fg('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : mapSsrMediaItemToFileState(ssrMediaItem) : undefined, [ssrFileState, ssrMediaItem]);
|
|
123
126
|
const {
|
|
124
127
|
fileState
|
|
125
128
|
} = useFileState(identifier.id, {
|
|
@@ -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 = "81.9.
|
|
69
|
+
const packageVersion = "81.9.6";
|
|
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({
|
|
@@ -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: "81.9.
|
|
40
|
+
packageName: "81.9.6",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
2
2
|
import { FileFetcherError, toCommonMediaClientError } from '@atlaskit/media-client';
|
|
3
|
+
import { mapSsrMediaItemToFileState } from '@atlaskit/media-client/ssr-media-item';
|
|
3
4
|
import { MediaInlineCardErroredView } from '@atlaskit/media-ui/ErroredView';
|
|
4
5
|
import { MediaInlineCardLoadedView } from '@atlaskit/media-ui/LoadedView';
|
|
5
6
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui/LoadingView';
|
|
@@ -9,7 +10,7 @@ import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
|
9
10
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
12
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
13
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
13
14
|
import ReactDOM from 'react-dom';
|
|
14
15
|
import { createIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
15
16
|
import { MediaCardError } from '../errors';
|
|
@@ -30,9 +31,11 @@ export const MediaInlineCardInternal = ({
|
|
|
30
31
|
intl,
|
|
31
32
|
viewerOptions,
|
|
32
33
|
fallbackMediaNameFetcher,
|
|
33
|
-
ssrFileState
|
|
34
|
+
ssrFileState,
|
|
35
|
+
ssrMediaItem
|
|
34
36
|
}) => {
|
|
35
|
-
|
|
37
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
38
|
+
const initialFileState = useMemo(() => fg('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : mapSsrMediaItemToFileState(ssrMediaItem) : undefined, [ssrFileState, ssrMediaItem]);
|
|
36
39
|
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
37
40
|
// the useEffect dependency array (including it would cause repeated
|
|
38
41
|
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
@@ -11,7 +11,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
11
11
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
12
12
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
13
13
|
const packageName = "@atlaskit/media-card";
|
|
14
|
-
const packageVersion = "81.9.
|
|
14
|
+
const packageVersion = "81.9.6";
|
|
15
15
|
const SAMPLE_RATE = 0.05;
|
|
16
16
|
|
|
17
17
|
/**
|
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/useAnalyticsEvents';
|
|
12
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "81.9.
|
|
14
|
+
var packageVersion = "81.9.6";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -9,6 +9,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
|
|
|
9
9
|
import { globalMediaEventEmitter, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState, isErrorFileState, toCommonMediaClientError } from '@atlaskit/media-client';
|
|
10
10
|
import { useFileState } from '@atlaskit/media-client-react/use-file-state';
|
|
11
11
|
import { useMediaClient } from '@atlaskit/media-client-react/use-media-client';
|
|
12
|
+
import { mapSsrMediaItemToFileState } from '@atlaskit/media-client/ssr-media-item';
|
|
12
13
|
import { isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, getRandomTelemetryId } from '@atlaskit/media-common';
|
|
13
14
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
14
15
|
import React, { Suspense, useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
@@ -94,6 +95,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
94
95
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
95
96
|
ssrItemDetails = _ref.ssrItemDetails,
|
|
96
97
|
ssrFileState = _ref.ssrFileState,
|
|
98
|
+
ssrMediaItem = _ref.ssrMediaItem,
|
|
97
99
|
onError = _ref.onError,
|
|
98
100
|
mediaViewerExtensions = _ref.mediaViewerExtensions,
|
|
99
101
|
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher;
|
|
@@ -139,7 +141,10 @@ export var FileCard = function FileCard(_ref) {
|
|
|
139
141
|
// Note: mapMediaItemToFileState maps the fragment's processingStatus faithfully (including
|
|
140
142
|
// processing/pending). The decision to skip polling is delegated to useFileState —
|
|
141
143
|
// it skips subscription only when status === 'processed'. Do not add status guards here.
|
|
142
|
-
|
|
144
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
145
|
+
var initialFileState = useMemo(function () {
|
|
146
|
+
return fg('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : mapSsrMediaItemToFileState(ssrMediaItem) : undefined;
|
|
147
|
+
}, [ssrFileState, ssrMediaItem]);
|
|
143
148
|
var _useFileState = useFileState(identifier.id, {
|
|
144
149
|
skipRemote: !isCardVisible,
|
|
145
150
|
collectionName: identifier.collectionName,
|
|
@@ -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 = "81.9.
|
|
83
|
+
var packageVersion = "81.9.6";
|
|
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({
|
|
@@ -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: "81.9.
|
|
104
|
+
packageName: "81.9.6",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
3
3
|
import { FileFetcherError, toCommonMediaClientError } from '@atlaskit/media-client';
|
|
4
|
+
import { mapSsrMediaItemToFileState } from '@atlaskit/media-client/ssr-media-item';
|
|
4
5
|
import { MediaInlineCardErroredView } from '@atlaskit/media-ui/ErroredView';
|
|
5
6
|
import { MediaInlineCardLoadedView } from '@atlaskit/media-ui/LoadedView';
|
|
6
7
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui/LoadingView';
|
|
@@ -10,7 +11,7 @@ import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
|
10
11
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
11
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
13
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
13
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
14
15
|
import ReactDOM from 'react-dom';
|
|
15
16
|
import { createIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
16
17
|
import { MediaCardError } from '../errors';
|
|
@@ -31,8 +32,12 @@ export var MediaInlineCardInternal = function MediaInlineCardInternal(_ref) {
|
|
|
31
32
|
intl = _ref.intl,
|
|
32
33
|
viewerOptions = _ref.viewerOptions,
|
|
33
34
|
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
34
|
-
ssrFileState = _ref.ssrFileState
|
|
35
|
-
|
|
35
|
+
ssrFileState = _ref.ssrFileState,
|
|
36
|
+
ssrMediaItem = _ref.ssrMediaItem;
|
|
37
|
+
// ssrFileState (Relay / explicit seed) wins over converting ssrMediaItem.
|
|
38
|
+
var initialFileState = useMemo(function () {
|
|
39
|
+
return fg('platform_media_ssr_data_seed') ? ssrFileState !== null && ssrFileState !== void 0 ? ssrFileState : mapSsrMediaItemToFileState(ssrMediaItem) : undefined;
|
|
40
|
+
}, [ssrFileState, ssrMediaItem]);
|
|
36
41
|
// Capture as a ref so it's a stable one-time SSR seed that doesn't affect
|
|
37
42
|
// the useEffect dependency array (including it would cause repeated
|
|
38
43
|
// unsubscribe/resubscribe cycles whenever ssrFileState changes reference).
|
|
@@ -15,7 +15,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
15
15
|
import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
16
16
|
import { getMediaGlobalScope } from './globalScope/globalScope';
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "81.9.
|
|
18
|
+
var packageVersion = "81.9.6";
|
|
19
19
|
var SAMPLE_RATE = 0.05;
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FileIdentifier, type FileState, type Identifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
|
+
import { type SsrMediaItem } from '@atlaskit/media-client/ssr-media-item';
|
|
2
3
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
4
|
import { type ViewerOptionsProps, type MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
4
5
|
import React from 'react';
|
|
@@ -75,6 +76,12 @@ export interface FileCardProps extends CardEventProps {
|
|
|
75
76
|
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
76
77
|
*/
|
|
77
78
|
readonly ssrFileState?: FileState;
|
|
79
|
+
/**
|
|
80
|
+
* Raw SSR media item from a host payload (e.g. Confluence recorded media nodes).
|
|
81
|
+
* Used when `ssrFileState` is not provided. Converted to FileState internally
|
|
82
|
+
* when `fg('platform_media_ssr_data_seed')` is on.
|
|
83
|
+
*/
|
|
84
|
+
readonly ssrMediaItem?: SsrMediaItem;
|
|
78
85
|
/** General Error handling include status errors and display errors*/
|
|
79
86
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
80
87
|
/** Extensions for the media viewer (e.g. comment button in header). */
|
|
@@ -86,4 +93,4 @@ export interface FileCardProps extends CardEventProps {
|
|
|
86
93
|
*/
|
|
87
94
|
readonly fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
88
95
|
}
|
|
89
|
-
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, isCWR, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, onFocus, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, ssrFileState, onError, mediaViewerExtensions, fallbackMediaNameFetcher, }: FileCardProps) => React.JSX.Element;
|
|
96
|
+
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, isCWR, onPreviewRender, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, onFocus, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, ssrItemDetails, ssrFileState, ssrMediaItem, onError, mediaViewerExtensions, fallbackMediaNameFetcher, }: FileCardProps) => React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FileIdentifier, type FileState, type Identifier, type MediaClient } from '@atlaskit/media-client';
|
|
2
|
+
import { type SsrMediaItem } from '@atlaskit/media-client/ssr-media-item';
|
|
2
3
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
3
4
|
import React, { type FC } from 'react';
|
|
4
5
|
import { type WrappedComponentProps } from 'react-intl';
|
|
@@ -26,6 +27,12 @@ export interface MediaInlineCardProps {
|
|
|
26
27
|
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
27
28
|
*/
|
|
28
29
|
readonly ssrFileState?: FileState;
|
|
30
|
+
/**
|
|
31
|
+
* Raw SSR media item from a host payload (e.g. Confluence recorded media nodes).
|
|
32
|
+
* Used when `ssrFileState` is not provided. Converted to FileState internally
|
|
33
|
+
* when `fg('platform_media_ssr_data_seed')` is on.
|
|
34
|
+
*/
|
|
35
|
+
readonly ssrMediaItem?: SsrMediaItem;
|
|
29
36
|
}
|
|
30
37
|
export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
|
|
31
38
|
export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { type FocusEvent, type MouseEvent } from 'react';
|
|
5
5
|
import { type FileDetails, type MediaClient, type Identifier, type ImageResizeMode, type FileState } from '@atlaskit/media-client';
|
|
6
6
|
import type { MediaSettings } from '@atlaskit/media-client-react/media-parsed-settings';
|
|
7
|
+
import type { SsrMediaItem } from '@atlaskit/media-client/ssr-media-item';
|
|
7
8
|
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
8
9
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
9
10
|
import { type CardAction } from './card/actions';
|
|
@@ -126,6 +127,12 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
126
127
|
* @see https://product-fabric.atlassian.net/browse/BMPT-7914
|
|
127
128
|
*/
|
|
128
129
|
readonly ssrFileState?: FileState;
|
|
130
|
+
/**
|
|
131
|
+
* Raw SSR media item from a host payload (e.g. Confluence recorded media nodes).
|
|
132
|
+
* Used when `ssrFileState` is not provided. Converted to FileState internally
|
|
133
|
+
* when `fg('platform_media_ssr_data_seed')` is on.
|
|
134
|
+
*/
|
|
135
|
+
readonly ssrMediaItem?: SsrMediaItem;
|
|
129
136
|
/** General Error handling include status errors and display errors*/
|
|
130
137
|
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
131
138
|
/** 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": "81.
|
|
3
|
+
"version": "81.10.0",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/icon": "^37.6.0",
|
|
37
37
|
"@atlaskit/interaction-context": "^4.1.0",
|
|
38
38
|
"@atlaskit/link": "^5.1.0",
|
|
39
|
-
"@atlaskit/media-client": "^37.
|
|
39
|
+
"@atlaskit/media-client": "^37.7.0",
|
|
40
40
|
"@atlaskit/media-client-react": "^6.4.0",
|
|
41
41
|
"@atlaskit/media-common": "^14.6.0",
|
|
42
42
|
"@atlaskit/media-file-preview": "^1.3.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/section-message": "^10.2.0",
|
|
53
53
|
"@atlaskit/spinner": "^20.4.0",
|
|
54
54
|
"@atlaskit/theme": "^28.2.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^174.0.0",
|
|
56
56
|
"@atlaskit/tokens": "^16.11.0",
|
|
57
57
|
"@atlaskit/tooltip": "^24.3.0",
|
|
58
58
|
"@atlaskit/ufo": "^1.2.0",
|