@atlaskit/media-client 28.0.1 → 28.0.3

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
+ ## 28.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150155](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150155)
8
+ [`d06247128ff41`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d06247128ff41) -
9
+ Reverse the check of FedRAMP env to check against Commercial instead in media-client
10
+
11
+ ## 28.0.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#149473](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149473)
16
+ [`4c74b6716ded9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c74b6716ded9) -
17
+ Remove global jest override to fix runtime type error in jest tests
18
+
3
19
  ## 28.0.1
4
20
 
5
21
  ### Patch Changes
@@ -19,7 +19,7 @@ var _helpers = require("../../utils/request/helpers");
19
19
  var _mediaCdn = require("../../utils/mediaCdn");
20
20
  var _resolveAuth = require("./resolveAuth");
21
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
- var _isFedRamp = require("../../utils/isFedRamp");
22
+ var _isCommercial = require("../../utils/isCommercial");
23
23
  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; }
24
24
  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; }
25
25
  var MEDIA_API_REGION = 'media-api-region';
@@ -40,6 +40,15 @@ var jsonHeaders = {
40
40
  Accept: 'application/json',
41
41
  'Content-Type': 'application/json'
42
42
  };
43
+ var cdnFeatureFlag = function cdnFeatureFlag(endpoint) {
44
+ var result = endpoint;
45
+ if ((0, _platformFeatureFlags.fg)('platform.media-cdn-delivery')) {
46
+ if ((0, _isCommercial.isCommercial)()) {
47
+ result += '/cdn';
48
+ }
49
+ }
50
+ return result;
51
+ };
43
52
  var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
44
53
  function MediaStore(config) {
45
54
  var _this = this;
@@ -293,7 +302,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
293
302
  params: extendImageParams(params),
294
303
  auth: auth
295
304
  };
296
- var imageEndpoint = !(0, _isFedRamp.isFedRamp)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
305
+ var imageEndpoint = cdnFeatureFlag('image');
297
306
  return (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options), auth.token);
298
307
  }
299
308
  }, {
@@ -311,7 +320,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
311
320
  case 0:
312
321
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : _constants.FILE_CACHE_MAX_AGE;
313
322
  headers = {};
314
- binaryEndpoint = !(0, _isFedRamp.isFedRamp)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
323
+ binaryEndpoint = cdnFeatureFlag('binary');
315
324
  metadata = {
316
325
  method: 'GET',
317
326
  endpoint: "/file/{fileId}/".concat(binaryEndpoint)
@@ -365,7 +374,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
365
374
  },
366
375
  auth: auth
367
376
  };
368
- binaryEndpoint = !(0, _isFedRamp.isFedRamp)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
377
+ binaryEndpoint = cdnFeatureFlag('binary');
369
378
  return _context6.abrupt("return", (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
370
379
  case 7:
371
380
  case "end":
@@ -432,7 +441,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
432
441
  if (isWebpSupported) {
433
442
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
434
443
  }
435
- imageEndpoint = !(0, _isFedRamp.isFedRamp)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
444
+ imageEndpoint = cdnFeatureFlag('image');
436
445
  metadata = {
437
446
  method: 'GET',
438
447
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getArtifactUrl = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
- var _isFedRamp = require("../utils/isFedRamp");
8
+ var _isCommercial = require("../utils/isCommercial");
9
9
  var getArtifactUrl = exports.getArtifactUrl = function getArtifactUrl(artifacts, prop) {
10
10
  var _artifacts$prop2;
11
- if (!(0, _isFedRamp.isFedRamp)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery')) {
11
+ if ((0, _isCommercial.isCommercial)() && (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery')) {
12
12
  var _artifacts$prop;
13
13
  return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
14
14
  }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isCommercial = isCommercial;
7
+ function isCommercial() {
8
+ var _global$location;
9
+ var global = globalThis;
10
+ var perimeter = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
11
+ if (perimeter) {
12
+ // Note: reference to MICROS_PERIMETER can be found in: https://hello.atlassian.net/wiki/spaces/MICROS/pages/167212650/Runtime+configuration+environment+variables+and+adding+secrets#Micros-provided-variables
13
+ return perimeter === 'commercial';
14
+ }
15
+
16
+ // Return true if the current hostname does NOT match any of the forbidden patterns.
17
+ return !((_global$location = global.location) !== null && _global$location !== void 0 && (_global$location = _global$location.hostname) !== null && _global$location !== void 0 && _global$location.match(/(atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net))/));
18
+ }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.MEDIA_CDN_MAP = void 0;
7
7
  exports.mapToMediaCdnUrl = mapToMediaCdnUrl;
8
8
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
- var _isFedRamp = require("./isFedRamp");
9
+ var _isCommercial = require("./isCommercial");
10
10
  var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
11
11
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
12
12
  'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
@@ -19,7 +19,7 @@ var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
19
19
  function mapToMediaCdnUrl(url, token) {
20
20
  var _token$length;
21
21
  var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
22
- if ((0, _isFedRamp.isFedRamp)() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
22
+ if (!(0, _isCommercial.isCommercial)() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
23
23
  return url;
24
24
  }
25
25
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -9,7 +9,7 @@ import { mapToMediaCdnUrl } from '../../utils/mediaCdn';
9
9
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
10
10
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
- import { isFedRamp } from '../../utils/isFedRamp';
12
+ import { isCommercial } from '../../utils/isCommercial';
13
13
  const MEDIA_API_REGION = 'media-api-region';
14
14
  const MEDIA_API_ENVIRONMENT = 'media-api-environment';
15
15
  const extendImageParams = (params, fetchMaxRes = false) => {
@@ -29,6 +29,15 @@ const jsonHeaders = {
29
29
  Accept: 'application/json',
30
30
  'Content-Type': 'application/json'
31
31
  };
32
+ const cdnFeatureFlag = endpoint => {
33
+ let result = endpoint;
34
+ if (fg('platform.media-cdn-delivery')) {
35
+ if (isCommercial()) {
36
+ result += '/cdn';
37
+ }
38
+ }
39
+ return result;
40
+ };
32
41
  export class MediaStore {
33
42
  constructor(config) {
34
43
  _defineProperty(this, "resolveAuth", authContext => resolveAuth(this.config.authProvider, authContext));
@@ -188,12 +197,12 @@ export class MediaStore {
188
197
  params: extendImageParams(params),
189
198
  auth
190
199
  };
191
- const imageEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
200
+ const imageEndpoint = cdnFeatureFlag('image');
192
201
  return mapToMediaCdnUrl(createUrl(`${auth.baseUrl}/file/${id}/${imageEndpoint}`, options), auth.token);
193
202
  }
194
203
  async getFileBinary(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
195
204
  const headers = {};
196
- const binaryEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
205
+ const binaryEndpoint = cdnFeatureFlag('binary');
197
206
  const metadata = {
198
207
  method: 'GET',
199
208
  endpoint: `/file/{fileId}/${binaryEndpoint}`
@@ -223,7 +232,7 @@ export class MediaStore {
223
232
  },
224
233
  auth
225
234
  };
226
- const binaryEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
235
+ const binaryEndpoint = cdnFeatureFlag('binary');
227
236
  return mapToMediaCdnUrl(createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options), auth.token);
228
237
  }
229
238
  async getArtifactURL(artifacts, artifactName, collectionName) {
@@ -250,7 +259,7 @@ export class MediaStore {
250
259
  if (isWebpSupported) {
251
260
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
252
261
  }
253
- const imageEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
262
+ const imageEndpoint = cdnFeatureFlag('image');
254
263
  const metadata = {
255
264
  method: 'GET',
256
265
  endpoint: `/file/{fileId}/${imageEndpoint}`
@@ -1,8 +1,8 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isFedRamp } from '../utils/isFedRamp';
2
+ import { isCommercial } from '../utils/isCommercial';
3
3
  export const getArtifactUrl = (artifacts, prop) => {
4
4
  var _artifacts$prop2;
5
- if (!isFedRamp() && fg('platform.media-cdn-delivery')) {
5
+ if (isCommercial() && fg('platform.media-cdn-delivery')) {
6
6
  var _artifacts$prop;
7
7
  return `${(_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url}/cdn`;
8
8
  }
@@ -0,0 +1,12 @@
1
+ export function isCommercial() {
2
+ var _global$location, _global$location$host;
3
+ const global = globalThis;
4
+ const perimeter = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
5
+ if (perimeter) {
6
+ // Note: reference to MICROS_PERIMETER can be found in: https://hello.atlassian.net/wiki/spaces/MICROS/pages/167212650/Runtime+configuration+environment+variables+and+adding+secrets#Micros-provided-variables
7
+ return perimeter === 'commercial';
8
+ }
9
+
10
+ // Return true if the current hostname does NOT match any of the forbidden patterns.
11
+ return !((_global$location = global.location) !== null && _global$location !== void 0 && (_global$location$host = _global$location.hostname) !== null && _global$location$host !== void 0 && _global$location$host.match(/(atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net))/));
12
+ }
@@ -1,5 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isFedRamp } from './isFedRamp';
2
+ import { isCommercial } from './isCommercial';
3
3
  export const MEDIA_CDN_MAP = {
4
4
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
5
5
  'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
@@ -12,7 +12,7 @@ const MEDIA_TOKEN_LENGTH_LIMIT = 7000;
12
12
  export function mapToMediaCdnUrl(url, token) {
13
13
  var _token$length;
14
14
  const tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
15
- if (isFedRamp() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
15
+ if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
16
16
  return url;
17
17
  }
18
18
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -15,7 +15,7 @@ import { mapToMediaCdnUrl } from '../../utils/mediaCdn';
15
15
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
16
16
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { isFedRamp } from '../../utils/isFedRamp';
18
+ import { isCommercial } from '../../utils/isCommercial';
19
19
  var MEDIA_API_REGION = 'media-api-region';
20
20
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
21
21
  var extendImageParams = function extendImageParams(params) {
@@ -34,6 +34,15 @@ var jsonHeaders = {
34
34
  Accept: 'application/json',
35
35
  'Content-Type': 'application/json'
36
36
  };
37
+ var cdnFeatureFlag = function cdnFeatureFlag(endpoint) {
38
+ var result = endpoint;
39
+ if (fg('platform.media-cdn-delivery')) {
40
+ if (isCommercial()) {
41
+ result += '/cdn';
42
+ }
43
+ }
44
+ return result;
45
+ };
37
46
  export var MediaStore = /*#__PURE__*/function () {
38
47
  function MediaStore(config) {
39
48
  var _this = this;
@@ -287,7 +296,7 @@ export var MediaStore = /*#__PURE__*/function () {
287
296
  params: extendImageParams(params),
288
297
  auth: auth
289
298
  };
290
- var imageEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
299
+ var imageEndpoint = cdnFeatureFlag('image');
291
300
  return mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options), auth.token);
292
301
  }
293
302
  }, {
@@ -305,7 +314,7 @@ export var MediaStore = /*#__PURE__*/function () {
305
314
  case 0:
306
315
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
307
316
  headers = {};
308
- binaryEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
317
+ binaryEndpoint = cdnFeatureFlag('binary');
309
318
  metadata = {
310
319
  method: 'GET',
311
320
  endpoint: "/file/{fileId}/".concat(binaryEndpoint)
@@ -359,7 +368,7 @@ export var MediaStore = /*#__PURE__*/function () {
359
368
  },
360
369
  auth: auth
361
370
  };
362
- binaryEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
371
+ binaryEndpoint = cdnFeatureFlag('binary');
363
372
  return _context6.abrupt("return", mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
364
373
  case 7:
365
374
  case "end":
@@ -426,7 +435,7 @@ export var MediaStore = /*#__PURE__*/function () {
426
435
  if (isWebpSupported) {
427
436
  headers.accept = 'image/webp,image/*,*/*;q=0.8';
428
437
  }
429
- imageEndpoint = !isFedRamp() && fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
438
+ imageEndpoint = cdnFeatureFlag('image');
430
439
  metadata = {
431
440
  method: 'GET',
432
441
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
@@ -1,8 +1,8 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isFedRamp } from '../utils/isFedRamp';
2
+ import { isCommercial } from '../utils/isCommercial';
3
3
  export var getArtifactUrl = function getArtifactUrl(artifacts, prop) {
4
4
  var _artifacts$prop2;
5
- if (!isFedRamp() && fg('platform.media-cdn-delivery')) {
5
+ if (isCommercial() && fg('platform.media-cdn-delivery')) {
6
6
  var _artifacts$prop;
7
7
  return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
8
8
  }
@@ -0,0 +1,12 @@
1
+ export function isCommercial() {
2
+ var _global$location;
3
+ var global = globalThis;
4
+ var perimeter = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
5
+ if (perimeter) {
6
+ // Note: reference to MICROS_PERIMETER can be found in: https://hello.atlassian.net/wiki/spaces/MICROS/pages/167212650/Runtime+configuration+environment+variables+and+adding+secrets#Micros-provided-variables
7
+ return perimeter === 'commercial';
8
+ }
9
+
10
+ // Return true if the current hostname does NOT match any of the forbidden patterns.
11
+ return !((_global$location = global.location) !== null && _global$location !== void 0 && (_global$location = _global$location.hostname) !== null && _global$location !== void 0 && _global$location.match(/(atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net))/));
12
+ }
@@ -1,5 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { isFedRamp } from './isFedRamp';
2
+ import { isCommercial } from './isCommercial';
3
3
  export var MEDIA_CDN_MAP = {
4
4
  'api.media.atlassian.com': 'media-cdn.atlassian.com',
5
5
  'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
@@ -12,7 +12,7 @@ var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
12
12
  export function mapToMediaCdnUrl(url, token) {
13
13
  var _token$length;
14
14
  var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
15
- if (isFedRamp() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
15
+ if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
16
16
  return url;
17
17
  }
18
18
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -0,0 +1 @@
1
+ export declare function isCommercial(): boolean;
@@ -0,0 +1 @@
1
+ export declare function isCommercial(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "28.0.1",
3
+ "version": "28.0.3",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isFedRamp = isFedRamp;
7
- var FEDRAMP_MODERATE = 'fedramp-moderate';
8
-
9
- // To determine whether an instance is a FedRAMP instance
10
- // Copied from platform/pfeackages/uip/atl-context/src/services/is-fedramp/index.tsx
11
- // We cannot import the same-named function from @atlassian/atl-context due to media-co being a public package (and atl-context being private)
12
- // TODO: Seek alternatives
13
- function isFedRamp() {
14
- var _global$location;
15
- var global = globalThis;
16
- // MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
17
- var env = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
18
- if (env) {
19
- return env === FEDRAMP_MODERATE;
20
- }
21
- var matches = (_global$location = global.location) === null || _global$location === void 0 || (_global$location = _global$location.hostname) === null || _global$location === void 0 ? void 0 : _global$location.match(/atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/);
22
- return matches ? matches.length > 0 : false;
23
- }
@@ -1,17 +0,0 @@
1
- const FEDRAMP_MODERATE = 'fedramp-moderate';
2
-
3
- // To determine whether an instance is a FedRAMP instance
4
- // Copied from platform/pfeackages/uip/atl-context/src/services/is-fedramp/index.tsx
5
- // We cannot import the same-named function from @atlassian/atl-context due to media-co being a public package (and atl-context being private)
6
- // TODO: Seek alternatives
7
- export function isFedRamp() {
8
- var _global$location, _global$location$host;
9
- const global = globalThis;
10
- // MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
11
- const env = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
12
- if (env) {
13
- return env === FEDRAMP_MODERATE;
14
- }
15
- const matches = (_global$location = global.location) === null || _global$location === void 0 ? void 0 : (_global$location$host = _global$location.hostname) === null || _global$location$host === void 0 ? void 0 : _global$location$host.match(/atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/);
16
- return matches ? matches.length > 0 : false;
17
- }
@@ -1,17 +0,0 @@
1
- var FEDRAMP_MODERATE = 'fedramp-moderate';
2
-
3
- // To determine whether an instance is a FedRAMP instance
4
- // Copied from platform/pfeackages/uip/atl-context/src/services/is-fedramp/index.tsx
5
- // We cannot import the same-named function from @atlassian/atl-context due to media-co being a public package (and atl-context being private)
6
- // TODO: Seek alternatives
7
- export function isFedRamp() {
8
- var _global$location;
9
- var global = globalThis;
10
- // MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
11
- var env = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
12
- if (env) {
13
- return env === FEDRAMP_MODERATE;
14
- }
15
- var matches = (_global$location = global.location) === null || _global$location === void 0 || (_global$location = _global$location.hostname) === null || _global$location === void 0 ? void 0 : _global$location.match(/atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/);
16
- return matches ? matches.length > 0 : false;
17
- }
@@ -1 +0,0 @@
1
- export declare function isFedRamp(): boolean;
@@ -1 +0,0 @@
1
- export declare function isFedRamp(): boolean;