@atlaskit/media-client 37.2.13 → 37.2.15

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,22 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 37.2.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`977dc624ae756`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/977dc624ae756) -
8
+ Media CDN GCP detection now uses `isGoogleCloudPlatform()` from
9
+ `@atlaskit/atlassian-context/cloud-provider` (cookie/SSR-based) combined with the staging-only
10
+ hostname fallback `isGCPtenant` from `@atlaskit/media-common/mediaEnvUtils` (imported as
11
+ `isGCPtenantInStaging`). Both checks are combined with `||` because staging tenants do not
12
+ reliably have a proper value for the `Bifrost-Atl-Ctx-Cloud-Service-Provider` cookie.
13
+
14
+ ## 37.2.14
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 37.2.13
4
21
 
5
22
  ### Patch 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 _isIsolatedCloud = require("@atlaskit/atlassian-context/is-isolated-cloud");
12
+ var _cloudProvider = require("@atlaskit/atlassian-context/cloud-provider");
12
13
  var _mediaEnvUtils = require("@atlaskit/media-common/mediaEnvUtils");
13
14
  var _pathBasedUrl = require("./pathBasedUrl");
14
15
  var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
@@ -21,7 +22,7 @@ var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
21
22
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
22
23
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
23
24
  function isCDNEnabled() {
24
- return (0, _isCommercial.isCommercial)() && !(0, _isIsolatedCloud.isIsolatedCloud)() && !(0, _mediaEnvUtils.isGCPtenant)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0, _pathBasedUrl.isPathBasedEnabled)();
25
+ return (0, _isCommercial.isCommercial)() && !(0, _isIsolatedCloud.isIsolatedCloud)() && !((0, _cloudProvider.isGoogleCloudPlatform)() || (0, _mediaEnvUtils.isGCPtenant)()) && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && !(0, _pathBasedUrl.isPathBasedEnabled)();
25
26
  }
26
27
  function mapToMediaCdnUrl(url, token) {
27
28
  var _token$length;
@@ -29,9 +30,9 @@ function mapToMediaCdnUrl(url, token) {
29
30
  if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
30
31
  return url;
31
32
  }
32
-
33
+ var isGcpTenant = (0, _cloudProvider.isGoogleCloudPlatform)() || (0, _mediaEnvUtils.isGCPtenant)();
33
34
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
34
- if (!(0, _mediaEnvUtils.isGCPtenant)() && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
35
+ if (!isGcpTenant && (0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
35
36
  try {
36
37
  var parsedUrl = new URL(url);
37
38
  var cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
@@ -1,7 +1,8 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { isCommercial } from './isCommercial';
3
3
  import { isIsolatedCloud } from '@atlaskit/atlassian-context/is-isolated-cloud';
4
- import { isGCPtenant } from '@atlaskit/media-common/mediaEnvUtils';
4
+ import { isGoogleCloudPlatform } from '@atlaskit/atlassian-context/cloud-provider';
5
+ import { isGCPtenant as isGCPtenantInStaging } from '@atlaskit/media-common/mediaEnvUtils';
5
6
  import { isPathBasedEnabled } from './pathBasedUrl';
6
7
  export const MEDIA_CDN_MAP = {
7
8
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
@@ -13,7 +14,7 @@ export const MEDIA_CDN_MAP = {
13
14
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
14
15
  const MEDIA_TOKEN_LENGTH_LIMIT = 7000;
15
16
  export function isCDNEnabled() {
16
- return isCommercial() && !isIsolatedCloud() && !isGCPtenant() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
17
+ return isCommercial() && !isIsolatedCloud() && !(isGoogleCloudPlatform() || isGCPtenantInStaging()) && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
17
18
  }
18
19
  export function mapToMediaCdnUrl(url, token) {
19
20
  var _token$length;
@@ -21,9 +22,9 @@ export function mapToMediaCdnUrl(url, token) {
21
22
  if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
22
23
  return url;
23
24
  }
24
-
25
+ const isGcpTenant = isGoogleCloudPlatform() || isGCPtenantInStaging();
25
26
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
26
- if (!isGCPtenant() && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
27
+ if (!isGcpTenant && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
27
28
  try {
28
29
  const parsedUrl = new URL(url);
29
30
  const cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
@@ -1,7 +1,8 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { isCommercial } from './isCommercial';
3
3
  import { isIsolatedCloud } from '@atlaskit/atlassian-context/is-isolated-cloud';
4
- import { isGCPtenant } from '@atlaskit/media-common/mediaEnvUtils';
4
+ import { isGoogleCloudPlatform } from '@atlaskit/atlassian-context/cloud-provider';
5
+ import { isGCPtenant as isGCPtenantInStaging } from '@atlaskit/media-common/mediaEnvUtils';
5
6
  import { isPathBasedEnabled } from './pathBasedUrl';
6
7
  export var MEDIA_CDN_MAP = {
7
8
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
@@ -13,7 +14,7 @@ export var MEDIA_CDN_MAP = {
13
14
  // Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
14
15
  var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
15
16
  export function isCDNEnabled() {
16
- return isCommercial() && !isIsolatedCloud() && !isGCPtenant() && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
17
+ return isCommercial() && !isIsolatedCloud() && !(isGoogleCloudPlatform() || isGCPtenantInStaging()) && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
17
18
  }
18
19
  export function mapToMediaCdnUrl(url, token) {
19
20
  var _token$length;
@@ -21,9 +22,9 @@ export function mapToMediaCdnUrl(url, token) {
21
22
  if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
22
23
  return url;
23
24
  }
24
-
25
+ var isGcpTenant = isGoogleCloudPlatform() || isGCPtenantInStaging();
25
26
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
26
- if (!isGCPtenant() && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
27
+ if (!isGcpTenant && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
27
28
  try {
28
29
  var parsedUrl = new URL(url);
29
30
  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": "37.2.13",
3
+ "version": "37.2.15",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,7 +25,7 @@
25
25
  "@atlaskit/chunkinator": "^8.0.0",
26
26
  "@atlaskit/media-common": "^14.3.0",
27
27
  "@atlaskit/platform-feature-flags": "^2.1.0",
28
- "@atlaskit/tmp-editor-statsig": "^132.0.0",
28
+ "@atlaskit/tmp-editor-statsig": "^133.2.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "dataloader": "^2.1.0",
31
31
  "deep-equal": "^1.0.1",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/media-core": "^38.0.0",
46
46
  "@atlaskit/media-state": "^3.1.0",
47
47
  "@atlaskit/ssr": "workspace:^",
48
- "@atlaskit/tokens": "^16.2.0",
48
+ "@atlaskit/tokens": "^16.3.0",
49
49
  "@atlassian/a11y-jest-testing": "^0.13.0",
50
50
  "@atlassian/feature-flags-test-utils": "^1.2.0",
51
51
  "@emotion/react": "^11.7.1",