@atlaskit/media-file-preview 0.15.5 → 0.16.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-file-preview
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c90ccf0c600ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c90ccf0c600ee) -
8
+ Enable cross product/cross client copy and paste of Media files by including clientId during Copy
9
+ operations.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 0.15.5
4
16
 
5
17
  ### Patch Changes
@@ -53,20 +53,54 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
53
53
  setStatus = _useState2[1];
54
54
  var _useState3 = (0, _react.useState)(),
55
55
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
56
- error = _useState4[0],
57
- setError = _useState4[1];
56
+ clientId = _useState4[0],
57
+ setClientId = _useState4[1];
58
+
59
+ // Fetch clientId on mount for cross-client copy
60
+ (0, _react.useEffect)(function () {
61
+ if ((0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth')) {
62
+ mediaClient.getClientId(identifier.collectionName).then(setClientId).catch(function () {
63
+ // ClientId is optional, silently fail
64
+ });
65
+ }
66
+ }, [mediaClient, identifier.collectionName]);
67
+
68
+ // Merge clientId into mediaBlobUrlAttrs for embedding in blob URLs
69
+ // If mediaBlobUrlAttrs is not provided, construct minimal attrs from identifier
70
+ var mediaBlobUrlAttrsWithClientId = (0, _react.useMemo)(function () {
71
+ if (!(0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth') || !clientId) {
72
+ return mediaBlobUrlAttrs;
73
+ }
74
+ if (mediaBlobUrlAttrs) {
75
+ return _objectSpread(_objectSpread({}, mediaBlobUrlAttrs), {}, {
76
+ clientId: clientId
77
+ });
78
+ }
79
+
80
+ // Construct minimal attrs when none provided (e.g., MediaImage)
81
+ return {
82
+ id: identifier.id,
83
+ clientId: clientId,
84
+ contextId: identifier.collectionName || '',
85
+ collection: identifier.collectionName
86
+ };
87
+ }, [mediaBlobUrlAttrs, clientId, identifier.id, identifier.collectionName]);
58
88
  var _useState5 = (0, _react.useState)(),
59
89
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
60
- nonCriticalError = _useState6[0],
61
- setNonCriticalError = _useState6[1];
62
- var _useState7 = (0, _react.useState)(false),
90
+ error = _useState6[0],
91
+ setError = _useState6[1];
92
+ var _useState7 = (0, _react.useState)(),
63
93
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
64
- isBannedLocalPreview = _useState8[0],
65
- setIsBannedLocalPreview = _useState8[1];
66
- var _useState9 = (0, _react.useState)('not-resolved'),
94
+ nonCriticalError = _useState8[0],
95
+ setNonCriticalError = _useState8[1];
96
+ var _useState9 = (0, _react.useState)(false),
67
97
  _useState0 = (0, _slicedToArray2.default)(_useState9, 2),
68
- upfrontPreviewStatus = _useState0[0],
69
- setUpfrontPreviewStatus = _useState0[1];
98
+ isBannedLocalPreview = _useState0[0],
99
+ setIsBannedLocalPreview = _useState0[1];
100
+ var _useState1 = (0, _react.useState)('not-resolved'),
101
+ _useState10 = (0, _slicedToArray2.default)(_useState1, 2),
102
+ upfrontPreviewStatus = _useState10[0],
103
+ setUpfrontPreviewStatus = _useState10[1];
70
104
  var ssrReliabilityRef = (0, _react.useRef)({
71
105
  server: {
72
106
  status: 'unknown'
@@ -76,10 +110,10 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
76
110
  }
77
111
  });
78
112
  var ufoContext = (0, _interactionContext.useInteractionContext)();
79
- var _useState1 = (0, _react.useState)(false),
80
- _useState10 = (0, _slicedToArray2.default)(_useState1, 2),
81
- isLoading = _useState10[0],
82
- setIsLoading = _useState10[1];
113
+ var _useState11 = (0, _react.useState)(false),
114
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
115
+ isLoading = _useState12[0],
116
+ setIsLoading = _useState12[1];
83
117
  (0, _react.useLayoutEffect)(function () {
84
118
  if (isLoading && (0, _platformFeatureFlags.fg)('platform_close_image_blindspot_2')) {
85
119
  return ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.hold('img-loading');
@@ -122,7 +156,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
122
156
  // where no SSR occurred, so we should skip SSR preview generation entirely.
123
157
  if (ssr === 'server' || ssrData) {
124
158
  try {
125
- return (0, _getPreview.getSSRPreview)(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrs);
159
+ return (0, _getPreview.getSSRPreview)(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrsWithClientId);
126
160
  } catch (e) {
127
161
  ssrReliabilityRef.current = _objectSpread(_objectSpread({}, ssrReliabilityRef.current), {}, (0, _defineProperty2.default)({}, ssr, _objectSpread({
128
162
  status: 'fail'
@@ -144,10 +178,10 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
144
178
  }
145
179
  }
146
180
  };
147
- var _useState11 = (0, _react.useState)(previewInitializer),
148
- _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
149
- preview = _useState12[0],
150
- setPreview = _useState12[1];
181
+ var _useState13 = (0, _react.useState)(previewInitializer),
182
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
183
+ preview = _useState14[0],
184
+ setPreview = _useState14[1];
151
185
 
152
186
  //----------------------------------------------------------------
153
187
  // FILE STATE
@@ -214,11 +248,29 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
214
248
  }
215
249
  }, [preview, identifier, resizeMode]);
216
250
 
251
+ //----------------------------------------------------------------
252
+ // Update preview with clientId when it becomes available
253
+ //----------------------------------------------------------------
254
+ var previewUpdatedWithClientIdRef = (0, _react.useRef)(null);
255
+ (0, _react.useEffect)(function () {
256
+ // Only update if we have a preview, clientId is available, URL doesn't already have clientId, and feature flag is enabled.
257
+ // Also skip if we've already updated this preview (prevents re-render loops)
258
+ if (preview && clientId && mediaBlobUrlAttrsWithClientId && !preview.dataURI.includes('clientId=') && previewUpdatedWithClientIdRef.current !== identifier.id && (0, _platformFeatureFlags.fg)('platform_media_cross_client_copy_with_auth')) {
259
+ // Mark this preview as updated
260
+ previewUpdatedWithClientIdRef.current = identifier.id;
261
+ var baseUrl = preview.dataURI.split('#')[0]; // Remove any existing hash
262
+ var updatedDataURI = (0, _mediaClient.addFileAttrsToUrl)(baseUrl, mediaBlobUrlAttrsWithClientId);
263
+ setPreview(_objectSpread(_objectSpread({}, preview), {}, {
264
+ dataURI: updatedDataURI
265
+ }));
266
+ }
267
+ }, [clientId, mediaBlobUrlAttrsWithClientId, preview, identifier.id]);
268
+
217
269
  //----------------------------------------------------------------
218
270
  // Preview Fetch Helper
219
271
  //----------------------------------------------------------------
220
272
  var getAndCacheRemotePreviewRef = (0, _helpers.useCurrentValueRef)(function () {
221
- return (0, _getPreview.getAndCacheRemotePreview)(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrs, traceContext);
273
+ return (0, _getPreview.getAndCacheRemotePreview)(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrsWithClientId, traceContext);
222
274
  });
223
275
 
224
276
  //----------------------------------------------------------------
@@ -253,7 +305,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
253
305
  // Cache, Local & Remote Preview
254
306
  //----------------------------------------------------------------
255
307
 
256
- var mediaBlobUrlAttrsRef = (0, _helpers.useCurrentValueRef)(mediaBlobUrlAttrs);
308
+ var mediaBlobUrlAttrsRef = (0, _helpers.useCurrentValueRef)(mediaBlobUrlAttrsWithClientId);
257
309
  (0, _react.useEffect)(function () {
258
310
  var cachedPreview = _getPreview.mediaFilePreviewCache.get(identifier.id, resizeMode);
259
311
 
@@ -415,6 +467,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
415
467
  onImageError: onImageError,
416
468
  onImageLoad: onImageLoad,
417
469
  getSsrScriptProps: getSsrScriptProps,
418
- copyNodeRef: copyNodeRef
470
+ copyNodeRef: copyNodeRef,
471
+ clientId: clientId
419
472
  };
420
473
  };
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
- import { isImageRepresentationReady, toCommonMediaClientError } from '@atlaskit/media-client';
2
+ import { addFileAttrsToUrl, isImageRepresentationReady, toCommonMediaClientError } from '@atlaskit/media-client';
3
3
  import { useCopyIntent, useFileState, useMediaClient } from '@atlaskit/media-client-react';
4
4
  import { isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -36,6 +36,38 @@ export const useFilePreview = ({
36
36
  }) => {
37
37
  const mediaClient = useMediaClient();
38
38
  const [status, setStatus] = useState('loading');
39
+ const [clientId, setClientId] = useState();
40
+
41
+ // Fetch clientId on mount for cross-client copy
42
+ useEffect(() => {
43
+ if (fg('platform_media_cross_client_copy_with_auth')) {
44
+ mediaClient.getClientId(identifier.collectionName).then(setClientId).catch(() => {
45
+ // ClientId is optional, silently fail
46
+ });
47
+ }
48
+ }, [mediaClient, identifier.collectionName]);
49
+
50
+ // Merge clientId into mediaBlobUrlAttrs for embedding in blob URLs
51
+ // If mediaBlobUrlAttrs is not provided, construct minimal attrs from identifier
52
+ const mediaBlobUrlAttrsWithClientId = useMemo(() => {
53
+ if (!fg('platform_media_cross_client_copy_with_auth') || !clientId) {
54
+ return mediaBlobUrlAttrs;
55
+ }
56
+ if (mediaBlobUrlAttrs) {
57
+ return {
58
+ ...mediaBlobUrlAttrs,
59
+ clientId
60
+ };
61
+ }
62
+
63
+ // Construct minimal attrs when none provided (e.g., MediaImage)
64
+ return {
65
+ id: identifier.id,
66
+ clientId,
67
+ contextId: identifier.collectionName || '',
68
+ collection: identifier.collectionName
69
+ };
70
+ }, [mediaBlobUrlAttrs, clientId, identifier.id, identifier.collectionName]);
39
71
  const [error, setError] = useState();
40
72
  const [nonCriticalError, setNonCriticalError] = useState();
41
73
  const [isBannedLocalPreview, setIsBannedLocalPreview] = useState(false);
@@ -93,7 +125,7 @@ export const useFilePreview = ({
93
125
  // where no SSR occurred, so we should skip SSR preview generation entirely.
94
126
  if (ssr === 'server' || ssrData) {
95
127
  try {
96
- return getSSRPreview(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrs);
128
+ return getSSRPreview(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrsWithClientId);
97
129
  } catch (e) {
98
130
  ssrReliabilityRef.current = {
99
131
  ...ssrReliabilityRef.current,
@@ -187,11 +219,30 @@ export const useFilePreview = ({
187
219
  }
188
220
  }, [preview, identifier, resizeMode]);
189
221
 
222
+ //----------------------------------------------------------------
223
+ // Update preview with clientId when it becomes available
224
+ //----------------------------------------------------------------
225
+ const previewUpdatedWithClientIdRef = useRef(null);
226
+ useEffect(() => {
227
+ // Only update if we have a preview, clientId is available, URL doesn't already have clientId, and feature flag is enabled.
228
+ // Also skip if we've already updated this preview (prevents re-render loops)
229
+ if (preview && clientId && mediaBlobUrlAttrsWithClientId && !preview.dataURI.includes('clientId=') && previewUpdatedWithClientIdRef.current !== identifier.id && fg('platform_media_cross_client_copy_with_auth')) {
230
+ // Mark this preview as updated
231
+ previewUpdatedWithClientIdRef.current = identifier.id;
232
+ const baseUrl = preview.dataURI.split('#')[0]; // Remove any existing hash
233
+ const updatedDataURI = addFileAttrsToUrl(baseUrl, mediaBlobUrlAttrsWithClientId);
234
+ setPreview({
235
+ ...preview,
236
+ dataURI: updatedDataURI
237
+ });
238
+ }
239
+ }, [clientId, mediaBlobUrlAttrsWithClientId, preview, identifier.id]);
240
+
190
241
  //----------------------------------------------------------------
191
242
  // Preview Fetch Helper
192
243
  //----------------------------------------------------------------
193
244
  const getAndCacheRemotePreviewRef = useCurrentValueRef(() => {
194
- return getAndCacheRemotePreview(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrs, traceContext);
245
+ return getAndCacheRemotePreview(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrsWithClientId, traceContext);
195
246
  });
196
247
 
197
248
  //----------------------------------------------------------------
@@ -228,7 +279,7 @@ export const useFilePreview = ({
228
279
  // Cache, Local & Remote Preview
229
280
  //----------------------------------------------------------------
230
281
 
231
- const mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
282
+ const mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrsWithClientId);
232
283
  useEffect(() => {
233
284
  const cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
234
285
 
@@ -393,6 +444,7 @@ export const useFilePreview = ({
393
444
  onImageError,
394
445
  onImageLoad,
395
446
  getSsrScriptProps,
396
- copyNodeRef
447
+ copyNodeRef,
448
+ clientId
397
449
  };
398
450
  };
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  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; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
6
- import { isImageRepresentationReady, toCommonMediaClientError } from '@atlaskit/media-client';
6
+ import { addFileAttrsToUrl, isImageRepresentationReady, toCommonMediaClientError } from '@atlaskit/media-client';
7
7
  import { useCopyIntent, useFileState, useMediaClient } from '@atlaskit/media-client-react';
8
8
  import { isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -46,20 +46,54 @@ export var useFilePreview = function useFilePreview(_ref) {
46
46
  setStatus = _useState2[1];
47
47
  var _useState3 = useState(),
48
48
  _useState4 = _slicedToArray(_useState3, 2),
49
- error = _useState4[0],
50
- setError = _useState4[1];
49
+ clientId = _useState4[0],
50
+ setClientId = _useState4[1];
51
+
52
+ // Fetch clientId on mount for cross-client copy
53
+ useEffect(function () {
54
+ if (fg('platform_media_cross_client_copy_with_auth')) {
55
+ mediaClient.getClientId(identifier.collectionName).then(setClientId).catch(function () {
56
+ // ClientId is optional, silently fail
57
+ });
58
+ }
59
+ }, [mediaClient, identifier.collectionName]);
60
+
61
+ // Merge clientId into mediaBlobUrlAttrs for embedding in blob URLs
62
+ // If mediaBlobUrlAttrs is not provided, construct minimal attrs from identifier
63
+ var mediaBlobUrlAttrsWithClientId = useMemo(function () {
64
+ if (!fg('platform_media_cross_client_copy_with_auth') || !clientId) {
65
+ return mediaBlobUrlAttrs;
66
+ }
67
+ if (mediaBlobUrlAttrs) {
68
+ return _objectSpread(_objectSpread({}, mediaBlobUrlAttrs), {}, {
69
+ clientId: clientId
70
+ });
71
+ }
72
+
73
+ // Construct minimal attrs when none provided (e.g., MediaImage)
74
+ return {
75
+ id: identifier.id,
76
+ clientId: clientId,
77
+ contextId: identifier.collectionName || '',
78
+ collection: identifier.collectionName
79
+ };
80
+ }, [mediaBlobUrlAttrs, clientId, identifier.id, identifier.collectionName]);
51
81
  var _useState5 = useState(),
52
82
  _useState6 = _slicedToArray(_useState5, 2),
53
- nonCriticalError = _useState6[0],
54
- setNonCriticalError = _useState6[1];
55
- var _useState7 = useState(false),
83
+ error = _useState6[0],
84
+ setError = _useState6[1];
85
+ var _useState7 = useState(),
56
86
  _useState8 = _slicedToArray(_useState7, 2),
57
- isBannedLocalPreview = _useState8[0],
58
- setIsBannedLocalPreview = _useState8[1];
59
- var _useState9 = useState('not-resolved'),
87
+ nonCriticalError = _useState8[0],
88
+ setNonCriticalError = _useState8[1];
89
+ var _useState9 = useState(false),
60
90
  _useState0 = _slicedToArray(_useState9, 2),
61
- upfrontPreviewStatus = _useState0[0],
62
- setUpfrontPreviewStatus = _useState0[1];
91
+ isBannedLocalPreview = _useState0[0],
92
+ setIsBannedLocalPreview = _useState0[1];
93
+ var _useState1 = useState('not-resolved'),
94
+ _useState10 = _slicedToArray(_useState1, 2),
95
+ upfrontPreviewStatus = _useState10[0],
96
+ setUpfrontPreviewStatus = _useState10[1];
63
97
  var ssrReliabilityRef = useRef({
64
98
  server: {
65
99
  status: 'unknown'
@@ -69,10 +103,10 @@ export var useFilePreview = function useFilePreview(_ref) {
69
103
  }
70
104
  });
71
105
  var ufoContext = useInteractionContext();
72
- var _useState1 = useState(false),
73
- _useState10 = _slicedToArray(_useState1, 2),
74
- isLoading = _useState10[0],
75
- setIsLoading = _useState10[1];
106
+ var _useState11 = useState(false),
107
+ _useState12 = _slicedToArray(_useState11, 2),
108
+ isLoading = _useState12[0],
109
+ setIsLoading = _useState12[1];
76
110
  useLayoutEffect(function () {
77
111
  if (isLoading && fg('platform_close_image_blindspot_2')) {
78
112
  return ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.hold('img-loading');
@@ -115,7 +149,7 @@ export var useFilePreview = function useFilePreview(_ref) {
115
149
  // where no SSR occurred, so we should skip SSR preview generation entirely.
116
150
  if (ssr === 'server' || ssrData) {
117
151
  try {
118
- return getSSRPreview(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrs);
152
+ return getSSRPreview(ssr, mediaClient, identifier.id, imageURLParams, mediaBlobUrlAttrsWithClientId);
119
153
  } catch (e) {
120
154
  ssrReliabilityRef.current = _objectSpread(_objectSpread({}, ssrReliabilityRef.current), {}, _defineProperty({}, ssr, _objectSpread({
121
155
  status: 'fail'
@@ -137,10 +171,10 @@ export var useFilePreview = function useFilePreview(_ref) {
137
171
  }
138
172
  }
139
173
  };
140
- var _useState11 = useState(previewInitializer),
141
- _useState12 = _slicedToArray(_useState11, 2),
142
- preview = _useState12[0],
143
- setPreview = _useState12[1];
174
+ var _useState13 = useState(previewInitializer),
175
+ _useState14 = _slicedToArray(_useState13, 2),
176
+ preview = _useState14[0],
177
+ setPreview = _useState14[1];
144
178
 
145
179
  //----------------------------------------------------------------
146
180
  // FILE STATE
@@ -207,11 +241,29 @@ export var useFilePreview = function useFilePreview(_ref) {
207
241
  }
208
242
  }, [preview, identifier, resizeMode]);
209
243
 
244
+ //----------------------------------------------------------------
245
+ // Update preview with clientId when it becomes available
246
+ //----------------------------------------------------------------
247
+ var previewUpdatedWithClientIdRef = useRef(null);
248
+ useEffect(function () {
249
+ // Only update if we have a preview, clientId is available, URL doesn't already have clientId, and feature flag is enabled.
250
+ // Also skip if we've already updated this preview (prevents re-render loops)
251
+ if (preview && clientId && mediaBlobUrlAttrsWithClientId && !preview.dataURI.includes('clientId=') && previewUpdatedWithClientIdRef.current !== identifier.id && fg('platform_media_cross_client_copy_with_auth')) {
252
+ // Mark this preview as updated
253
+ previewUpdatedWithClientIdRef.current = identifier.id;
254
+ var baseUrl = preview.dataURI.split('#')[0]; // Remove any existing hash
255
+ var updatedDataURI = addFileAttrsToUrl(baseUrl, mediaBlobUrlAttrsWithClientId);
256
+ setPreview(_objectSpread(_objectSpread({}, preview), {}, {
257
+ dataURI: updatedDataURI
258
+ }));
259
+ }
260
+ }, [clientId, mediaBlobUrlAttrsWithClientId, preview, identifier.id]);
261
+
210
262
  //----------------------------------------------------------------
211
263
  // Preview Fetch Helper
212
264
  //----------------------------------------------------------------
213
265
  var getAndCacheRemotePreviewRef = useCurrentValueRef(function () {
214
- return getAndCacheRemotePreview(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrs, traceContext);
266
+ return getAndCacheRemotePreview(mediaClient, identifier.id, requestDimensions || {}, imageURLParams, mediaBlobUrlAttrsWithClientId, traceContext);
215
267
  });
216
268
 
217
269
  //----------------------------------------------------------------
@@ -246,7 +298,7 @@ export var useFilePreview = function useFilePreview(_ref) {
246
298
  // Cache, Local & Remote Preview
247
299
  //----------------------------------------------------------------
248
300
 
249
- var mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
301
+ var mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrsWithClientId);
250
302
  useEffect(function () {
251
303
  var cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
252
304
 
@@ -408,6 +460,7 @@ export var useFilePreview = function useFilePreview(_ref) {
408
460
  onImageError: onImageError,
409
461
  onImageLoad: onImageLoad,
410
462
  getSsrScriptProps: getSsrScriptProps,
411
- copyNodeRef: copyNodeRef
463
+ copyNodeRef: copyNodeRef,
464
+ clientId: clientId
412
465
  };
413
466
  };
@@ -40,4 +40,5 @@ export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions,
40
40
  onImageLoad: (newPreview?: MediaFilePreview) => void;
41
41
  getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
42
42
  copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
43
+ clientId: string | undefined;
43
44
  };
@@ -40,4 +40,5 @@ export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions,
40
40
  onImageLoad: (newPreview?: MediaFilePreview) => void;
41
41
  getSsrScriptProps: (() => import("react").ScriptHTMLAttributes<HTMLScriptElement>) | undefined;
42
42
  copyNodeRef: (instance: HTMLDivElement | HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
43
+ clientId: string | undefined;
43
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-file-preview",
3
- "version": "0.15.5",
3
+ "version": "0.16.0",
4
4
  "description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,12 +30,12 @@
30
30
  "sideEffects": false,
31
31
  "atlaskit:src": "src/index.ts",
32
32
  "dependencies": {
33
- "@atlaskit/media-client": "^35.7.0",
34
- "@atlaskit/media-client-react": "^4.1.0",
35
- "@atlaskit/media-common": "^12.3.0",
33
+ "@atlaskit/media-client": "^35.8.0",
34
+ "@atlaskit/media-client-react": "^4.2.0",
35
+ "@atlaskit/media-common": "^12.4.0",
36
36
  "@atlaskit/media-ui": "^28.7.0",
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/react-ufo": "^5.0.0",
38
+ "@atlaskit/react-ufo": "^5.2.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "eventemitter2": "^4.1.0",
41
41
  "lru_map": "^0.4.1"
@@ -52,8 +52,7 @@
52
52
  "@atlaskit/section-message": "^8.12.0",
53
53
  "@atlaskit/ssr": "workspace:^",
54
54
  "@atlassian/feature-flags-test-utils": "^1.0.0",
55
- "@testing-library/react": "^13.4.0",
56
- "@testing-library/react-hooks": "^8.0.1",
55
+ "@testing-library/react": "^16.3.0",
57
56
  "react-dom": "^18.2.0",
58
57
  "wait-for-expect": "^1.2.0"
59
58
  },
@@ -101,6 +100,9 @@
101
100
  },
102
101
  "media-perf-lazy-loading-optimisation": {
103
102
  "type": "boolean"
103
+ },
104
+ "platform_media_cross_client_copy_with_auth": {
105
+ "type": "boolean"
104
106
  }
105
107
  }
106
108
  }