@atlaskit/media-client 26.1.0 → 26.1.2

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-client
2
2
 
3
+ ## 26.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#71336](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71336) [`9abd05a91e25`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9abd05a91e25) - Fixed image load performance issue where setting max age in getFileImageURL params to undefined would override the default
8
+
9
+ ## 26.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#65817](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65817) [`3be0ec786219`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3be0ec786219) - Updated mocked Media Api mothod
14
+
3
15
  ## 26.1.0
4
16
 
5
17
  ### Minor Changes
@@ -20,14 +20,14 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
20
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
21
  var MEDIA_API_REGION = 'media-api-region';
22
22
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
23
- var defaultImageOptions = {
24
- 'max-age': _constants.FILE_CACHE_MAX_AGE,
25
- allowAnimated: true,
26
- mode: 'crop'
27
- };
28
23
  var extendImageParams = function extendImageParams(params) {
24
+ var _params$maxAge, _params$allowAnimated, _params$mode;
29
25
  var fetchMaxRes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
30
- return _objectSpread(_objectSpread(_objectSpread({}, defaultImageOptions), params), fetchMaxRes ? {
26
+ return _objectSpread(_objectSpread({}, params), {}, {
27
+ 'max-age': (_params$maxAge = params === null || params === void 0 ? void 0 : params['max-age']) !== null && _params$maxAge !== void 0 ? _params$maxAge : _constants.FILE_CACHE_MAX_AGE,
28
+ allowAnimated: (_params$allowAnimated = params === null || params === void 0 ? void 0 : params.allowAnimated) !== null && _params$allowAnimated !== void 0 ? _params$allowAnimated : true,
29
+ mode: (_params$mode = params === null || params === void 0 ? void 0 : params.mode) !== null && _params$mode !== void 0 ? _params$mode : 'crop'
30
+ }, fetchMaxRes ? {
31
31
  width: _constants.MAX_RESOLUTION,
32
32
  height: _constants.MAX_RESOLUTION
33
33
  } : {});
@@ -208,9 +208,8 @@ var getMediaApi = function getMediaApi(_ref) {
208
208
  }
209
209
  return getFileImageURL;
210
210
  }(),
211
- // TODO
212
- getFileImageURLSync: function getFileImageURLSync() {
213
- throw new Error('500 - MockedMediaApi.getFileImageURLSync: method not implemented');
211
+ getFileImageURLSync: function getFileImageURLSync(id) {
212
+ return "image-url-sync-".concat(id);
214
213
  },
215
214
  getFileBinaryURL: function () {
216
215
  var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id) {
@@ -7,15 +7,13 @@ import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../
7
7
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
8
8
  const MEDIA_API_REGION = 'media-api-region';
9
9
  const MEDIA_API_ENVIRONMENT = 'media-api-environment';
10
- const defaultImageOptions = {
11
- 'max-age': FILE_CACHE_MAX_AGE,
12
- allowAnimated: true,
13
- mode: 'crop'
14
- };
15
10
  const extendImageParams = (params, fetchMaxRes = false) => {
11
+ var _params$maxAge, _params$allowAnimated, _params$mode;
16
12
  return {
17
- ...defaultImageOptions,
18
13
  ...params,
14
+ 'max-age': (_params$maxAge = params === null || params === void 0 ? void 0 : params['max-age']) !== null && _params$maxAge !== void 0 ? _params$maxAge : FILE_CACHE_MAX_AGE,
15
+ allowAnimated: (_params$allowAnimated = params === null || params === void 0 ? void 0 : params.allowAnimated) !== null && _params$allowAnimated !== void 0 ? _params$allowAnimated : true,
16
+ mode: (_params$mode = params === null || params === void 0 ? void 0 : params.mode) !== null && _params$mode !== void 0 ? _params$mode : 'crop',
19
17
  ...(fetchMaxRes ? {
20
18
  width: MAX_RESOLUTION,
21
19
  height: MAX_RESOLUTION
@@ -65,9 +65,8 @@ const getMediaApi = ({
65
65
  getFileImageURL: async () => {
66
66
  throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
67
67
  },
68
- // TODO
69
- getFileImageURLSync: () => {
70
- throw new Error('500 - MockedMediaApi.getFileImageURLSync: method not implemented');
68
+ getFileImageURLSync: id => {
69
+ return `image-url-sync-${id}`;
71
70
  },
72
71
  getFileBinaryURL: async id => {
73
72
  const fileItem = getItem(id);
@@ -13,14 +13,14 @@ import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../
13
13
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
14
14
  var MEDIA_API_REGION = 'media-api-region';
15
15
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
16
- var defaultImageOptions = {
17
- 'max-age': FILE_CACHE_MAX_AGE,
18
- allowAnimated: true,
19
- mode: 'crop'
20
- };
21
16
  var extendImageParams = function extendImageParams(params) {
17
+ var _params$maxAge, _params$allowAnimated, _params$mode;
22
18
  var fetchMaxRes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
23
- return _objectSpread(_objectSpread(_objectSpread({}, defaultImageOptions), params), fetchMaxRes ? {
19
+ return _objectSpread(_objectSpread({}, params), {}, {
20
+ 'max-age': (_params$maxAge = params === null || params === void 0 ? void 0 : params['max-age']) !== null && _params$maxAge !== void 0 ? _params$maxAge : FILE_CACHE_MAX_AGE,
21
+ allowAnimated: (_params$allowAnimated = params === null || params === void 0 ? void 0 : params.allowAnimated) !== null && _params$allowAnimated !== void 0 ? _params$allowAnimated : true,
22
+ mode: (_params$mode = params === null || params === void 0 ? void 0 : params.mode) !== null && _params$mode !== void 0 ? _params$mode : 'crop'
23
+ }, fetchMaxRes ? {
24
24
  width: MAX_RESOLUTION,
25
25
  height: MAX_RESOLUTION
26
26
  } : {});
@@ -201,9 +201,8 @@ var getMediaApi = function getMediaApi(_ref) {
201
201
  }
202
202
  return getFileImageURL;
203
203
  }(),
204
- // TODO
205
- getFileImageURLSync: function getFileImageURLSync() {
206
- throw new Error('500 - MockedMediaApi.getFileImageURLSync: method not implemented');
204
+ getFileImageURLSync: function getFileImageURLSync(id) {
205
+ return "image-url-sync-".concat(id);
207
206
  },
208
207
  getFileBinaryURL: function () {
209
208
  var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "26.1.0",
3
+ "version": "26.1.2",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/media-core": "^34.1.0",
59
59
  "@atlaskit/media-state": "^1.0.0",
60
60
  "@atlaskit/ssr": "*",
61
- "@atlaskit/tokens": "^1.30.0",
61
+ "@atlaskit/tokens": "^1.35.0",
62
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
63
63
  "@emotion/react": "^11.7.1",
64
64
  "@types/deep-equal": "^1.0.1",