@atlaskit/editor-card-provider 3.10.7 → 3.11.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,19 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 3.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#166667](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166667)
8
+ [`821e294042f28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/821e294042f28) -
9
+ [ux] Update editor card provider to return embed card for Jira version links
10
+
11
+ ## 3.10.8
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 3.10.7
4
18
 
5
19
  ### Patch Changes
@@ -13,13 +13,13 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
13
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
15
  var _setPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/setPrototypeOf"));
16
- var _dataloader = _interopRequireDefault(require("dataloader"));
17
- var _linkingCommon = require("@atlaskit/linking-common");
18
16
  var _linkExtractors = require("@atlaskit/link-extractors");
17
+ var _linkingCommon = require("@atlaskit/linking-common");
18
+ var _dataloader = _interopRequireDefault(require("dataloader"));
19
19
  var _transformer = require("./transformer");
20
20
  var _linkProvider = require("@atlaskit/link-provider");
21
- var api = _interopRequireWildcard(require("./api"));
22
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
+ var api = _interopRequireWildcard(require("./api"));
23
23
  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); }
24
24
  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 && {}.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; }
25
25
  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 = 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); }
@@ -78,6 +78,9 @@ var isJiraPlan = function isJiraPlan(url) {
78
78
  resourceContext: 2
79
79
  }));
80
80
  };
81
+ var isJiraVersion = function isJiraVersion(url) {
82
+ return url.match(/https:\/\/.*?\/projects\/[^\/]+?\/versions\/\d+\/tab\/release-report-all-issues/);
83
+ };
81
84
  var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
82
85
  function EditorCardProvider(envKey, baseUrlOverride, product) {
83
86
  var _this = this;
@@ -361,10 +364,14 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
361
364
  value: function getHardCodedAppearance(url) {
362
365
  // Replace directly with isJiraPlan(url) on cleanup
363
366
  var isJiraPlanEvaluated;
364
- if ((0, _platformFeatureFlags.fg)('smart_links_for_plans')) {
367
+ if ((0, _platformFeatureFlags.fg)('smart_links_for_plans_platform')) {
365
368
  isJiraPlanEvaluated = isJiraPlan(url);
366
369
  }
367
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated) {
370
+ var isJiraVersionEvaluated;
371
+ if ((0, _platformFeatureFlags.fg)('smartlink_jira_releases')) {
372
+ isJiraVersionEvaluated = isJiraVersion(url);
373
+ }
374
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated || isJiraVersionEvaluated) {
368
375
  return 'embed';
369
376
  }
370
377
  }
@@ -1,11 +1,11 @@
1
- import DataLoader from 'dataloader';
2
- import { getStatus } from '@atlaskit/linking-common';
3
1
  import { extractPreview } from '@atlaskit/link-extractors';
2
+ import { getStatus } from '@atlaskit/linking-common';
3
+ import DataLoader from 'dataloader';
4
4
  import { Transformer } from './transformer';
5
- import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
6
5
  import { CardClient } from '@atlaskit/link-provider';
7
- import * as api from './api';
6
+ import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
8
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import * as api from './api';
9
9
  const BATCH_WAIT_TIME = 50;
10
10
 
11
11
  // Check if it is matching a Jira Roadmaps or Jira Timeline url
@@ -34,6 +34,9 @@ const isJiraBoard = url => {
34
34
  const isJiraPlan = url => {
35
35
  return url.match(/https:\/\/.*?\/jira\/plans\/(?<resourceId>\d+)\/scenarios\/(?<resourceContext>\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/);
36
36
  };
37
+ const isJiraVersion = url => {
38
+ return url.match(/https:\/\/.*?\/projects\/[^\/]+?\/versions\/\d+\/tab\/release-report-all-issues/);
39
+ };
37
40
  export class EditorCardProvider {
38
41
  constructor(envKey, baseUrlOverride, product) {
39
42
  this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
@@ -140,10 +143,14 @@ export class EditorCardProvider {
140
143
  getHardCodedAppearance(url) {
141
144
  // Replace directly with isJiraPlan(url) on cleanup
142
145
  let isJiraPlanEvaluated;
143
- if (fg('smart_links_for_plans')) {
146
+ if (fg('smart_links_for_plans_platform')) {
144
147
  isJiraPlanEvaluated = isJiraPlan(url);
145
148
  }
146
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated) {
149
+ let isJiraVersionEvaluated;
150
+ if (fg('smartlink_jira_releases')) {
151
+ isJiraVersionEvaluated = isJiraVersion(url);
152
+ }
153
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated || isJiraVersionEvaluated) {
147
154
  return 'embed';
148
155
  }
149
156
  }
@@ -7,14 +7,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf";
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  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 = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(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 _inherits(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); }
10
- import DataLoader from 'dataloader';
11
- import { getStatus } from '@atlaskit/linking-common';
12
10
  import { extractPreview } from '@atlaskit/link-extractors';
11
+ import { getStatus } from '@atlaskit/linking-common';
12
+ import DataLoader from 'dataloader';
13
13
  import { Transformer } from './transformer';
14
- import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
15
14
  import { CardClient } from '@atlaskit/link-provider';
16
- import * as api from './api';
15
+ import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
17
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
+ import * as api from './api';
18
18
  var BATCH_WAIT_TIME = 50;
19
19
 
20
20
  // Check if it is matching a Jira Roadmaps or Jira Timeline url
@@ -70,6 +70,9 @@ var isJiraPlan = function isJiraPlan(url) {
70
70
  resourceContext: 2
71
71
  }));
72
72
  };
73
+ var isJiraVersion = function isJiraVersion(url) {
74
+ return url.match(/https:\/\/.*?\/projects\/[^\/]+?\/versions\/\d+\/tab\/release-report-all-issues/);
75
+ };
73
76
  export var EditorCardProvider = /*#__PURE__*/function () {
74
77
  function EditorCardProvider(envKey, baseUrlOverride, product) {
75
78
  var _this = this;
@@ -353,10 +356,14 @@ export var EditorCardProvider = /*#__PURE__*/function () {
353
356
  value: function getHardCodedAppearance(url) {
354
357
  // Replace directly with isJiraPlan(url) on cleanup
355
358
  var isJiraPlanEvaluated;
356
- if (fg('smart_links_for_plans')) {
359
+ if (fg('smart_links_for_plans_platform')) {
357
360
  isJiraPlanEvaluated = isJiraPlan(url);
358
361
  }
359
- if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated) {
362
+ var isJiraVersionEvaluated;
363
+ if (fg('smartlink_jira_releases')) {
364
+ isJiraVersionEvaluated = isJiraVersion(url);
365
+ }
366
+ if (isJiraRoadmapOrTimeline(url) || isPolarisView(url) || isJwmView(url) || isJiraList(url) || isGiphyMedia(url) || isProformaView(url) || isConfluenceWhiteboard(url) || isConfluenceDatabase(url) || isYoutubeVideo(url) || isLoomUrl(url) || isJiraDashboard(url) || isJiraBacklog(url) || isJiraBoard(url) || isJiraPlanEvaluated || isJiraVersionEvaluated) {
360
367
  return 'embed';
361
368
  }
362
369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "3.10.7",
3
+ "version": "3.11.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",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/eslint-plugin-platform": "0.11.0",
36
+ "@atlaskit/eslint-plugin-platform": "0.12.0",
37
37
  "@atlaskit/link-client-extension": "^2.4.0",
38
38
  "@atlaskit/link-extractors": "^1.9.0",
39
39
  "@atlaskit/linking-common": "^6.0.0",
@@ -50,7 +50,10 @@
50
50
  "typescript": "~5.4.2"
51
51
  },
52
52
  "platform-feature-flags": {
53
- "smart_links_for_plans": {
53
+ "smart_links_for_plans_platform": {
54
+ "type": "boolean"
55
+ },
56
+ "smartlink_jira_releases": {
54
57
  "type": "boolean"
55
58
  }
56
59
  }