@atlaskit/editor-card-provider 3.1.17 → 3.3.0

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.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ ## 3.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#74458](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74458) [`c40e977de5da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c40e977de5da) - [ux] List view links will be converted into smart link embed by default
14
+
3
15
  ## 3.1.17
4
16
 
5
17
  ### Patch Changes
@@ -18,7 +18,6 @@ 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");
@@ -39,6 +38,9 @@ var isPolarisView = function isPolarisView(url) {
39
38
  var isJwmView = function isJwmView(url) {
40
39
  return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
41
40
  };
41
+ var isJiraList = function isJiraList(url) {
42
+ return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
43
+ };
42
44
  var isGiphyMedia = function isGiphyMedia(url) {
43
45
  return url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
44
46
  };
@@ -62,8 +64,8 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
62
64
  function EditorCardProvider(envKey, baseUrlOverride) {
63
65
  var _this = this;
64
66
  (0, _classCallCheck2.default)(this, EditorCardProvider);
65
- this.baseUrl = baseUrlOverride || (0, _environments.getBaseUrl)(envKey);
66
- this.resolverUrl = (0, _environments.getResolverUrl)(envKey, baseUrlOverride);
67
+ this.baseUrl = baseUrlOverride || (0, _linkingCommon.getBaseUrl)(envKey);
68
+ this.resolverUrl = (0, _linkingCommon.getResolverUrl)(envKey, baseUrlOverride);
67
69
  this.transformer = new _transformer.Transformer();
68
70
  this.requestHeaders = {
69
71
  Origin: this.baseUrl
@@ -327,7 +329,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
327
329
  }, {
328
330
  key: "getHardCodedAppearance",
329
331
  value: function getHardCodedAppearance(url) {
330
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
332
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
331
333
  return 'embed';
332
334
  }
333
335
  }
@@ -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,6 +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
20
  const isGiphyMedia = url => url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
20
21
  const isProformaView = url => url.match(/^https:\/\/[^/]+\/jira\/(core|software(\/c)?|servicedesk)\/projects\/\w+\/forms\/form\/direct\/\d+\/\d+.*$/);
21
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})(\?\/)?/);
@@ -112,7 +113,7 @@ export class EditorCardProvider {
112
113
  return (_this$providersData2 = this.providersData) === null || _this$providersData2 === void 0 ? void 0 : _this$providersData2.patterns.find(pattern => url.match(pattern.source));
113
114
  }
114
115
  getHardCodedAppearance(url) {
115
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || getBooleanFF('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
116
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || getBooleanFF('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
116
117
  return 'embed';
117
118
  }
118
119
  }
@@ -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';
@@ -31,6 +31,9 @@ var isPolarisView = function isPolarisView(url) {
31
31
  var isJwmView = function isJwmView(url) {
32
32
  return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
33
33
  };
34
+ var isJiraList = function isJiraList(url) {
35
+ return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
36
+ };
34
37
  var isGiphyMedia = function isGiphyMedia(url) {
35
38
  return url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
36
39
  };
@@ -319,7 +322,7 @@ export var EditorCardProvider = /*#__PURE__*/function () {
319
322
  }, {
320
323
  key: "getHardCodedAppearance",
321
324
  value: function getHardCodedAppearance(url) {
322
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || getBooleanFF('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
325
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || getBooleanFF('platform.linking-platform.embed-youtube-by-default') && isYoutubeVideo(url)) {
323
326
  return 'embed';
324
327
  }
325
328
  }
@@ -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.1.17",
3
+ "version": "3.3.0",
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",
@@ -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;