@atlaskit/renderer 137.3.0 → 137.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/dist/cjs/react/nodes/mediaInline.js +12 -3
- package/dist/cjs/ui/MediaCard.js +8 -1
- package/dist/cjs/ui/Renderer/index.js +4 -4
- package/dist/cjs/ui/annotations/selection/mounter.js +2 -3
- package/dist/es2019/react/nodes/mediaInline.js +11 -4
- package/dist/es2019/ui/MediaCard.js +6 -1
- package/dist/es2019/ui/Renderer/index.js +2 -2
- package/dist/es2019/ui/annotations/selection/mounter.js +1 -1
- package/dist/esm/react/nodes/mediaInline.js +13 -4
- package/dist/esm/ui/MediaCard.js +8 -1
- package/dist/esm/ui/Renderer/index.js +2 -2
- package/dist/esm/ui/annotations/selection/mounter.js +1 -1
- package/dist/types/types/mediaOptions.d.ts +8 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 137.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0927c3666c010`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0927c3666c010) -
|
|
8
|
+
Upgrade `uuid` from `3.x` to `11.1.1` to remediate GHSA-w5hq-g745-h8pq / SNYK-JS-UUID-16133035.
|
|
9
|
+
|
|
10
|
+
`uuid@11` removed the deep subpath exports (`uuid/v4`, `uuid/v1`, `uuid/v5`) and the default
|
|
11
|
+
export, so all internal call sites were migrated to named imports:
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
-import uuid from 'uuid/v4';
|
|
15
|
+
+import { v4 as uuid } from 'uuid';
|
|
16
|
+
|
|
17
|
+
-import uuid from 'uuid';
|
|
18
|
+
+import { v4 as uuid } from 'uuid';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
With the exception of `@atlassian/integrations` (below), this is an internal implementation change
|
|
22
|
+
only - no public API, export, or entrypoint changed. UUID generation behaviour is unchanged
|
|
23
|
+
(`uuid@3`'s default export was already `v4`).
|
|
24
|
+
|
|
25
|
+
`@atlassian/integrations` declares `uuid` as a peer dependency, so its declared range moved from
|
|
26
|
+
`^3.1.0` to `^11.1.1`. That is a peer dependency declaration change, hence `minor` rather than
|
|
27
|
+
`patch` for that package.
|
|
28
|
+
|
|
29
|
+
The following `platform/packages/ai-mate` packages were also touched, but are all `private: true`
|
|
30
|
+
and so are intentionally not listed in the frontmatter above:
|
|
31
|
+
- `@atlassian/csm-assistance-service` - bumped its explicit `uuid` dependency from `npm:^9.0.0` to
|
|
32
|
+
`npm:^11.1.1` (`9.0.1` is also within the advisory's affected range).
|
|
33
|
+
- `@atlassian/csm-guidance-config` - example helper only, migrated to the named `uuid` import.
|
|
34
|
+
- `@atlassian/csm-ui-components` - example helper only, migrated to the named `uuid` import.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
38
|
+
## 137.4.0
|
|
39
|
+
|
|
40
|
+
### Minor Changes
|
|
41
|
+
|
|
42
|
+
- [`be8a71519cbc2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be8a71519cbc2) -
|
|
43
|
+
Add support for seeding media card file state from SSR media node metadata, behind the
|
|
44
|
+
`platform_media_ssr_data_seed` feature gate.
|
|
45
|
+
|
|
46
|
+
`@atlaskit/media-client` gains a Relay-free `mapSsrMediaItemToFileState`. Malformed, partial, or
|
|
47
|
+
non-array input yields `undefined` rather than throwing.
|
|
48
|
+
|
|
49
|
+
`@atlaskit/media-card` accepts an optional `ssrMediaItem` prop. When `ssrFileState` is absent and
|
|
50
|
+
the gate is on, the card converts `ssrMediaItem` to FileState via `mapSsrMediaItemToFileState` and
|
|
51
|
+
seeds `useFileState`. `ssrFileState` still wins when both are provided (Relay / media-card-relay).
|
|
52
|
+
|
|
53
|
+
`@atlaskit/renderer` extends `MediaSSR` with `ssrMediaItems` — the host's SSR media payload,
|
|
54
|
+
passed through untouched. The renderer finds the matching item by id and forwards it as
|
|
55
|
+
`ssrMediaItem` to Card. Hosts need no knowledge of `FileState` or of media internals. The field is
|
|
56
|
+
optional and additive: hosts that do not supply it, and media ids without an entry, keep the
|
|
57
|
+
current fetch behaviour.
|
|
58
|
+
|
|
59
|
+
`@atlaskit/media-card-relay`'s `MediaCardRelay` / `MediaInlineCardRelay` now call the shared
|
|
60
|
+
`mapSsrMediaItemToFileState` mapper directly (the Relay fragment data is structurally assignable
|
|
61
|
+
to `SsrMediaItem`, so no cast or wrapper is needed). Its public API and behaviour are unchanged.
|
|
62
|
+
|
|
63
|
+
`@atlaskit/media-file-preview` now forwards an SSR-seeded pre-signed `previewCdnUrl` to the new
|
|
64
|
+
optional `MediaClient.getImageUrlSync(id, params, seededCdnUrl)` argument when
|
|
65
|
+
`platform_media_ssr_data_seed` is enabled and CDN delivery is in use. `@atlaskit/media-client`
|
|
66
|
+
preserves the signed CDN asset URL and inserts supported image parameters before the `wm-ari` /
|
|
67
|
+
`wm-v` watermark anchor, avoiding query-string rebuilding or re-encoding that can invalidate
|
|
68
|
+
CloudFront signatures. Path-based routing, isolated cloud, GCP, and callers without a seeded URL
|
|
69
|
+
retain the existing URL-generation behaviour.
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies
|
|
74
|
+
|
|
3
75
|
## 137.3.0
|
|
4
76
|
|
|
5
77
|
### Minor Changes
|
|
@@ -33,7 +33,8 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
33
33
|
collectionName = _ref.collection,
|
|
34
34
|
eventHandlers = _ref.eventHandlers,
|
|
35
35
|
identifier = _ref.identifier,
|
|
36
|
-
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher
|
|
36
|
+
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
37
|
+
ssr = _ref.ssr;
|
|
37
38
|
var _useState = (0, _react.useState)(),
|
|
38
39
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
39
40
|
contextIdentifier = _useState2[0],
|
|
@@ -44,6 +45,12 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
44
45
|
setFileState = _useState4[1];
|
|
45
46
|
var mediaClient = (0, _react.useContext)(_mediaClientProvider.MediaClientContext);
|
|
46
47
|
var contextIdentifierProvider = (0, _providerFactory.useProvider)('contextIdentifierProvider');
|
|
48
|
+
var ssrMediaItem = (0, _react.useMemo)(function () {
|
|
49
|
+
var _ssr$ssrMediaItems;
|
|
50
|
+
return ssr === null || ssr === void 0 || (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(function (item) {
|
|
51
|
+
return item.id === identifier.id;
|
|
52
|
+
});
|
|
53
|
+
}, [ssr === null || ssr === void 0 ? void 0 : ssr.ssrMediaItems, identifier.id]);
|
|
47
54
|
(0, _react.useEffect)(function () {
|
|
48
55
|
if (contextIdentifierProvider) {
|
|
49
56
|
contextIdentifierProvider.then(function (resolvedContextID) {
|
|
@@ -144,7 +151,8 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
144
151
|
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
145
152
|
mediaClientConfig: mediaClient.mediaClientConfig,
|
|
146
153
|
mediaViewerItems: Array.from(_MediaCard.mediaIdentifierMap.values()),
|
|
147
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
154
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
155
|
+
ssrMediaItem: ssrMediaItem
|
|
148
156
|
}))
|
|
149
157
|
);
|
|
150
158
|
};
|
|
@@ -214,7 +222,8 @@ var MediaInline = function MediaInline(props) {
|
|
|
214
222
|
intl: intl,
|
|
215
223
|
collection: collection,
|
|
216
224
|
featureFlags: featureFlags,
|
|
217
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
225
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
226
|
+
ssr: ssr
|
|
218
227
|
});
|
|
219
228
|
};
|
|
220
229
|
|
package/dist/cjs/ui/MediaCard.js
CHANGED
|
@@ -285,6 +285,7 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
285
285
|
}, {
|
|
286
286
|
key: "render",
|
|
287
287
|
value: function render() {
|
|
288
|
+
var _ssr$ssrMediaItems;
|
|
288
289
|
var _this$state = this.state,
|
|
289
290
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
290
291
|
fileState = _this$state.fileState;
|
|
@@ -342,6 +343,9 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
342
343
|
// More robust solution will be implemented as part of CCPDF-233 - Link: https://hello.jira.atlassian.cloud/browse/CCPDF-233
|
|
343
344
|
var currentUrl = window.location.href;
|
|
344
345
|
var shouldDisableLazyLoading = (0, _expValEquals.expValEquals)('platform_editor_disable_lazy_load_media', 'isEnabled', true) && currentUrl.includes('/wiki/pdf/spaces/');
|
|
346
|
+
var ssrMediaItem = ssr === null || ssr === void 0 || (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(function (item) {
|
|
347
|
+
return item.id === id;
|
|
348
|
+
});
|
|
345
349
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, getClipboardAttrs({
|
|
346
350
|
id: id,
|
|
347
351
|
alt: alt,
|
|
@@ -367,7 +371,10 @@ var MediaCardView = exports.MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
367
371
|
mediaViewerItems: Array.from(mediaIdentifierMap.values()),
|
|
368
372
|
featureFlags: featureFlags,
|
|
369
373
|
shouldEnableDownloadButton: shouldEnableDownloadButton,
|
|
370
|
-
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
374
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
375
|
+
// Optional SSR seed supplied by the host product. Undefined when absent,
|
|
376
|
+
,
|
|
377
|
+
ssrMediaItem: ssrMediaItem,
|
|
371
378
|
shouldHideTooltip: isMobile,
|
|
372
379
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
373
380
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
@@ -30,7 +30,7 @@ var _types = require("@atlaskit/analytics-listeners/types");
|
|
|
30
30
|
var _FabricEditorAnalyticsContext = require("@atlaskit/analytics-namespaced-context/FabricEditorAnalyticsContext");
|
|
31
31
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
32
32
|
var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
|
|
33
|
-
var
|
|
33
|
+
var _uuid = require("uuid");
|
|
34
34
|
var _ = require("../../");
|
|
35
35
|
var _analyticsContext = _interopRequireDefault(require("../../analytics/analyticsContext"));
|
|
36
36
|
var _events = require("../../analytics/events");
|
|
@@ -74,7 +74,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
74
74
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
75
75
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
76
76
|
var packageName = "@atlaskit/renderer";
|
|
77
|
-
var packageVersion = "137.
|
|
77
|
+
var packageVersion = "137.4.0";
|
|
78
78
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
79
79
|
containerName: 'ak-renderer-wrapper',
|
|
80
80
|
containerType: 'inline-size'
|
|
@@ -295,7 +295,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
295
295
|
var editorRef = props.innerRef || localRef;
|
|
296
296
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
297
297
|
var id = (0, _react.useMemo)(function () {
|
|
298
|
-
return (0,
|
|
298
|
+
return (0, _uuid.v4)();
|
|
299
299
|
}, []);
|
|
300
300
|
var renderedMeasurementDistortedDurationMonitor = (0, _react.useMemo)(function () {
|
|
301
301
|
return (0, _measureRender.getDistortedDurationMonitor)();
|
|
@@ -631,7 +631,7 @@ var RendererWithAnalytics = exports.RendererWithAnalytics = /*#__PURE__*/_react.
|
|
|
631
631
|
packageVersion: packageVersion,
|
|
632
632
|
componentName: 'renderer',
|
|
633
633
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
634
|
-
editorSessionId: (0,
|
|
634
|
+
editorSessionId: (0, _uuid.v4)()
|
|
635
635
|
}
|
|
636
636
|
}, (0, _react2.jsx)(_ui.WithCreateAnalyticsEvent
|
|
637
637
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
@@ -9,7 +8,7 @@ exports.SelectionInlineCommentMounter = void 0;
|
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
10
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
|
-
var
|
|
11
|
+
var _uuid = require("uuid");
|
|
13
12
|
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
14
13
|
var _dom = require("../draft/dom");
|
|
15
14
|
var _types = require("@atlaskit/analytics-listeners/types");
|
|
@@ -211,7 +210,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
211
210
|
// this is because clearing the draft will remove the mark node from the DOM, which will cause the selection range to be invalid
|
|
212
211
|
|
|
213
212
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
214
|
-
var id = (0,
|
|
213
|
+
var id = (0, _uuid.v4)();
|
|
215
214
|
var result = applyDraftModeCallback({
|
|
216
215
|
annotationId: id,
|
|
217
216
|
keepNativeSelection: false
|
|
@@ -5,7 +5,7 @@ import { MediaInlineCard } from '@atlaskit/media-card';
|
|
|
5
5
|
import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
|
|
6
6
|
import { getMediaClient } from '@atlaskit/media-client-react/get-media-client';
|
|
7
7
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui/LoadingView';
|
|
8
|
-
import React, { useCallback, useEffect, useState, useContext } from 'react';
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useState, useContext } from 'react';
|
|
9
9
|
import { injectIntl } from 'react-intl';
|
|
10
10
|
import { getClipboardAttrs, mediaIdentifierMap } from '../../ui/MediaCard';
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
@@ -18,12 +18,17 @@ const RenderMediaInline = ({
|
|
|
18
18
|
collection: collectionName,
|
|
19
19
|
eventHandlers,
|
|
20
20
|
identifier,
|
|
21
|
-
fallbackMediaNameFetcher
|
|
21
|
+
fallbackMediaNameFetcher,
|
|
22
|
+
ssr
|
|
22
23
|
}) => {
|
|
23
24
|
const [contextIdentifier, setContextIdentifier] = useState();
|
|
24
25
|
const [fileState, setFileState] = useState();
|
|
25
26
|
const mediaClient = useContext(MediaClientContext);
|
|
26
27
|
const contextIdentifierProvider = useProvider('contextIdentifierProvider');
|
|
28
|
+
const ssrMediaItem = useMemo(() => {
|
|
29
|
+
var _ssr$ssrMediaItems;
|
|
30
|
+
return ssr === null || ssr === void 0 ? void 0 : (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(item => item.id === identifier.id);
|
|
31
|
+
}, [ssr === null || ssr === void 0 ? void 0 : ssr.ssrMediaItems, identifier.id]);
|
|
27
32
|
useEffect(() => {
|
|
28
33
|
if (contextIdentifierProvider) {
|
|
29
34
|
contextIdentifierProvider.then(resolvedContextID => {
|
|
@@ -110,7 +115,8 @@ const RenderMediaInline = ({
|
|
|
110
115
|
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
111
116
|
mediaClientConfig: mediaClient.mediaClientConfig,
|
|
112
117
|
mediaViewerItems: Array.from(mediaIdentifierMap.values()),
|
|
113
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
118
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
119
|
+
ssrMediaItem: ssrMediaItem
|
|
114
120
|
}))
|
|
115
121
|
);
|
|
116
122
|
};
|
|
@@ -179,7 +185,8 @@ const MediaInline = props => {
|
|
|
179
185
|
intl: intl,
|
|
180
186
|
collection: collection,
|
|
181
187
|
featureFlags: featureFlags,
|
|
182
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
188
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
189
|
+
ssr: ssr
|
|
183
190
|
});
|
|
184
191
|
};
|
|
185
192
|
|
|
@@ -223,6 +223,7 @@ export class MediaCardView extends Component {
|
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
render() {
|
|
226
|
+
var _ssr$ssrMediaItems;
|
|
226
227
|
const {
|
|
227
228
|
contextIdentifierProvider,
|
|
228
229
|
fileState
|
|
@@ -282,6 +283,7 @@ export class MediaCardView extends Component {
|
|
|
282
283
|
// More robust solution will be implemented as part of CCPDF-233 - Link: https://hello.jira.atlassian.cloud/browse/CCPDF-233
|
|
283
284
|
const currentUrl = window.location.href;
|
|
284
285
|
const shouldDisableLazyLoading = expValEquals('platform_editor_disable_lazy_load_media', 'isEnabled', true) && currentUrl.includes('/wiki/pdf/spaces/');
|
|
286
|
+
const ssrMediaItem = ssr === null || ssr === void 0 ? void 0 : (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(item => item.id === id);
|
|
285
287
|
return /*#__PURE__*/React.createElement("div", _extends({}, getClipboardAttrs({
|
|
286
288
|
id,
|
|
287
289
|
alt,
|
|
@@ -307,7 +309,10 @@ export class MediaCardView extends Component {
|
|
|
307
309
|
mediaViewerItems: Array.from(mediaIdentifierMap.values()),
|
|
308
310
|
featureFlags: featureFlags,
|
|
309
311
|
shouldEnableDownloadButton: shouldEnableDownloadButton,
|
|
310
|
-
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
312
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
313
|
+
// Optional SSR seed supplied by the host product. Undefined when absent,
|
|
314
|
+
,
|
|
315
|
+
ssrMediaItem: ssrMediaItem,
|
|
311
316
|
shouldHideTooltip: isMobile,
|
|
312
317
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
313
318
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
@@ -25,7 +25,7 @@ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-con
|
|
|
25
25
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
26
26
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
27
27
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
28
|
-
import uuid from 'uuid
|
|
28
|
+
import { v4 as uuid } from 'uuid';
|
|
29
29
|
import { ReactSerializer, renderDocument } from '../../';
|
|
30
30
|
import AnalyticsContext from '../../analytics/analyticsContext';
|
|
31
31
|
import { MODE, PLATFORM } from '../../analytics/events';
|
|
@@ -60,7 +60,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
60
60
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
61
61
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
62
62
|
const packageName = "@atlaskit/renderer";
|
|
63
|
-
const packageVersion = "137.
|
|
63
|
+
const packageVersion = "137.4.0";
|
|
64
64
|
const setAsQueryContainerStyles = css({
|
|
65
65
|
containerName: 'ak-renderer-wrapper',
|
|
66
66
|
containerType: 'inline-size'
|
|
@@ -3,7 +3,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
|
-
import uuid from 'uuid
|
|
6
|
+
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { AnnotationTypes, AnnotationMarkStates } from '@atlaskit/adf-schema/annotation';
|
|
8
8
|
import { updateWindowSelectionAroundDraft } from '../draft/dom';
|
|
9
9
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
@@ -11,7 +11,7 @@ import { MediaInlineCard } from '@atlaskit/media-card';
|
|
|
11
11
|
import { MediaClientContext } from '@atlaskit/media-client-react/media-client-provider';
|
|
12
12
|
import { getMediaClient } from '@atlaskit/media-client-react/get-media-client';
|
|
13
13
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui/LoadingView';
|
|
14
|
-
import React, { useCallback, useEffect, useState, useContext } from 'react';
|
|
14
|
+
import React, { useCallback, useEffect, useMemo, useState, useContext } from 'react';
|
|
15
15
|
import { injectIntl } from 'react-intl';
|
|
16
16
|
import { getClipboardAttrs, mediaIdentifierMap } from '../../ui/MediaCard';
|
|
17
17
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
@@ -24,7 +24,8 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
24
24
|
collectionName = _ref.collection,
|
|
25
25
|
eventHandlers = _ref.eventHandlers,
|
|
26
26
|
identifier = _ref.identifier,
|
|
27
|
-
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher
|
|
27
|
+
fallbackMediaNameFetcher = _ref.fallbackMediaNameFetcher,
|
|
28
|
+
ssr = _ref.ssr;
|
|
28
29
|
var _useState = useState(),
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
31
|
contextIdentifier = _useState2[0],
|
|
@@ -35,6 +36,12 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
35
36
|
setFileState = _useState4[1];
|
|
36
37
|
var mediaClient = useContext(MediaClientContext);
|
|
37
38
|
var contextIdentifierProvider = useProvider('contextIdentifierProvider');
|
|
39
|
+
var ssrMediaItem = useMemo(function () {
|
|
40
|
+
var _ssr$ssrMediaItems;
|
|
41
|
+
return ssr === null || ssr === void 0 || (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(function (item) {
|
|
42
|
+
return item.id === identifier.id;
|
|
43
|
+
});
|
|
44
|
+
}, [ssr === null || ssr === void 0 ? void 0 : ssr.ssrMediaItems, identifier.id]);
|
|
38
45
|
useEffect(function () {
|
|
39
46
|
if (contextIdentifierProvider) {
|
|
40
47
|
contextIdentifierProvider.then(function (resolvedContextID) {
|
|
@@ -135,7 +142,8 @@ var RenderMediaInline = function RenderMediaInline(_ref) {
|
|
|
135
142
|
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
136
143
|
mediaClientConfig: mediaClient.mediaClientConfig,
|
|
137
144
|
mediaViewerItems: Array.from(mediaIdentifierMap.values()),
|
|
138
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
145
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
146
|
+
ssrMediaItem: ssrMediaItem
|
|
139
147
|
}))
|
|
140
148
|
);
|
|
141
149
|
};
|
|
@@ -205,7 +213,8 @@ var MediaInline = function MediaInline(props) {
|
|
|
205
213
|
intl: intl,
|
|
206
214
|
collection: collection,
|
|
207
215
|
featureFlags: featureFlags,
|
|
208
|
-
fallbackMediaNameFetcher: fallbackMediaNameFetcher
|
|
216
|
+
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
217
|
+
ssr: ssr
|
|
209
218
|
});
|
|
210
219
|
};
|
|
211
220
|
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -276,6 +276,7 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
276
276
|
}, {
|
|
277
277
|
key: "render",
|
|
278
278
|
value: function render() {
|
|
279
|
+
var _ssr$ssrMediaItems;
|
|
279
280
|
var _this$state = this.state,
|
|
280
281
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
281
282
|
fileState = _this$state.fileState;
|
|
@@ -333,6 +334,9 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
333
334
|
// More robust solution will be implemented as part of CCPDF-233 - Link: https://hello.jira.atlassian.cloud/browse/CCPDF-233
|
|
334
335
|
var currentUrl = window.location.href;
|
|
335
336
|
var shouldDisableLazyLoading = expValEquals('platform_editor_disable_lazy_load_media', 'isEnabled', true) && currentUrl.includes('/wiki/pdf/spaces/');
|
|
337
|
+
var ssrMediaItem = ssr === null || ssr === void 0 || (_ssr$ssrMediaItems = ssr.ssrMediaItems) === null || _ssr$ssrMediaItems === void 0 ? void 0 : _ssr$ssrMediaItems.find(function (item) {
|
|
338
|
+
return item.id === id;
|
|
339
|
+
});
|
|
336
340
|
return /*#__PURE__*/React.createElement("div", _extends({}, getClipboardAttrs({
|
|
337
341
|
id: id,
|
|
338
342
|
alt: alt,
|
|
@@ -358,7 +362,10 @@ export var MediaCardView = /*#__PURE__*/function (_Component) {
|
|
|
358
362
|
mediaViewerItems: Array.from(mediaIdentifierMap.values()),
|
|
359
363
|
featureFlags: featureFlags,
|
|
360
364
|
shouldEnableDownloadButton: shouldEnableDownloadButton,
|
|
361
|
-
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
365
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
366
|
+
// Optional SSR seed supplied by the host product. Undefined when absent,
|
|
367
|
+
,
|
|
368
|
+
ssrMediaItem: ssrMediaItem,
|
|
362
369
|
shouldHideTooltip: isMobile,
|
|
363
370
|
mediaViewerExtensions: mediaViewerExtensions,
|
|
364
371
|
fallbackMediaNameFetcher: fallbackMediaNameFetcher,
|
|
@@ -30,7 +30,7 @@ import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-con
|
|
|
30
30
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
31
31
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
32
32
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
33
|
-
import uuid from 'uuid
|
|
33
|
+
import { v4 as uuid } from 'uuid';
|
|
34
34
|
import { ReactSerializer, renderDocument } from '../../';
|
|
35
35
|
import AnalyticsContext from '../../analytics/analyticsContext';
|
|
36
36
|
import { MODE, PLATFORM } from '../../analytics/events';
|
|
@@ -65,7 +65,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
65
65
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
66
66
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
67
67
|
var packageName = "@atlaskit/renderer";
|
|
68
|
-
var packageVersion = "137.
|
|
68
|
+
var packageVersion = "137.4.0";
|
|
69
69
|
var setAsQueryContainerStyles = css({
|
|
70
70
|
containerName: 'ak-renderer-wrapper',
|
|
71
71
|
containerType: 'inline-size'
|
|
@@ -3,7 +3,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
|
-
import uuid from 'uuid
|
|
6
|
+
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { AnnotationTypes, AnnotationMarkStates } from '@atlaskit/adf-schema/annotation';
|
|
8
8
|
import { updateWindowSelectionAroundDraft } from '../draft/dom';
|
|
9
9
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
@@ -4,6 +4,14 @@ import type { MediaViewerExtensions } from '@atlaskit/media-viewer';
|
|
|
4
4
|
export type MediaSSR = {
|
|
5
5
|
config: MediaClientConfig;
|
|
6
6
|
mode: SSR;
|
|
7
|
+
/**
|
|
8
|
+
* Host SSR media payload. The renderer looks up each card's id with `.find()`
|
|
9
|
+
* and passes the matching item as `ssrMediaItem` to Card. Missing entries fall
|
|
10
|
+
* back to the normal remote fetch path.
|
|
11
|
+
*/
|
|
12
|
+
ssrMediaItems?: ReadonlyArray<{
|
|
13
|
+
id?: string;
|
|
14
|
+
}>;
|
|
7
15
|
};
|
|
8
16
|
export interface MediaOptions {
|
|
9
17
|
allowCaptions?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "137.
|
|
3
|
+
"version": "137.4.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@atlaskit/link-datasource": "^6.11.0",
|
|
54
54
|
"@atlaskit/link-extractors": "^4.2.0",
|
|
55
55
|
"@atlaskit/linking-common": "^12.1.0",
|
|
56
|
-
"@atlaskit/media-card": "^81.
|
|
57
|
-
"@atlaskit/media-client": "^37.
|
|
56
|
+
"@atlaskit/media-card": "^81.10.0",
|
|
57
|
+
"@atlaskit/media-client": "^37.7.0",
|
|
58
58
|
"@atlaskit/media-client-react": "^6.4.0",
|
|
59
59
|
"@atlaskit/media-common": "^14.6.0",
|
|
60
60
|
"@atlaskit/media-filmstrip": "^52.4.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"memoize-one": "^6.0.0",
|
|
83
83
|
"react-loadable": "^5.1.0",
|
|
84
84
|
"react-loosely-lazy": "^1.0.0",
|
|
85
|
-
"uuid": "^
|
|
85
|
+
"uuid": "^11.1.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@atlaskit/editor-common": "^120.13.0",
|