@atlaskit/media-client 35.2.1 → 35.3.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/constants/package.json +1 -1
  3. package/dist/cjs/client/media-store/MediaStore.js +1 -3
  4. package/dist/cjs/models/artifacts.js +2 -3
  5. package/dist/cjs/utils/convertBase64ToBlob.js +2 -0
  6. package/dist/cjs/utils/mediaCdn.js +6 -6
  7. package/dist/es2019/client/media-store/MediaStore.js +2 -4
  8. package/dist/es2019/models/artifacts.js +2 -3
  9. package/dist/es2019/utils/convertBase64ToBlob.js +2 -0
  10. package/dist/es2019/utils/mediaCdn.js +5 -6
  11. package/dist/esm/client/media-store/MediaStore.js +2 -4
  12. package/dist/esm/models/artifacts.js +2 -3
  13. package/dist/esm/utils/convertBase64ToBlob.js +2 -0
  14. package/dist/esm/utils/mediaCdn.js +5 -6
  15. package/dist/types/client/__mocks__/collection-fetcher.d.ts +0 -1
  16. package/dist/types/client/__mocks__/file-fetcher.d.ts +0 -1
  17. package/dist/types/client/__mocks__/media-client.d.ts +0 -1
  18. package/dist/types/globalMediaEventEmitter.d.ts +2 -2
  19. package/dist/types/models/file-state.d.ts +1 -1
  20. package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +1 -1
  21. package/dist/types/utils/mediaCdn.d.ts +1 -0
  22. package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
  23. package/dist/types/utils/url.d.ts +1 -1
  24. package/dist/types-ts4.5/client/__mocks__/collection-fetcher.d.ts +0 -1
  25. package/dist/types-ts4.5/client/__mocks__/file-fetcher.d.ts +0 -1
  26. package/dist/types-ts4.5/client/__mocks__/media-client.d.ts +0 -1
  27. package/dist/types-ts4.5/globalMediaEventEmitter.d.ts +2 -2
  28. package/dist/types-ts4.5/models/file-state.d.ts +1 -1
  29. package/dist/types-ts4.5/utils/imageResizeModeToFileImageMode.d.ts +1 -1
  30. package/dist/types-ts4.5/utils/mediaCdn.d.ts +1 -0
  31. package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
  32. package/dist/types-ts4.5/utils/url.d.ts +1 -1
  33. package/package.json +4 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 35.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 35.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#197821](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/197821)
14
+ [`33a6ed876f806`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/33a6ed876f806) -
15
+ Add feature flag and logic that disable Media CDN delivery for requests from Isolated Cloud
16
+
3
17
  ## 35.2.1
4
18
 
5
19
  ### Patch Changes
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/constants.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/constants.d.ts"
12
12
  ]
@@ -17,8 +17,6 @@ var _request3 = require("../../utils/request");
17
17
  var _helpers = require("../../utils/request/helpers");
18
18
  var _mediaCdn = require("../../utils/mediaCdn");
19
19
  var _resolveAuth = require("./resolveAuth");
20
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
- var _isCommercial = require("../../utils/isCommercial");
22
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
22
  var MEDIA_API_REGION = 'media-api-region';
@@ -41,7 +39,7 @@ var jsonHeaders = {
41
39
  };
