@atlaskit/media-client 36.2.0 → 36.2.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,26 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 36.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c0dbd7b223090`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0dbd7b223090) -
8
+ Add `isGCPtenant()` utility to `media-common` and guard CDN delivery in `media-client` for GCP
9
+ tenants.
10
+
11
+ CDN (CloudFront) is an AWS service that is not available on GCP tenants. Browser CDN GET requests
12
+ were failing with HTTP 500 on GCP environments because `isCDNEnabled()` had no guard for GCP. This
13
+ fix adds `!isGCPtenant()` to `isCDNEnabled()` and to the inner feature-flag check in
14
+ `mapToMediaCdnUrl()`, mirroring the existing `isIsolatedCloud()` pattern.
15
+
16
+ - Updated dependencies
17
+
18
+ ## 36.2.1
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 36.2.0
4
25
 
5
26
  ### Minor Changes
@@ -9,6 +9,7 @@ exports.mapToMediaCdnUrl = mapToMediaCdnUrl;
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
10
  var _isCommercial = require("./isCommercial");
11
11
  var _atlassianContext = require("@atlaskit/atlassian-context");
12
+ var _mediaEnvUtils = require("@atlaskit/media-common/mediaEnvUtils");
12
13
  var _pathBasedUrl = require("./pathBasedUrl");
13
14
  var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
14
15
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
@@ -20,7 +21,7 @@ var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
20
21
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
21
22
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
22
23
  function isCDNEnabled() {
23
- return (0, _isCommercial.isCommercial)() && !(0, _atlassianContext.isIsolatedCloud)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0, _pathBasedUrl.isPathBasedEnabled)();
24
+ return (0, _isCommercial.isCommercial)() && !(0, _atlassianContext.isIsolatedCloud)() && !(0, _mediaEnvUtils.isGCPtenant)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0, _pathBasedUrl.isPathBasedEnabled)();
24
25
  }
25
26
  function mapToMediaCdnUrl(url, token) {
26
27
  var _token$length;
@@ -30,7 +31,7 @@ function mapToMediaCdnUrl(url, token) {
30
31
  }
31
32
 
32
33
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
33
- if ((0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
34
+ if (!(0, _mediaEnvUtils.isGCPtenant)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
34
35
  try {
35
36
  var parsedUrl = new URL(url);
36
37
  var cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
@@ -1,6 +1,7 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { isCommercial } from './isCommercial';
3
3
  import { isIsolatedCloud } from '@atlaskit/atlassian-context';
4
+ import { isGCPtenant } from '@atlaskit/media-common/mediaEnvUtils';
4
5
  import { isPathBasedEnabled } from './pathBasedUrl';
5
6
  export const MEDIA_CDN_MAP = {
6
7
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
@@ -12,7 +13,7 @@ export const MEDIA_CDN_MAP = {
12
13
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
13
14
  const MEDIA_TOKEN_LENGTH_LIMIT = 7000;
14
15
  export function isCDNEnabled() {
15
- return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
16
+ return isCommercial() && !isIsolatedCloud() && !isGCPtenant() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
16
17
  }
17
18
  export function mapToMediaCdnUrl(url, token) {
18
19
  var _token$length;
@@ -22,7 +23,7 @@ export function mapToMediaCdnUrl(url, token) {
22
23
  }
23
24
 
24
25
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
25
- if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
26
+ if (!isGCPtenant() && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
26
27
  try {
27
28
  const parsedUrl = new URL(url);
28
29
  const cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
@@ -1,6 +1,7 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { isCommercial } from './isCommercial';
3
3
  import { isIsolatedCloud } from '@atlaskit/atlassian-context';
4
+ import { isGCPtenant } from '@atlaskit/media-common/mediaEnvUtils';
4
5
  import { isPathBasedEnabled } from './pathBasedUrl';
5
6
  export var MEDIA_CDN_MAP = {
6
7
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
@@ -12,7 +13,7 @@ export var MEDIA_CDN_MAP = {
12
13
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
13
14
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
14
15
  export function isCDNEnabled() {
15
- return isCommercial() && !isIsolatedCloud() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
16
+ return isCommercial() && !isIsolatedCloud() && !isGCPtenant() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
16
17
  }
17
18
  export function mapToMediaCdnUrl(url, token) {
18
19
  var _token$length;
@@ -22,7 +23,7 @@ export function mapToMediaCdnUrl(url, token) {
22
23
  }
23
24
 
24
25
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
25
- if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
26
+ if (!isGCPtenant() && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
26
27
  try {
27
28
  var parsedUrl = new URL(url);
28
29
  var cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "36.2.0",
3
+ "version": "36.2.2",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@atlaskit/atlassian-context": "^0.8.0",
32
+ "@atlaskit/atlassian-context": "^0.9.0",
33
33
  "@atlaskit/chunkinator": "^7.1.0",
34
34
  "@atlaskit/media-common": "^13.3.0",
35
35
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/ssr": "workspace:^",
55
55
  "@atlaskit/tokens": "^13.0.0",
56
56
  "@atlassian/a11y-jest-testing": "^0.11.0",
57
- "@atlassian/feature-flags-test-utils": "^1.0.0",
57
+ "@atlassian/feature-flags-test-utils": "^1.1.0",
58
58
  "@emotion/react": "^11.7.1",
59
59
  "@types/deep-equal": "^1.0.1",
60
60
  "fetch-mock": "^8.0.0",