@atlaskit/editor-card-provider 3.10.5 → 3.10.7

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.10.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.10.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#156951](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156951)
14
+ [`0f38b2895a03e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0f38b2895a03e) -
15
+ Added default embed smart link type for plans URLs
16
+
3
17
  ## 3.10.5
4
18
 
5
19
  ### Patch Changes
@@ -19,6 +19,7 @@ var _linkExtractors = require("@atlaskit/link-extractors");
19
19
  var _transformer = require("./transformer");
20
20
  var _linkProvider = require("@atlaskit/link-provider");
21
21
  var api = _interopRequireWildcard(require("./api"));
22
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
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); }
23
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; }
24
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); }
@@ -71,6 +72,12 @@ var isJiraBacklog = function isJiraBacklog(url) {
71
72
  var isJiraBoard = function isJiraBoard(url) {
72
73
  return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
73
74
  };
75
+ var isJiraPlan = function isJiraPlan(url) {
76
+ return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)\/scenarios\/(\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/, {
77
+ resourceId: 1,
78
+ resourceContext: 2
79
+ }));
80
+ };
74
81
  var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
75
82
  function EditorCardProvider(envKey, baseUrlOverride, product) {
76
83
  var _this = this;
@@ -352,7 +359,12 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
352
359
  }, {
353
360
  key: "getHardCodedAppearance",
354
361
  value: function getHardCodedAppearance(url) {
355
- 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)) {
362
+ // Replace directly with isJiraPlan(url) on cleanup
363
+ var isJiraPlanEvaluated;
364
+ if ((0, _platformFeatureFlags.fg)('smart_links_for_plans')) {
365
+ isJiraPlanEvaluated = isJiraPlan(url);
366
+ }
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) {
356
368
  return 'embed';
357
369
  }
358
370
  }
@@ -5,6 +5,7 @@ import { Transformer } from './transformer';
5
5
  import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
6
6
  import { CardClient } from '@atlaskit/link-provider';
7
7
  import * as api from './api';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  const BATCH_WAIT_TIME = 50;
9
10
 
10
11
  // Check if it is matching a Jira Roadmaps or Jira Timeline url
@@ -30,6 +31,9 @@ const isJiraBacklog = url => {
30
31
  const isJiraBoard = url => {
31
32
  return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
32
33
  };
34
+ const isJiraPlan = url => {
35
+ return url.match(/https:\/\/.*?\/jira\/plans\/(?<resourceId>\d+)\/scenarios\/(?<resourceContext>\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/);
36
+ };
33
37
  export class EditorCardProvider {
34
38
  constructor(envKey, baseUrlOverride, product) {
35
39
  this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
@@ -134,7 +138,12 @@ export class EditorCardProvider {
134
138
  * @returns 'embed' for the card appearance to embed by default
135
139
  */
136
140
  getHardCodedAppearance(url) {
137
- 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)) {
141
+ // Replace directly with isJiraPlan(url) on cleanup
142
+ let isJiraPlanEvaluated;
143
+ if (fg('smart_links_for_plans')) {
144
+ isJiraPlanEvaluated = isJiraPlan(url);
145
+ }
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) {
138
147
  return 'embed';
139
148
  }
140
149
  }
@@ -14,6 +14,7 @@ import { Transformer } from './transformer';
14
14
  import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
15
15
  import { CardClient } from '@atlaskit/link-provider';
16
16
  import * as api from './api';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  var BATCH_WAIT_TIME = 50;
18
19
 
19
20
  // Check if it is matching a Jira Roadmaps or Jira Timeline url
@@ -63,6 +64,12 @@ var isJiraBacklog = function isJiraBacklog(url) {
63
64
  var isJiraBoard = function isJiraBoard(url) {
64
65
  return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
65
66
  };
67
+ var isJiraPlan = function isJiraPlan(url) {
68
+ return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)\/scenarios\/(\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/, {
69
+ resourceId: 1,
70
+ resourceContext: 2
71
+ }));
72
+ };
66
73
  export var EditorCardProvider = /*#__PURE__*/function () {
67
74
  function EditorCardProvider(envKey, baseUrlOverride, product) {
68
75
  var _this = this;
@@ -344,7 +351,12 @@ export var EditorCardProvider = /*#__PURE__*/function () {
344
351
  }, {
345
352
  key: "getHardCodedAppearance",
346
353
  value: function getHardCodedAppearance(url) {
347
- 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)) {
354
+ // Replace directly with isJiraPlan(url) on cleanup
355
+ var isJiraPlanEvaluated;
356
+ if (fg('smart_links_for_plans')) {
357
+ isJiraPlanEvaluated = isJiraPlan(url);
358
+ }
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) {
348
360
  return 'embed';
349
361
  }
350
362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "3.10.5",
3
+ "version": "3.10.7",
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,10 +33,11 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/eslint-plugin-platform": "0.10.1",
36
+ "@atlaskit/eslint-plugin-platform": "0.11.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",
40
+ "@atlaskit/platform-feature-flags": "^0.3.0",
40
41
  "@babel/runtime": "^7.0.0",
41
42
  "dataloader": "^2.1.0",
42
43
  "json-ld-types": "^4.1.0"
@@ -47,5 +48,10 @@
47
48
  },
48
49
  "devDependencies": {
49
50
  "typescript": "~5.4.2"
51
+ },
52
+ "platform-feature-flags": {
53
+ "smart_links_for_plans": {
54
+ "type": "boolean"
55
+ }
50
56
  }
51
57
  }