@atlaskit/editor-card-provider 3.2.0 → 3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 3.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#81050](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81050) [`c15d7331e8b8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c15d7331e8b8) - We are updating the Jira List URL pattern as we recently update the urls
8
+
9
+ ## 3.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#75659](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75659) [`28d133564298`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/28d133564298) - Removed duplicated version of environment.ts in editor-card-provider package and all usages were replaced with the corresponding type/function from linking-common.
14
+
3
15
  ## 3.2.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/api.js CHANGED
@@ -18,7 +18,7 @@ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/w
18
18
  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; }
19
19
  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; }
20
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
22
  var ALLOWED_RESPONSE_STATUS_CODES = [200, 401, 404];
23
23
  var NetworkError = exports.NetworkError = /*#__PURE__*/function (_Error) {
24
24
  (0, _inherits2.default)(NetworkError, _Error);
@@ -18,12 +18,11 @@ var _dataloader = _interopRequireDefault(require("dataloader"));
18
18
  var _linkingCommon = require("@atlaskit/linking-common");
19
19
  var _linkExtractors = require("@atlaskit/link-extractors");
20
20
  var _transformer = require("./transformer");
21
- var _environments = require("./environments");
22
21
  var _linkProvider = require("@atlaskit/link-provider");
23
22
  var api = _interopRequireWildcard(require("./api"));
24
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
26
  function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = new RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } // import setimmediate to temporary fix dataloader 2.0.0 bug
28
27
  // @see https://github.com/graphql/dataloader/issues/249
29
28
  var BATCH_WAIT_TIME = 50;
@@ -40,7 +39,7 @@ var isJwmView = function isJwmView(url) {
40
39
  return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
41
40
  };
42
41
  var isJiraList = function isJiraList(url) {
43
- return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
42
+ return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/list\/?/);
44
43
  };
