@atlaskit/media-client 27.3.3 → 27.4.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,21 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 27.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#130787](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130787)
8
+ [`64a680780dc57`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/64a680780dc57) -
9
+ Add performance observer metrics for Media Card to assist investigation into hot-110955
10
+
11
+ ## 27.3.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [#120529](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120529)
16
+ [`dc8b7900f9d1b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dc8b7900f9d1b) -
17
+ fix artifacts cdn url
18
+
3
19
  ## 27.3.3
4
20
 
5
21
  ### Patch Changes
@@ -154,7 +154,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
154
154
  if (content instanceof Blob) {
155
155
  size = content.size;
156
156
  mimeType = content.type;
157
- if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type) || (0, _platformFeatureFlags.getBooleanFF)('platform.media-svg-rendering')) {
157
+ if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type) || (0, _platformFeatureFlags.fg)('platform.media-svg-rendering')) {
158
158
  preview = {
159
159
  value: content,
160
160
  origin: 'local'
@@ -10,13 +10,13 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+ var _mediaCore = require("@atlaskit/media-core");
13
14
  var _mediaCommon = require("@atlaskit/media-common");
14
15
  var _constants = require("../../constants");
15
16
  var _artifacts = require("../../models/artifacts");
16
17
  var _request3 = require("../../utils/request");
17
18
  var _helpers = require("../../utils/request/helpers");
18
19
  var _resolveAuth = require("./resolveAuth");
19
- var _mediaCore = require("@atlaskit/media-core");
20
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
21
  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; }
22
22
  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; }
@@ -291,7 +291,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
291
291
  params: extendImageParams(params),
292
292
  auth: auth
293
293
  };
294
- var imageEndpoint = (0, _platformFeatureFlags.getBooleanFF)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
294
+ var imageEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
295
295
  return (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options);
296
296
  }
297
297
  }, {
@@ -309,7 +309,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
309
309
  case 0:
310
310
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : _constants.FILE_CACHE_MAX_AGE;
311
311
  headers = {};
312
- binaryEndpoint = (0, _platformFeatureFlags.getBooleanFF)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
312
+ binaryEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
313
313
  metadata = {
314
314
  method: 'GET',
315
315
  endpoint: "/file/{fileId}/".concat(binaryEndpoint)
@@ -363,7 +363,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
363
363
  },
364
364
  auth: auth
365
365
  };
366
- binaryEndpoint = (0, _platformFeatureFlags.getBooleanFF)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
366
+ binaryEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
367
367
  return _context6.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options));
368
368
  case 7:
369
369
  case "end":
@@ -391,22 +391,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
391
391
  }
392
392
  throw new Error("artifact ".concat(artifactName, " not found"));
393
393
  case 3:
394
- if (artifactUrl.includes('media-cdn')) {
395
- _context7.next = 9;
396
- break;
397
- }
398
- _context7.next = 6;
394
+ _context7.next = 5;
399
395
  return this.resolveAuth({
400
396
  collectionName: collectionName
401
397
  });
402
- case 6:
403
- _context7.t0 = _context7.sent;
404
- _context7.next = 10;
405
- break;
406
- case 9:
407
- _context7.t0 = undefined;
408
- case 10:
409
- auth = _context7.t0;
398
+ case 5:
399
+ auth = _context7.sent;
410
400
  options = {
411
401
  params: {
412
402
  collection: collectionName,
@@ -415,7 +405,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
415
405
  auth: auth
416
406
  };
417
407
  return _context7.abrupt("return", (0, _helpers.createUrl)(artifactUrl, options));
418
- case 13:
408
+ case 8:
419
409
  case "end":
420
410
  return _context7.stop();
421
411
  }
@@ -440,7 +430,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
440
430
  if (isWebpSupported) {
441
431
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
442
432
  }
443
- imageEndpoint = (0, _platformFeatureFlags.getBooleanFF)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
433
+ imageEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
444
434
  metadata = {
445
435
  method: 'GET',
446
436
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
@@ -451,7 +441,8 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
451
441
  },
452
442
  params: extendImageParams(params, fetchMaxRes),
453
443
  headers: headers,
454
- traceContext: traceContext
444
+ traceContext: traceContext,
445
+ addMediaClientParam: (0, _platformFeatureFlags.fg)('platform.media-card-performance-observer_lgc7b') && true
455
446
  });
456
447
  return _context8.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
457
448
  case 7:
@@ -605,7 +596,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
605
596
  body,
606
597
  clientOptions,
607
598
  traceContext,
599
+ addMediaClientParam,
608
600
  auth,
601
+ clientId,
609
602
  extendedTraceContext,
610
603
  response,
611
604
  _args12 = arguments;
@@ -618,31 +611,34 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
618
611
  authContext: {}
619
612
  };
620
613
  controller = _args12.length > 2 ? _args12[2] : undefined;
621
- method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
614
+ method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam;
622
615
  _context12.next = 5;
623
616
  return this.resolveAuth(authContext);
624
617
  case 5:
625
618
  auth = _context12.sent;
619
+ clientId = (0, _mediaCore.isClientBasedAuth)(auth) ? auth.clientId : undefined;
626
620
  extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
627
621
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _mediaCommon.getRandomHex)(8)
628
622
  }) : undefined;
629
- _context12.next = 9;
623
+ _context12.next = 10;
630
624
  return (0, _request3.request)("".concat(auth.baseUrl).concat(path), {
631
625
  method: method,
632
626
  endpoint: endpoint,
633
627
  auth: auth,
634
- params: params,
628
+ params: addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
629
+ clientId: clientId
630
+ }) : params,
635
631
  headers: headers,
636
632
  body: body,
637
633
  clientOptions: clientOptions,
638
634
  traceContext: extendedTraceContext
639
635
  }, controller);
640
- case 9:
636
+ case 10:
641
637
  response = _context12.sent;
642
638
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
643
639
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
644
640
  return _context12.abrupt("return", response);
645
- case 13:
641
+ case 14:
646
642
  case "end":
647
643
  return _context12.stop();
648
644
  }
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getArtifactUrl = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
8
  var getArtifactUrl = exports.getArtifactUrl = function getArtifactUrl(artifacts, prop) {
9
- var _artifacts$prop3;
10
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.media-cdn-delivery')) {
11
- var _artifacts$prop, _artifacts$prop2;
12
- return ((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.cdnUrl) || ((_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url);
9
+ var _artifacts$prop2;
10
+ if ((0, _platformFeatureFlags.fg)('platform.media-cdn-delivery')) {
11
+ var _artifacts$prop;
12
+ return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
13
13
  }
14
- return (_artifacts$prop3 = artifacts[prop]) === null || _artifacts$prop3 === void 0 ? void 0 : _artifacts$prop3.url;
14
+ return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
15
15
  };
@@ -27,7 +27,7 @@ import { shouldFetchRemoteFileStates } from '../../utils/shouldFetchRemoteFileSt
27
27
  import { PollingFunction } from '../../utils/polling';
28
28
  import { isEmptyFile } from '../../utils/detectEmptyFile';
29
29
  import { mediaStore } from '@atlaskit/media-state';
30
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
30
+ import { fg } from '@atlaskit/platform-feature-flags';
31
31
  export { isFileFetcherError, FileFetcherError } from './error';
32
32
  export class FileFetcherImpl {
33
33
  constructor(mediaApi, store = mediaStore) {
@@ -108,7 +108,7 @@ export class FileFetcherImpl {
108
108
  if (content instanceof Blob) {
109
109
  size = content.size;
110
110
  mimeType = content.type;
111
- if (isMimeTypeSupportedByBrowser(content.type) || getBooleanFF('platform.media-svg-rendering')) {
111
+ if (isMimeTypeSupportedByBrowser(content.type) || fg('platform.media-svg-rendering')) {
112
112
  preview = {
113
113
  value: content,
114
114
  origin: 'local'
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { isClientBasedAuth } from '@atlaskit/media-core';
2
3
  import { getRandomHex } from '@atlaskit/media-common';
3
4
  import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
4
5
  import { getArtifactUrl } from '../../models/artifacts';
@@ -6,7 +7,7 @@ import { request } from '../../utils/request';
6
7
  import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
7
8
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
8
9
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  const MEDIA_API_REGION = 'media-api-region';
11
12
  const MEDIA_API_ENVIRONMENT = 'media-api-environment';
12
13
  const extendImageParams = (params, fetchMaxRes = false) => {
@@ -185,12 +186,12 @@ export class MediaStore {
185
186
  params: extendImageParams(params),
186
187
  auth
187
188
  };
188
- const imageEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
189
+ const imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
189
190
  return createUrl(`${auth.baseUrl}/file/${id}/${imageEndpoint}`, options);
190
191
  }
191
192
  async getFileBinary(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
192
193
  const headers = {};
193
- const binaryEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
194
+ const binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
194
195
  const metadata = {
195
196
  method: 'GET',
196
197
  endpoint: `/file/{fileId}/${binaryEndpoint}`
@@ -220,7 +221,7 @@ export class MediaStore {
220
221
  },
221
222
  auth
222
223
  };
223
- const binaryEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
224
+ const binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
224
225
  return createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options);
225
226
  }
226
227
  async getArtifactURL(artifacts, artifactName, collectionName) {
@@ -228,9 +229,9 @@ export class MediaStore {
228
229
  if (!artifactUrl) {
229
230
  throw new Error(`artifact ${artifactName} not found`);
230
231
  }
231
- const auth = !artifactUrl.includes('media-cdn') ? await this.resolveAuth({
232
+ const auth = await this.resolveAuth({
232
233
  collectionName
233
- }) : undefined;
234
+ });
234
235
  const options = {
235
236
  params: {
236
237
  collection: collectionName,
@@ -247,7 +248,7 @@ export class MediaStore {
247
248
  if (isWebpSupported) {
248
249
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
249
250
  }
250
- const imageEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
251
+ const imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
251
252
  const metadata = {
252
253
  method: 'GET',
253
254
  endpoint: `/file/{fileId}/${imageEndpoint}`
@@ -259,7 +260,8 @@ export class MediaStore {
259
260
  },
260
261
  params: extendImageParams(params, fetchMaxRes),
261
262
  headers,
262
- traceContext
263
+ traceContext,
264
+ addMediaClientParam: fg('platform.media-card-performance-observer_lgc7b') && true
263
265
  };
264
266
  return this.request(`/file/${id}/${imageEndpoint}`, options, controller).then(createMapResponseToBlob(metadata));
265
267
  }
@@ -350,9 +352,11 @@ export class MediaStore {
350
352
  headers,
351
353
  body,
352
354
  clientOptions,
353
- traceContext
355
+ traceContext,
356
+ addMediaClientParam
354
357
  } = options;
355
358
  const auth = await this.resolveAuth(authContext);
359
+ const clientId = isClientBasedAuth(auth) ? auth.clientId : undefined;
356
360
  const extendedTraceContext = traceContext ? {
357
361
  ...traceContext,
358
362
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
@@ -361,7 +365,10 @@ export class MediaStore {
361
365
  method,
362
366
  endpoint,
363
367
  auth,
364
- params,
368
+ params: addMediaClientParam ? {
369
+ ...params,
370
+ clientId
371
+ } : params,
365
372
  headers,
366
373
  body,
367
374
  clientOptions,
@@ -1,9 +1,9 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  export const getArtifactUrl = (artifacts, prop) => {
3
- var _artifacts$prop3;
4
- if (getBooleanFF('platform.media-cdn-delivery')) {
5
- var _artifacts$prop, _artifacts$prop2;
6
- return ((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.cdnUrl) || ((_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url);
3
+ var _artifacts$prop2;
4
+ if (fg('platform.media-cdn-delivery')) {
5
+ var _artifacts$prop;
6
+ return `${(_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url}/cdn`;
7
7
  }
8
- return (_artifacts$prop3 = artifacts[prop]) === null || _artifacts$prop3 === void 0 ? void 0 : _artifacts$prop3.url;
8
+ return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
9
9
  };
@@ -33,7 +33,7 @@ import { shouldFetchRemoteFileStates } from '../../utils/shouldFetchRemoteFileSt
33
33
  import { PollingFunction } from '../../utils/polling';
34
34
  import { isEmptyFile } from '../../utils/detectEmptyFile';
35
35
  import { mediaStore } from '@atlaskit/media-state';
36
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
36
+ import { fg } from '@atlaskit/platform-feature-flags';
37
37
  export { isFileFetcherError, FileFetcherError } from './error';
38
38
  export var FileFetcherImpl = /*#__PURE__*/function () {
39
39
  function FileFetcherImpl(mediaApi) {
@@ -137,7 +137,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
137
137
  if (content instanceof Blob) {
138
138
  size = content.size;
139
139
  mimeType = content.type;
140
- if (isMimeTypeSupportedByBrowser(content.type) || getBooleanFF('platform.media-svg-rendering')) {
140
+ if (isMimeTypeSupportedByBrowser(content.type) || fg('platform.media-svg-rendering')) {
141
141
  preview = {
142
142
  value: content,
143
143
  origin: 'local'
@@ -5,6 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  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; }
7
7
  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; }
8
+ import { isClientBasedAuth } from '@atlaskit/media-core';
8
9
  import { getRandomHex } from '@atlaskit/media-common';
9
10
  import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
10
11
  import { getArtifactUrl } from '../../models/artifacts';
@@ -12,7 +13,7 @@ import { request as _request } from '../../utils/request';
12
13
  import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
13
14
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
14
15
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
15
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  var MEDIA_API_REGION = 'media-api-region';
17
18
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
18
19
  var extendImageParams = function extendImageParams(params) {
@@ -284,7 +285,7 @@ export var MediaStore = /*#__PURE__*/function () {
284
285
  params: extendImageParams(params),
285
286
  auth: auth
286
287
  };
287
- var imageEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
288
+ var imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
288
289
  return createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options);
289
290
  }
290
291
  }, {
@@ -302,7 +303,7 @@ export var MediaStore = /*#__PURE__*/function () {
302
303
  case 0:
303
304
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
304
305
  headers = {};
305
- binaryEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
306
+ binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
306
307
  metadata = {
307
308
  method: 'GET',
308
309
  endpoint: "/file/{fileId}/".concat(binaryEndpoint)
@@ -356,7 +357,7 @@ export var MediaStore = /*#__PURE__*/function () {
356
357
  },
357
358
  auth: auth
358
359
  };
359
- binaryEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
360
+ binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
360
361
  return _context6.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options));
361
362
  case 7:
362
363
  case "end":
@@ -384,22 +385,12 @@ export var MediaStore = /*#__PURE__*/function () {
384
385
  }
385
386
  throw new Error("artifact ".concat(artifactName, " not found"));
386
387
  case 3:
387
- if (artifactUrl.includes('media-cdn')) {
388
- _context7.next = 9;
389
- break;
390
- }
391
- _context7.next = 6;
388
+ _context7.next = 5;
392
389
  return this.resolveAuth({
393
390
  collectionName: collectionName
394
391
  });
395
- case 6:
396
- _context7.t0 = _context7.sent;
397
- _context7.next = 10;
398
- break;
399
- case 9:
400
- _context7.t0 = undefined;
401
- case 10:
402
- auth = _context7.t0;
392
+ case 5:
393
+ auth = _context7.sent;
403
394
  options = {
404
395
  params: {
405
396
  collection: collectionName,
@@ -408,7 +399,7 @@ export var MediaStore = /*#__PURE__*/function () {
408
399
  auth: auth
409
400
  };
410
401
  return _context7.abrupt("return", createUrl(artifactUrl, options));
411
- case 13:
402
+ case 8:
412
403
  case "end":
413
404
  return _context7.stop();
414
405
  }
@@ -433,7 +424,7 @@ export var MediaStore = /*#__PURE__*/function () {
433
424
  if (isWebpSupported) {
434
425
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
435
426
  }
436
- imageEndpoint = getBooleanFF('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
427
+ imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
437
428
  metadata = {
438
429
  method: 'GET',
439
430
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
@@ -444,7 +435,8 @@ export var MediaStore = /*#__PURE__*/function () {
444
435
  },
445
436
  params: extendImageParams(params, fetchMaxRes),
446
437
  headers: headers,
447
- traceContext: traceContext
438
+ traceContext: traceContext,
439
+ addMediaClientParam: fg('platform.media-card-performance-observer_lgc7b') && true
448
440
  });
449
441
  return _context8.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller).then(createMapResponseToBlob(metadata)));
450
442
  case 7:
@@ -598,7 +590,9 @@ export var MediaStore = /*#__PURE__*/function () {
598
590
  body,
599
591
  clientOptions,
600
592
  traceContext,
593
+ addMediaClientParam,
601
594
  auth,
595
+ clientId,
602
596
  extendedTraceContext,
603
597
  response,
604
598
  _args12 = arguments;
@@ -611,31 +605,34 @@ export var MediaStore = /*#__PURE__*/function () {
611
605
  authContext: {}
612
606
  };
613
607
  controller = _args12.length > 2 ? _args12[2] : undefined;
614
- method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
608
+ method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam;
615
609
  _context12.next = 5;
616
610
  return this.resolveAuth(authContext);
617
611
  case 5:
618
612
  auth = _context12.sent;
613
+ clientId = isClientBasedAuth(auth) ? auth.clientId : undefined;
619
614
  extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
620
615
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
621
616
  }) : undefined;
622
- _context12.next = 9;
617
+ _context12.next = 10;
623
618
  return _request("".concat(auth.baseUrl).concat(path), {
624
619
  method: method,
625
620
  endpoint: endpoint,
626
621
  auth: auth,
627
- params: params,
622
+ params: addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
623
+ clientId: clientId
624
+ }) : params,
628
625
  headers: headers,
629
626
  body: body,
630
627
  clientOptions: clientOptions,
631
628
  traceContext: extendedTraceContext
632
629
  }, controller);
633
- case 9:
630
+ case 10:
634
631
  response = _context12.sent;
635
632
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
636
633
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
637
634
  return _context12.abrupt("return", response);
638
- case 13:
635
+ case 14:
639
636
  case "end":
640
637
  return _context12.stop();
641
638
  }
@@ -1,9 +1,9 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  export var getArtifactUrl = function getArtifactUrl(artifacts, prop) {
3
- var _artifacts$prop3;
4
- if (getBooleanFF('platform.media-cdn-delivery')) {
5
- var _artifacts$prop, _artifacts$prop2;
6
- return ((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.cdnUrl) || ((_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url);
3
+ var _artifacts$prop2;
4
+ if (fg('platform.media-cdn-delivery')) {
5
+ var _artifacts$prop;
6
+ return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
7
7
  }
8
- return (_artifacts$prop3 = artifacts[prop]) === null || _artifacts$prop3 === void 0 ? void 0 : _artifacts$prop3.url;
8
+ return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
9
9
  };
@@ -1,5 +1,5 @@
1
1
  import { type Auth, type AsapBasedAuth, type AuthContext, type ClientAltBasedAuth } from '@atlaskit/media-core';
2
- import { type MediaTraceContext } from '@atlaskit/media-common';
2
+ import { type SSR, type MediaTraceContext } from '@atlaskit/media-common';
3
3
  import { type MediaFileArtifacts } from '@atlaskit/media-state';
4
4
  import { type MediaItemDetails, type MediaFile, type MediaUpload } from '../../models/media';
5
5
  import { type ClientOptions, type RequestHeaders, type RequestMethod, type RequestParams, type RequestMetadata } from '../../utils/request/types';
@@ -37,6 +37,7 @@ export type MediaStoreRequestOptions = RequestMetadata & {
37
37
  readonly clientOptions?: ClientOptions;
38
38
  readonly traceContext?: MediaTraceContext;
39
39
  readonly ChunkhashAlgorithm?: ChunkHashAlgorithm;
40
+ readonly addMediaClientParam?: boolean;
40
41
  };
41
42
  export type MediaStoreCreateFileFromUploadParams = {
42
43
  readonly collection?: string;
@@ -94,6 +95,8 @@ export type MediaStoreGetFileImageParams = {
94
95
  readonly mode?: 'fit' | 'full-fit' | 'crop';
95
96
  readonly upscale?: boolean;
96
97
  readonly 'max-age'?: number;
98
+ readonly source?: string;
99
+ readonly ssr?: SSR;
97
100
  };
98
101
  export interface SourceFile {
99
102
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { type Auth, type AsapBasedAuth, type AuthContext, type ClientAltBasedAuth } from '@atlaskit/media-core';
2
- import { type MediaTraceContext } from '@atlaskit/media-common';
2
+ import { type SSR, type MediaTraceContext } from '@atlaskit/media-common';
3
3
  import { type MediaFileArtifacts } from '@atlaskit/media-state';
4
4
  import { type MediaItemDetails, type MediaFile, type MediaUpload } from '../../models/media';
5
5
  import { type ClientOptions, type RequestHeaders, type RequestMethod, type RequestParams, type RequestMetadata } from '../../utils/request/types';
@@ -37,6 +37,7 @@ export type MediaStoreRequestOptions = RequestMetadata & {
37
37
  readonly clientOptions?: ClientOptions;
38
38
  readonly traceContext?: MediaTraceContext;
39
39
  readonly ChunkhashAlgorithm?: ChunkHashAlgorithm;
40
+ readonly addMediaClientParam?: boolean;
40
41
  };
41
42
  export type MediaStoreCreateFileFromUploadParams = {
42
43
  readonly collection?: string;
@@ -94,6 +95,8 @@ export type MediaStoreGetFileImageParams = {
94
95
  readonly mode?: 'fit' | 'full-fit' | 'crop';
95
96
  readonly upscale?: boolean;
96
97
  readonly 'max-age'?: number;
98
+ readonly source?: string;
99
+ readonly ssr?: SSR;
97
100
  };
98
101
  export interface SourceFile {
99
102
  id: string;
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
  import { type ChangeEvent, type ReactNode } from 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "27.3.3",
3
+ "version": "27.4.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/chunkinator": "^6.0.0",
40
- "@atlaskit/media-common": "^11.3.0",
40
+ "@atlaskit/media-common": "^11.4.0",
41
41
  "@atlaskit/platform-feature-flags": "0.3.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "dataloader": "^2.0.0",
@@ -53,14 +53,14 @@
53
53
  "xstate": "4.20.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/media-core": "^34.1.2",
56
+ "@atlaskit/media-core": "^34.3.0",
57
57
  "@atlaskit/media-state": "^1.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@atlaskit/media-core": "^34.2.0",
60
+ "@atlaskit/media-core": "^34.3.0",
61
61
  "@atlaskit/media-state": "^1.1.0",
62
62
  "@atlaskit/ssr": "*",
63
- "@atlaskit/tokens": "^1.56.0",
63
+ "@atlaskit/tokens": "^1.59.0",
64
64
  "@atlassian/feature-flags-test-utils": "0.2.3",
65
65
  "@emotion/react": "^11.7.1",
66
66
  "@types/deep-equal": "^1.0.1",
@@ -89,6 +89,9 @@
89
89
  },
90
90
  "platform.media-cdn-delivery": {
91
91
  "type": "boolean"
92
+ },
93
+ "platform.media-card-performance-observer_lgc7b": {
94
+ "type": "boolean"
92
95
  }
93
96
  }
94
97
  }