42
40
  var cdnFeatureFlag = function cdnFeatureFlag(endpoint) {
43
41
  var result = endpoint;
44
- if ((0, _isCommercial.isCommercial)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery')) {
42
+ if ((0, _mediaCdn.isCDNEnabled)()) {
45
43
  result += '/cdn';
46
44
  }
47
45
  return result;
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getArtifactUrl = void 0;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
- var _isCommercial = require("../utils/isCommercial");
7
+ var _mediaCdn = require("../utils/mediaCdn");
9
8
  var getArtifactUrl = exports.getArtifactUrl = function getArtifactUrl(artifacts, prop) {
10
9
  var _artifacts$prop, _artifacts$prop3;
11
10
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
12
- if ((0, _isCommercial.isCommercial)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
11
+ if ((0, _mediaCdn.isCDNEnabled)() && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
13
12
  var _artifacts$prop2;
14
13
  return "".concat((_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url, "/cdn");
15
14
  }
@@ -20,6 +20,8 @@ var convertBase64ToBlob = exports.convertBase64ToBlob = function convertBase64To
20
20
  for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
21
21
  _loop();
22
22
  }
23
+
24
+ // @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
23
25
  return new Blob(byteArrays, {
24
26
  type: 'image/jpeg'
25
27
  });
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MEDIA_CDN_MAP = void 0;
7
+ exports.isCDNEnabled = isCDNEnabled;
7
8
  exports.mapToMediaCdnUrl = mapToMediaCdnUrl;
8
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
10
  var _isCommercial = require("./isCommercial");
@@ -17,17 +18,16 @@ var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
17
18
  // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
18
19
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
19
20
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
21
+ function isCDNEnabled() {
22
+ var isIsolatedCloudWithDisabledCDN = (0, _platformFeatureFlags.fg)('platform_disable_isolated_cloud_media_cdn_delivery') && (0, _atlassianContext.isIsolatedCloud)();
23
+ return (0, _isCommercial.isCommercial)() && !isIsolatedCloudWithDisabledCDN && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery');
24
+ }
20
25
  function mapToMediaCdnUrl(url, token) {
21
26
  var _token$length;
22
27
  var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
23
- if (!(0, _isCommercial.isCommercial)() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
28
+ if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
24
29
  return url;
25
30
  }
26
- if ((0, _platformFeatureFlags.fg)('platform_disable_isolated_cloud_media_cdn_delivery')) {
27
- if ((0, _atlassianContext.isIsolatedCloud)()) {
28
- return url;
29
- }
30
- }
31
31
 
32
32
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
33
33
  if ((0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
@@ -4,11 +4,9 @@ import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
4
4
  import { getArtifactUrl } from '../../models/artifacts';
5
5
  import { isRequestError, request } from '../../utils/request';
6
6
  import { createUrl, createMapResponseToJson, createMapResponseToBlob, defaultShouldRetryError, extendTraceContext } from '../../utils/request/helpers';
7
- import { mapToMediaCdnUrl } from '../../utils/mediaCdn';
7
+ import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
8
8
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
9
9
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
- import { isCommercial } from '../../utils/isCommercial';
12
10
  const MEDIA_API_REGION = 'media-api-region';
13
11
  const MEDIA_API_ENVIRONMENT = 'media-api-environment';
14
12
  const extendImageParams = (params, fetchMaxRes = false) => {
@@ -30,7 +28,7 @@ const jsonHeaders = {
30
28
  };
31
29
  const cdnFeatureFlag = endpoint => {
32
30
  let result = endpoint;
33
- if (isCommercial() && fg('platform_media_cdn_delivery')) {
31
+ if (isCDNEnabled()) {
34
32
  result += '/cdn';
35
33
  }
36
34
  return result;
@@ -1,9 +1,8 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isCommercial } from '../utils/isCommercial';
1
+ import { isCDNEnabled } from '../utils/mediaCdn';
3
2
  export const getArtifactUrl = (artifacts, prop) => {
4
3
  var _artifacts$prop, _artifacts$prop3;
5
4
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
6
- if (isCommercial() && fg('platform_media_cdn_delivery') && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
5
+ if (isCDNEnabled() && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
7
6
  var _artifacts$prop2;
8
7
  return `${(_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url}/cdn`;
9
8
  }
@@ -9,6 +9,8 @@ export const convertBase64ToBlob = base64 => {
9
9
  const byteArray = new Uint8Array(byteNumbers);
10
10
  byteArrays.push(byteArray);
11
11
  }
12
+
13
+ // @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
12
14
  return new Blob(byteArrays, {
13
15
  type: 'image/jpeg'
14
16
  });
@@ -10,17 +10,16 @@ export const MEDIA_CDN_MAP = {
10
10
  // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
11
11
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
12
12
  const MEDIA_TOKEN_LENGTH_LIMIT = 7000;
13
+ export function isCDNEnabled() {
14
+ const isIsolatedCloudWithDisabledCDN = fg('platform_disable_isolated_cloud_media_cdn_delivery') && isIsolatedCloud();
15
+ return isCommercial() && !isIsolatedCloudWithDisabledCDN && fg('platform_media_cdn_delivery');
16
+ }
13
17
  export function mapToMediaCdnUrl(url, token) {
14
18
  var _token$length;
15
19
  const tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
16
- if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
20
+ if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
17
21
  return url;
18
22
  }
19
- if (fg('platform_disable_isolated_cloud_media_cdn_delivery')) {
20
- if (isIsolatedCloud()) {
21
- return url;
22
- }
23
- }
24
23
 
25
24
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
26
25
  if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
@@ -10,11 +10,9 @@ import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
10
10
  import { getArtifactUrl } from '../../models/artifacts';
11
11
  import { isRequestError, request as _request } from '../../utils/request';
12
12
  import { createUrl, createMapResponseToJson, createMapResponseToBlob, defaultShouldRetryError, extendTraceContext } from '../../utils/request/helpers';
13
- import { mapToMediaCdnUrl } from '../../utils/mediaCdn';
13
+ import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
14
14
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
15
15
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
- import { isCommercial } from '../../utils/isCommercial';
18
16
  var MEDIA_API_REGION = 'media-api-region';
19
17
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
20
18
  var extendImageParams = function extendImageParams(params) {
@@ -35,7 +33,7 @@ var jsonHeaders = {
35
33
  };
36
34
  var cdnFeatureFlag = function cdnFeatureFlag(endpoint) {
37
35
  var result = endpoint;
38
- if (isCommercial() && fg('platform_media_cdn_delivery')) {
36
+ if (isCDNEnabled()) {
39
37
  result += '/cdn';
40
38
  }
41
39
  return result;
@@ -1,9 +1,8 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isCommercial } from '../utils/isCommercial';
1
+ import { isCDNEnabled } from '../utils/mediaCdn';
3
2
  export var getArtifactUrl = function getArtifactUrl(artifacts, prop) {
4
3
  var _artifacts$prop, _artifacts$prop3;
5
4
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
6
- if (isCommercial() && fg('platform_media_cdn_delivery') && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
5
+ if (isCDNEnabled() && (_artifacts$prop = artifacts[prop]) !== null && _artifacts$prop !== void 0 && _artifacts$prop.url) {
7
6
  var _artifacts$prop2;
8
7
  return "".concat((_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url, "/cdn");
9
8
  }
@@ -14,6 +14,8 @@ export var convertBase64ToBlob = function convertBase64ToBlob(base64) {
14
14
  for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
15
15
  _loop();
16
16
  }
17
+
18
+ // @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
17
19
  return new Blob(byteArrays, {
18
20
  type: 'image/jpeg'
19
21
  });
@@ -10,17 +10,16 @@ export var MEDIA_CDN_MAP = {
10
10
  // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
11
11
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
12
12
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
13
+ export function isCDNEnabled() {
14
+ var isIsolatedCloudWithDisabledCDN = fg('platform_disable_isolated_cloud_media_cdn_delivery') && isIsolatedCloud();
15
+ return isCommercial() && !isIsolatedCloudWithDisabledCDN && fg('platform_media_cdn_delivery');
16
+ }
13
17
  export function mapToMediaCdnUrl(url, token) {
14
18
  var _token$length;
15
19
  var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
16
- if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
20
+ if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
17
21
  return url;
18
22
  }
19
- if (fg('platform_disable_isolated_cloud_media_cdn_delivery')) {
20
- if (isIsolatedCloud()) {
21
- return url;
22
- }
23
- }
24
23
 
25
24
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
26
25
  if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare const collectionCache: {};
3
2
  export declare class CollectionFetcher {
4
3
  constructor();
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare class FileFetcher {
3
2
  constructor();
4
3
  getFileState: jest.Mock<any, any, any>;
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { type MediaClientConfig } from '@atlaskit/media-core';
3
2
  import { type FileFetcher } from '../file-fetcher';
4
3
  export declare class MediaClient {
@@ -1,6 +1,6 @@
1
1
  import { type UploadEventPayloadMap, type EventPayloadListener } from './client/events';
2
2
  export declare const globalMediaEventEmitter: {
3
3
  on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
4
- off<E_1 extends keyof UploadEventPayloadMap>(event: E_1, listener: EventPayloadListener<UploadEventPayloadMap, E_1>): void;
5
- emit<E_2 extends keyof UploadEventPayloadMap>(event: E_2, payload: UploadEventPayloadMap[E_2]): boolean | undefined;
4
+ off<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
5
+ emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean | undefined;
6
6
  };
@@ -20,7 +20,7 @@ export declare const isUploadingFileState: (fileState: FileState) => fileState i
20
20
  export declare const isProcessingFileState: (fileState: FileState) => fileState is ProcessingFileState;
21
21
  export declare const isProcessedFileState: (fileState: FileState) => fileState is ProcessedFileState;
22
22
  export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
23
- export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
23
+ export declare const isPreviewableFileState: (fileState: FileState) => fileState is Exclude<FileState, ErrorFileState> & PreviewableFileState;
24
24
  export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
25
25
  export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
26
26
  export declare const hasArtifacts: (fileState: FileState) => fileState is FileState & {
@@ -1,3 +1,3 @@
1
1
  import { type MediaStoreGetFileImageParams } from '../client/media-store';
2
2
  export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
- export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams['mode'];
3
+ export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams["mode"];
@@ -1,4 +1,5 @@
1
1
  export declare const MEDIA_CDN_MAP: {
2
2
  [key: string]: string;
3
3
  };
4
+ export declare function isCDNEnabled(): boolean;
4
5
  export declare function mapToMediaCdnUrl(url: string, token: string): string;
@@ -1,5 +1,5 @@
1
1
  import { type FileState } from '@atlaskit/media-state';
2
2
  import { type MediaType } from '../models/media';
3
3
  export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
4
- mediaType?: MediaType | undefined;
4
+ mediaType?: MediaType;
5
5
  };
@@ -12,6 +12,6 @@ export interface MediaBlobUrlAttrs {
12
12
  }
13
13
  export declare const getAttrsFromUrl: (blobUrl: string) => MediaBlobUrlAttrs | undefined;
14
14
  export declare const objectToQueryString: (json: {
15
- [key: string]: string | number | boolean | null | undefined;
15
+ [key: string]: string | number | boolean | undefined | null;
16
16
  }) => string;
17
17
  export declare const addFileAttrsToUrl: (url: string, fileAttrs: MediaBlobUrlAttrs) => string;
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare const collectionCache: {};
3
2
  export declare class CollectionFetcher {
4
3
  constructor();
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare class FileFetcher {
3
2
  constructor();
4
3
  getFileState: jest.Mock<any, any, any>;
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { type MediaClientConfig } from '@atlaskit/media-core';
3
2
  import { type FileFetcher } from '../file-fetcher';
4
3
  export declare class MediaClient {
@@ -1,6 +1,6 @@
1
1
  import { type UploadEventPayloadMap, type EventPayloadListener } from './client/events';
2
2
  export declare const globalMediaEventEmitter: {
3
3
  on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
4
- off<E_1 extends keyof UploadEventPayloadMap>(event: E_1, listener: EventPayloadListener<UploadEventPayloadMap, E_1>): void;
5
- emit<E_2 extends keyof UploadEventPayloadMap>(event: E_2, payload: UploadEventPayloadMap[E_2]): boolean | undefined;
4
+ off<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
5
+ emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean | undefined;
6
6
  };
@@ -20,7 +20,7 @@ export declare const isUploadingFileState: (fileState: FileState) => fileState i
20
20
  export declare const isProcessingFileState: (fileState: FileState) => fileState is ProcessingFileState;
21
21
  export declare const isProcessedFileState: (fileState: FileState) => fileState is ProcessedFileState;
22
22
  export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
23
- export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
23
+ export declare const isPreviewableFileState: (fileState: FileState) => fileState is Exclude<FileState, ErrorFileState> & PreviewableFileState;
24
24
  export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
25
25
  export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
26
26
  export declare const hasArtifacts: (fileState: FileState) => fileState is FileState & {
@@ -1,3 +1,3 @@
1
1
  import { type MediaStoreGetFileImageParams } from '../client/media-store';
2
2
  export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
- export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams['mode'];
3
+ export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams["mode"];
@@ -1,4 +1,5 @@
1
1
  export declare const MEDIA_CDN_MAP: {
2
2
  [key: string]: string;
3
3
  };
4
+ export declare function isCDNEnabled(): boolean;
4
5
  export declare function mapToMediaCdnUrl(url: string, token: string): string;
@@ -1,5 +1,5 @@
1
1
  import { type FileState } from '@atlaskit/media-state';
2
2
  import { type MediaType } from '../models/media';
3
3
  export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
4
- mediaType?: MediaType | undefined;
4
+ mediaType?: MediaType;
5
5
  };
@@ -12,6 +12,6 @@ export interface MediaBlobUrlAttrs {
12
12
  }
13
13
  export declare const getAttrsFromUrl: (blobUrl: string) => MediaBlobUrlAttrs | undefined;
14
14
  export declare const objectToQueryString: (json: {
15
- [key: string]: string | number | boolean | null | undefined;
15
+ [key: string]: string | number | boolean | undefined | null;
16
16
  }) => string;
17
17
  export declare const addFileAttrsToUrl: (url: string, fileAttrs: MediaBlobUrlAttrs) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "35.2.1",
3
+ "version": "35.3.1",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@atlaskit/atlassian-context": "^0.4.0",
37
+ "@atlaskit/atlassian-context": "^0.5.0",
38
38
  "@atlaskit/chunkinator": "^7.0.0",
39
39
  "@atlaskit/media-common": "^12.3.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -58,15 +58,14 @@
58
58
  "@atlaskit/media-core": "^37.0.0",
59
59
  "@atlaskit/media-state": "^1.8.0",
60
60
  "@atlaskit/ssr": "workspace:^",
61
- "@atlaskit/tokens": "^5.6.0",
61
+ "@atlaskit/tokens": "^6.0.0",
62
62
  "@atlassian/feature-flags-test-utils": "^0.3.0",
63
63
  "@emotion/react": "^11.7.1",
64
64
  "@types/deep-equal": "^1.0.1",
65
65
  "@types/uuid-validate": "^0.0.2",
66
66
  "fetch-mock": "^8.0.0",
67
67
  "react": "^18.2.0",
68
- "react-dom": "^18.2.0",
69
- "typescript": "~5.4.2"
68
+ "react-dom": "^18.2.0"
70
69
  },
71
70
  "techstack": {
72
71
  "@atlassian/frontend": {