@atlaskit/editor-card-provider 3.1.16 → 3.2.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,18 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
9
+ ## 3.1.17
10
+
11
+ ### Patch Changes
12
+
13
+ - [#72315](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72315) [`818ff8704f34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/818ff8704f34) - Updated default smart card view for Confluence Databases to include default for savedViewId
14
+ - [#71047](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71047) [`931a7edba41e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/931a7edba41e) - update window.location usage to be compatible with SSR
15
+
3
16
  ## 3.1.16
4
17
 
5
18
  ### Patch Changes
@@ -26,7 +26,7 @@ var getBaseUrl = exports.getBaseUrl = function getBaseUrl(envKey) {
26
26
  }
27
27
 
28
28
  // Otherwise, use the current origin of the page.
29
- return window.location.origin;
29
+ return typeof window.location !== 'undefined' ? window.location.origin : '';
30
30
  };
31
31
  var getResolverUrl = exports.getResolverUrl = function getResolverUrl(envKey, baseUrlOverride) {
32
32
  // If an environment is provided, then use Stargate directly for requests.
@@ -39,6 +39,9 @@ var isPolarisView = function isPolarisView(url) {
39
39
  var isJwmView = function isJwmView(url) {
40
40
  return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar|list|board|summary|(form\/[^\/]+?))\/?/);
41
41
  };
42
+ var isJiraList = function isJiraList(url) {
43
+ return url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(list)\/?/);
44
+ };
42
45
  var isGiphyMedia = function isGiphyMedia(url) {
43
46
  return url.match(/^https:\/\/(.*?\.)?giphy\.com\/(gifs|media|clips)\//);
44
47
  };
@@ -53,7 +56,7 @@ var isConfluenceWhiteboard = function isConfluenceWhiteboard(url) {
53
56
  }));
54
57
  };
55
58
  var isConfluenceDatabase = function isConfluenceDatabase(url) {
56
- return url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
59
+ return url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries|default)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
57
60
  };
58
61
  var isYoutubeVideo = function isYoutubeVideo(url) {
59
62
  return url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
@@ -327,7 +330,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
327
330
  }, {
328
331
  key: "getHardCodedAppearance",
329
332
  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)) {
333
+ 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
334
  return 'embed';
332
335
  }
333
336
  }
@@ -20,7 +20,7 @@ export const getBaseUrl = envKey => {
20
20
  }
21
21
 
22
22
  // Otherwise, use the current origin of the page.
23
- return window.location.origin;
23
+ return typeof window.location !== 'undefined' ? window.location.origin : '';
24
24
  };
25
25
  export const getResolverUrl = (envKey, baseUrlOverride) => {
26
26
  // If an environment is provided, then use Stargate directly for requests.
@@ -16,10 +16,11 @@ 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})(\?\/)?/);
22
- const isConfluenceDatabase = url => url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
23
+ const isConfluenceDatabase = url => url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries|default)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
23
24
  const isYoutubeVideo = url => url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
24
25
  export class EditorCardProvider {
25
26
  constructor(envKey, baseUrlOverride) {
@@ -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
  }
@@ -20,7 +20,7 @@ export var getBaseUrl = function getBaseUrl(envKey) {
20
20
  }
21
21
 
22
22
  // Otherwise, use the current origin of the page.
23
- return window.location.origin;
23
+ return typeof window.location !== 'undefined' ? window.location.origin : '';
24
24
  };
25
25
  export var getResolverUrl = function getResolverUrl(envKey, baseUrlOverride) {
26
26
  // If an environment is provided, then use Stargate directly for requests.
@@ -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
  };
@@ -45,7 +48,7 @@ var isConfluenceWhiteboard = function isConfluenceWhiteboard(url) {
45
48
  }));
46
49
  };
47
50
  var isConfluenceDatabase = function isConfluenceDatabase(url) {
48
- return url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
51
+ return url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries|default)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
49
52
  };
50
53
  var isYoutubeVideo = function isYoutubeVideo(url) {
51
54
  return url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "3.1.16",
3
+ "version": "3.2.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",
@@ -44,12 +44,12 @@
44
44
  "setimmediate": "^1.0.5"
45
45
  },
46
46
  "peerDependencies": {
47
- "@atlaskit/link-provider": "^1.6.3",
47
+ "@atlaskit/link-provider": "^1.7.0",
48
48
  "react": "^16.8.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
52
- "@atlassian/feature-flags-test-utils": "^0.1.1",
52
+ "@atlassian/feature-flags-test-utils": "^0.2.0",
53
53
  "typescript": "~4.9.5"
54
54
  },
55
55
  "platform-feature-flags": {