45
44
  var isGiphyMedia = function isGiphyMedia(url) {
46
45
  return url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
@@ -65,8 +64,8 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
65
64
  function EditorCardProvider(envKey, baseUrlOverride) {
66
65
  var _this = this;
67
66
  (0, _classCallCheck2.default)(this, EditorCardProvider);
68
- this.baseUrl = baseUrlOverride || (0, _environments.getBaseUrl)(envKey);
69
- this.resolverUrl = (0, _environments.getResolverUrl)(envKey, baseUrlOverride);
67
+ this.baseUrl = baseUrlOverride || (0, _linkingCommon.getBaseUrl)(envKey);
68
+ this.resolverUrl = (0, _linkingCommon.getResolverUrl)(envKey, baseUrlOverride);
70
69
  this.transformer = new _transformer.Transformer();
71
70
  this.requestHeaders = {
72
71
  Origin: this.baseUrl
@@ -340,7 +339,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
340
339
  */
341
340
  }, {
342
341
  key: "canBeResolvedAsEmbed",
343
- value: function () {
342
+ value: (function () {
344
343
  var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
345
344
  var details, data, preview;
346
345
  return _regenerator.default.wrap(function _callee8$(_context8) {
@@ -384,9 +383,10 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
384
383
  /**
385
384
  * Make a /resolve call and find out if result has datasource capability
386
385
  */
386
+ )
387
387
  }, {
388
388
  key: "getDatasourceFromResolveResponse",
389
- value: function () {
389
+ value: (function () {
390
390
  var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
391
391
  var response, datasources;
392
392
  return _regenerator.default.wrap(function _callee9$(_context9) {
@@ -420,7 +420,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
420
420
  return _getDatasourceFromResolveResponse.apply(this, arguments);
421
421
  }
422
422
  return getDatasourceFromResolveResponse;
423
- }()
423
+ }())
424
424
  }, {
425
425
  key: "resolve",
426
426
  value: function () {
@@ -5,7 +5,7 @@ import DataLoader from 'dataloader';
5
5
  import { getStatus } from '@atlaskit/linking-common';
6
6
  import { extractPreview } from '@atlaskit/link-extractors';
7
7
  import { Transformer } from './transformer';
8
- import { getBaseUrl, getResolverUrl } from './environments';
8
+ import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
9
9
  import { CardClient } from '@atlaskit/link-provider';
10
10
  import * as api from './api';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -16,7 +16,7 @@ const BATCH_WAIT_TIME = 50;
16
16
  const isJiraRoadmapOrTimeline = url => url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(timeline|roadmap)\/?/);
17
17
  const isPolarisView = url => url.match(/^https:\/\/.*?\/jira\/polaris\/projects\/[^\/]+?\/ideas\/view\/\d+$|^https:\/\/.*?\/secure\/JiraProductDiscoveryAnonymous\.jspa\?hash=\w+|^https:\/\/.*?\/jira\/polaris\/share\/\w+|^https:\/\/.*?\/jira\/discovery\/share\/views\/[\w-]+(\?selectedIssue=[\w-]+&issueViewLayout=sidebar&issueViewSection=[\w-]+)?$/);
18
18
  const isJwmView = url => url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
19
- const isJiraList = url => url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
19
+ const isJiraList = url => url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/list\/?/);
20
20
  const isGiphyMedia = url => url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
21
21
  const isProformaView = url => url.match(/^https:\/\/[^/]+\/jira\/(core|software(\/c)?|servicedesk)\/projects\/\w+\/forms\/form\/direct\/\d+\/\d+.*$/);
22
22
  const isConfluenceWhiteboard = url => url.match(/\/wiki\/spaces\/?.*\/whiteboard\/(?<resourceId>\d+)(\?\/)?/) || url.match(/\/wiki\/spaces\/?.*\/whiteboard\/(?<resourceId>[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})(\?\/)?/);
package/dist/esm/api.js CHANGED
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  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; }
11
11
  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) { _defineProperty(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; }
12
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
14
  var ALLOWED_RESPONSE_STATUS_CODES = [200, 401, 404];
15
15
  export var NetworkError = /*#__PURE__*/function (_Error) {
16
16
  _inherits(NetworkError, _Error);
@@ -14,7 +14,7 @@ import DataLoader from 'dataloader';
14
14
  import { getStatus } from '@atlaskit/linking-common';
15
15
  import { extractPreview } from '@atlaskit/link-extractors';
16
16
  import { Transformer } from './transformer';
17
- import { getBaseUrl, getResolverUrl } from './environments';
17
+ import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
18
18
  import { CardClient } from '@atlaskit/link-provider';
19
19
  import * as api from './api';
20
20
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -32,7 +32,7 @@ var isJwmView = function isJwmView(url) {
32
32
  return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
33
33
  };
34
34
  var isJiraList = function isJiraList(url) {
35
- return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
35
+ return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/list\/?/);
36
36
  };
37
37
  var isGiphyMedia = function isGiphyMedia(url) {
38
38
  return url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
@@ -332,7 +332,7 @@ export var EditorCardProvider = /*#__PURE__*/function () {
332
332
  */
333
333
  }, {
334
334
  key: "canBeResolvedAsEmbed",
335
- value: function () {
335
+ value: (function () {
336
336
  var _canBeResolvedAsEmbed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(url) {
337
337
  var details, data, preview;
338
338
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
@@ -376,9 +376,10 @@ export var EditorCardProvider = /*#__PURE__*/function () {
376
376
  /**
377
377
  * Make a /resolve call and find out if result has datasource capability
378
378
  */
379
+ )
379
380
  }, {
380
381
  key: "getDatasourceFromResolveResponse",
381
- value: function () {
382
+ value: (function () {
382
383
  var _getDatasourceFromResolveResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url) {
383
384
  var response, datasources;
384
385
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
@@ -412,7 +413,7 @@ export var EditorCardProvider = /*#__PURE__*/function () {
412
413
  return _getDatasourceFromResolveResponse.apply(this, arguments);
413
414
  }
414
415
  return getDatasourceFromResolveResponse;
415
- }()
416
+ }())
416
417
  }, {
417
418
  key: "resolve",
418
419
  value: function () {
@@ -1,7 +1,7 @@
1
1
  import 'setimmediate';
2
2
  import { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/linking-common';
3
3
  import { CardProvider } from './types';
4
- import { EnvironmentsKeys } from './environments';
4
+ import { EnvironmentsKeys } from '@atlaskit/linking-common';
5
5
  export declare class EditorCardProvider implements CardProvider {
6
6
  private baseUrl;
7
7
  private resolverUrl;
@@ -1,7 +1,7 @@
1
1
  import 'setimmediate';
2
2
  import { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/linking-common';
3
3
  import { CardProvider } from './types';
4
- import { EnvironmentsKeys } from './environments';
4
+ import { EnvironmentsKeys } from '@atlaskit/linking-common';
5
5
  export declare class EditorCardProvider implements CardProvider {
6
6
  private baseUrl;
7
7
  private resolverUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "Contains the EditorCardProvider, for determining smart card behaviour in the editor.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@atlaskit/link-client-extension": "^1.8.0",
38
38
  "@atlaskit/link-extractors": "^1.2.0",
39
- "@atlaskit/linking-common": "^5.3.0",
39
+ "@atlaskit/linking-common": "^5.4.0",
40
40
  "@atlaskit/platform-feature-flags": "^0.2.1",
41
41
  "@babel/runtime": "^7.0.0",
42
42
  "dataloader": "^2.0.0",
@@ -44,7 +44,7 @@
44
44
  "setimmediate": "^1.0.5"
45
45
  },
46
46
  "peerDependencies": {
47
- "@atlaskit/link-provider": "^1.7.0",
47
+ "@atlaskit/link-provider": "^1.8.0",
48
48
  "react": "^16.8.0"
49
49
  },
50
50
  "devDependencies": {
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getResolverUrl = exports.getBaseUrl = exports.default = exports.BaseUrls = void 0;
7
- // NOTE: This is copied from @atlaskit/link-provider.
8
- // This should be moved into @atlaskit/linking-common, to be done in
9
- // https://product-fabric.atlassian.net/browse/EDM-6042
10
- var devBaseUrl = 'https://api-private.dev.atlassian.com';
11
- var stgBaseUrl = 'https://pug.jira-dev.com/gateway/api';
12
- var prodBaseUrl = 'https://api-private.atlassian.com';
13
- var BaseUrls = exports.BaseUrls = {
14
- dev: devBaseUrl,
15
- development: devBaseUrl,
16
- stg: stgBaseUrl,
17
- staging: stgBaseUrl,
18
- prd: prodBaseUrl,
19
- prod: prodBaseUrl,
20
- production: prodBaseUrl
21
- };
22
- var getBaseUrl = exports.getBaseUrl = function getBaseUrl(envKey) {
23
- // If an environment is provided, then use Stargate.
24
- if (envKey) {
25
- return envKey in BaseUrls ? BaseUrls[envKey] : prodBaseUrl;
26
- }
27
-
28
- // Otherwise, use the current origin of the page.
29
- return typeof window.location !== 'undefined' ? window.location.origin : '';
30
- };
31
- var getResolverUrl = exports.getResolverUrl = function getResolverUrl(envKey, baseUrlOverride) {
32
- // If an environment is provided, then use Stargate directly for requests.
33
- if (envKey || baseUrlOverride) {
34
- var baseUrl = baseUrlOverride || getBaseUrl(envKey);
35
- return "".concat(baseUrl, "/object-resolver");
36
- } else {
37
- // Otherwise, we fallback to using the Edge Proxy to access Stargate,
38
- // which fixes some cookie issues with strict Browser policies.
39
- return '/gateway/api/object-resolver';
40
- }
41
- };
42
- var _default = exports.default = BaseUrls;
@@ -1,36 +0,0 @@
1
- // NOTE: This is copied from @atlaskit/link-provider.
2
- // This should be moved into @atlaskit/linking-common, to be done in
3
- // https://product-fabric.atlassian.net/browse/EDM-6042
4
- const devBaseUrl = 'https://api-private.dev.atlassian.com';
5
- const stgBaseUrl = 'https://pug.jira-dev.com/gateway/api';
6
- const prodBaseUrl = 'https://api-private.atlassian.com';
7
- export const BaseUrls = {
8
- dev: devBaseUrl,
9
- development: devBaseUrl,
10
- stg: stgBaseUrl,
11
- staging: stgBaseUrl,
12
- prd: prodBaseUrl,
13
- prod: prodBaseUrl,
14
- production: prodBaseUrl
15
- };
16
- export const getBaseUrl = envKey => {
17
- // If an environment is provided, then use Stargate.
18
- if (envKey) {
19
- return envKey in BaseUrls ? BaseUrls[envKey] : prodBaseUrl;
20
- }
21
-
22
- // Otherwise, use the current origin of the page.
23
- return typeof window.location !== 'undefined' ? window.location.origin : '';
24
- };
25
- export const getResolverUrl = (envKey, baseUrlOverride) => {
26
- // If an environment is provided, then use Stargate directly for requests.
27
- if (envKey || baseUrlOverride) {
28
- const baseUrl = baseUrlOverride || getBaseUrl(envKey);
29
- return `${baseUrl}/object-resolver`;
30
- } else {
31
- // Otherwise, we fallback to using the Edge Proxy to access Stargate,
32
- // which fixes some cookie issues with strict Browser policies.
33
- return '/gateway/api/object-resolver';
34
- }
35
- };
36
- export default BaseUrls;
@@ -1,36 +0,0 @@
1
- // NOTE: This is copied from @atlaskit/link-provider.
2
- // This should be moved into @atlaskit/linking-common, to be done in
3
- // https://product-fabric.atlassian.net/browse/EDM-6042
4
- var devBaseUrl = 'https://api-private.dev.atlassian.com';
5
- var stgBaseUrl = 'https://pug.jira-dev.com/gateway/api';
6
- var prodBaseUrl = 'https://api-private.atlassian.com';
7
- export var BaseUrls = {
8
- dev: devBaseUrl,
9
- development: devBaseUrl,
10
- stg: stgBaseUrl,
11
- staging: stgBaseUrl,
12
- prd: prodBaseUrl,
13
- prod: prodBaseUrl,
14
- production: prodBaseUrl
15
- };
16
- export var getBaseUrl = function getBaseUrl(envKey) {
17
- // If an environment is provided, then use Stargate.
18
- if (envKey) {
19
- return envKey in BaseUrls ? BaseUrls[envKey] : prodBaseUrl;
20
- }
21
-
22
- // Otherwise, use the current origin of the page.
23
- return typeof window.location !== 'undefined' ? window.location.origin : '';
24
- };
25
- export var getResolverUrl = function getResolverUrl(envKey, baseUrlOverride) {
26
- // If an environment is provided, then use Stargate directly for requests.
27
- if (envKey || baseUrlOverride) {
28
- var baseUrl = baseUrlOverride || getBaseUrl(envKey);
29
- return "".concat(baseUrl, "/object-resolver");
30
- } else {
31
- // Otherwise, we fallback to using the Edge Proxy to access Stargate,
32
- // which fixes some cookie issues with strict Browser policies.
33
- return '/gateway/api/object-resolver';
34
- }
35
- };
36
- export default BaseUrls;
@@ -1,13 +0,0 @@
1
- export type EnvironmentsKeys = keyof typeof BaseUrls;
2
- export declare const BaseUrls: {
3
- dev: string;
4
- development: string;
5
- stg: string;
6
- staging: string;
7
- prd: string;
8
- prod: string;
9
- production: string;
10
- };
11
- export declare const getBaseUrl: (envKey?: keyof typeof BaseUrls) => string;
12
- export declare const getResolverUrl: (envKey?: EnvironmentsKeys, baseUrlOverride?: string) => string;
13
- export default BaseUrls;
@@ -1,13 +0,0 @@
1
- export type EnvironmentsKeys = keyof typeof BaseUrls;
2
- export declare const BaseUrls: {
3
- dev: string;
4
- development: string;
5
- stg: string;
6
- staging: string;
7
- prd: string;
8
- prod: string;
9
- production: string;
10
- };
11
- export declare const getBaseUrl: (envKey?: keyof typeof BaseUrls) => string;
12
- export declare const getResolverUrl: (envKey?: EnvironmentsKeys, baseUrlOverride?: string) => string;
13
- export default BaseUrls;