@atlaskit/editor-card-provider 4.2.2 → 4.2.4
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 +17 -0
- package/dist/cjs/provider.js +25 -10
- package/dist/es2019/provider.js +11 -2
- package/dist/esm/provider.js +26 -11
- package/package.json +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-card-provider
|
|
2
2
|
|
|
3
|
+
## 4.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#141229](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141229)
|
|
8
|
+
[`9740656964ab1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9740656964ab1) -
|
|
9
|
+
Implement nounData embed preview extractors behind ff: smart_links_noun_support
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.2.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#135566](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/135566)
|
|
17
|
+
[`610d0b7771536`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/610d0b7771536) -
|
|
18
|
+
Added support for base plan URL smart link
|
|
19
|
+
|
|
3
20
|
## 4.2.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/provider.js
CHANGED
|
@@ -75,7 +75,9 @@ var isJiraBoard = function isJiraBoard(url) {
|
|
|
75
75
|
return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
|
|
76
76
|
};
|
|
77
77
|
var isJiraPlan = function isJiraPlan(url) {
|
|
78
|
-
return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)
|
|
78
|
+
return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)/, {
|
|
79
|
+
resourceId: 1
|
|
80
|
+
})) && (0, _platformFeatureFlags.fg)('plan_smart_link_base_url') || url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)\/scenarios\/(\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/, {
|
|
79
81
|
resourceId: 1,
|
|
80
82
|
resourceContext: 2
|
|
81
83
|
}));
|
|
@@ -418,7 +420,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
|
418
420
|
*/
|
|
419
421
|
function () {
|
|
420
422
|
var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
|
|
421
|
-
var details, data, preview;
|
|
423
|
+
var details, embed, data, preview;
|
|
422
424
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
423
425
|
while (1) switch (_context8.prev = _context8.next) {
|
|
424
426
|
case 0:
|
|
@@ -427,30 +429,43 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
|
427
429
|
return this.cardClient.fetchData(url);
|
|
428
430
|
case 3:
|
|
429
431
|
details = _context8.sent;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
+
if (!(0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
|
|
433
|
+
_context8.next = 9;
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
if (details) {
|
|
432
437
|
_context8.next = 7;
|
|
433
438
|
break;
|
|
434
439
|
}
|
|
435
440
|
return _context8.abrupt("return", false);
|
|
436
441
|
case 7:
|
|
442
|
+
embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
|
|
443
|
+
return _context8.abrupt("return", !!embed);
|
|
444
|
+
case 9:
|
|
445
|
+
data = details && details.data;
|
|
446
|
+
if (data) {
|
|
447
|
+
_context8.next = 12;
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
return _context8.abrupt("return", false);
|
|
451
|
+
case 12:
|
|
437
452
|
if (!((0, _linkingCommon.getStatus)(details) !== 'resolved')) {
|
|
438
|
-
_context8.next =
|
|
453
|
+
_context8.next = 14;
|
|
439
454
|
break;
|
|
440
455
|
}
|
|
441
456
|
return _context8.abrupt("return", false);
|
|
442
|
-
case
|
|
457
|
+
case 14:
|
|
443
458
|
preview = (0, _linkExtractors.extractPreview)(data, 'web');
|
|
444
459
|
return _context8.abrupt("return", !!preview);
|
|
445
|
-
case
|
|
446
|
-
_context8.prev =
|
|
460
|
+
case 18:
|
|
461
|
+
_context8.prev = 18;
|
|
447
462
|
_context8.t0 = _context8["catch"](0);
|
|
448
463
|
return _context8.abrupt("return", false);
|
|
449
|
-
case
|
|
464
|
+
case 21:
|
|
450
465
|
case "end":
|
|
451
466
|
return _context8.stop();
|
|
452
467
|
}
|
|
453
|
-
}, _callee8, this, [[0,
|
|
468
|
+
}, _callee8, this, [[0, 18]]);
|
|
454
469
|
}));
|
|
455
470
|
function canBeResolvedAsEmbed(_x6) {
|
|
456
471
|
return _canBeResolvedAsEmbed.apply(this, arguments);
|
package/dist/es2019/provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { extractPreview } from '@atlaskit/link-extractors';
|
|
2
|
+
import { extractPreview, extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
3
3
|
import { getStatus } from '@atlaskit/linking-common';
|
|
4
4
|
import DataLoader from 'dataloader';
|
|
5
5
|
import { Transformer } from './transformer';
|
|
@@ -34,7 +34,7 @@ const isJiraBoard = url => {
|
|
|
34
34
|
return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
|
|
35
35
|
};
|
|
36
36
|
const isJiraPlan = url => {
|
|
37
|
-
return url.match(/https:\/\/.*?\/jira\/plans\/(?<resourceId>\d+)\/scenarios\/(?<resourceContext>\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/);
|
|
37
|
+
return url.match(/https:\/\/.*?\/jira\/plans\/(?<resourceId>\d+)/) && fg('plan_smart_link_base_url') || url.match(/https:\/\/.*?\/jira\/plans\/(?<resourceId>\d+)\/scenarios\/(?<resourceContext>\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/);
|
|
38
38
|
};
|
|
39
39
|
const isJiraVersion = url => {
|
|
40
40
|
return url.match(/https:\/\/.*?\/projects\/[^\/]+?\/versions\/\d+\/tab\/release-report-all-issues/);
|
|
@@ -188,6 +188,15 @@ export class EditorCardProvider {
|
|
|
188
188
|
async canBeResolvedAsEmbed(url) {
|
|
189
189
|
try {
|
|
190
190
|
const details = await this.cardClient.fetchData(url);
|
|
191
|
+
|
|
192
|
+
// Noun entities supported
|
|
193
|
+
if (fg('smart_links_noun_support')) {
|
|
194
|
+
if (!details) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
const embed = extractSmartLinkEmbed(details);
|
|
198
|
+
return !!embed;
|
|
199
|
+
}
|
|
191
200
|
const data = details && details.data;
|
|
192
201
|
if (!data) {
|
|
193
202
|
return false;
|
package/dist/esm/provider.js
CHANGED
|
@@ -8,7 +8,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
8
8
|
import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
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, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } 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); }
|
|
11
|
-
import { extractPreview } from '@atlaskit/link-extractors';
|
|
11
|
+
import { extractPreview, extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
12
12
|
import { getStatus } from '@atlaskit/linking-common';
|
|
13
13
|
import DataLoader from 'dataloader';
|
|
14
14
|
import { Transformer } from './transformer';
|
|
@@ -67,7 +67,9 @@ var isJiraBoard = function isJiraBoard(url) {
|
|
|
67
67
|
return url.match(/https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/\d\??.*/);
|
|
68
68
|
};
|
|
69
69
|
var isJiraPlan = function isJiraPlan(url) {
|
|
70
|
-
return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)
|
|
70
|
+
return url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)/, {
|
|
71
|
+
resourceId: 1
|
|
72
|
+
})) && fg('plan_smart_link_base_url') || url.match( /*#__PURE__*/_wrapRegExp(/https:\/\/.*?\/jira\/plans\/(\d+)\/scenarios\/(\d+)\/(timeline|summary|calendar|program\/\d+|dependencies)\/?/, {
|
|
71
73
|
resourceId: 1,
|
|
72
74
|
resourceContext: 2
|
|
73
75
|
}));
|
|
@@ -410,7 +412,7 @@ export var EditorCardProvider = /*#__PURE__*/function () {
|
|
|
410
412
|
*/
|
|
411
413
|
function () {
|
|
412
414
|
var _canBeResolvedAsEmbed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(url) {
|
|
413
|
-
var details, data, preview;
|
|
415
|
+
var details, embed, data, preview;
|
|
414
416
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
415
417
|
while (1) switch (_context8.prev = _context8.next) {
|
|
416
418
|
case 0:
|
|
@@ -419,30 +421,43 @@ export var EditorCardProvider = /*#__PURE__*/function () {
|
|
|
419
421
|
return this.cardClient.fetchData(url);
|
|
420
422
|
case 3:
|
|
421
423
|
details = _context8.sent;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
+
if (!fg('smart_links_noun_support')) {
|
|
425
|
+
_context8.next = 9;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
if (details) {
|
|
424
429
|
_context8.next = 7;
|
|
425
430
|
break;
|
|
426
431
|
}
|
|
427
432
|
return _context8.abrupt("return", false);
|
|
428
433
|
case 7:
|
|
434
|
+
embed = extractSmartLinkEmbed(details);
|
|
435
|
+
return _context8.abrupt("return", !!embed);
|
|
436
|
+
case 9:
|
|
437
|
+
data = details && details.data;
|
|
438
|
+
if (data) {
|
|
439
|
+
_context8.next = 12;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
return _context8.abrupt("return", false);
|
|
443
|
+
case 12:
|
|
429
444
|
if (!(getStatus(details) !== 'resolved')) {
|
|
430
|
-
_context8.next =
|
|
445
|
+
_context8.next = 14;
|
|
431
446
|
break;
|
|
432
447
|
}
|
|
433
448
|
return _context8.abrupt("return", false);
|
|
434
|
-
case
|
|
449
|
+
case 14:
|
|
435
450
|
preview = extractPreview(data, 'web');
|
|
436
451
|
return _context8.abrupt("return", !!preview);
|
|
437
|
-
case
|
|
438
|
-
_context8.prev =
|
|
452
|
+
case 18:
|
|
453
|
+
_context8.prev = 18;
|
|
439
454
|
_context8.t0 = _context8["catch"](0);
|
|
440
455
|
return _context8.abrupt("return", false);
|
|
441
|
-
case
|
|
456
|
+
case 21:
|
|
442
457
|
case "end":
|
|
443
458
|
return _context8.stop();
|
|
444
459
|
}
|
|
445
|
-
}, _callee8, this, [[0,
|
|
460
|
+
}, _callee8, this, [[0, 18]]);
|
|
446
461
|
}));
|
|
447
462
|
function canBeResolvedAsEmbed(_x6) {
|
|
448
463
|
return _canBeResolvedAsEmbed.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-card-provider",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
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",
|
|
@@ -35,19 +35,21 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/eslint-plugin-platform": "^2.5.0",
|
|
37
37
|
"@atlaskit/feature-gate-js-client": "^5.0.0",
|
|
38
|
-
"@atlaskit/json-ld-types": "^1.
|
|
38
|
+
"@atlaskit/json-ld-types": "^1.1.0",
|
|
39
39
|
"@atlaskit/link-client-extension": "^4.0.0",
|
|
40
|
-
"@atlaskit/link-extractors": "^2.
|
|
40
|
+
"@atlaskit/link-extractors": "^2.1.0",
|
|
41
41
|
"@atlaskit/linking-common": "^8.0.0",
|
|
42
|
+
"@atlaskit/linking-types": "^9.8.0",
|
|
42
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
44
|
"@babel/runtime": "^7.0.0",
|
|
44
45
|
"dataloader": "^2.1.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/link-provider": "^2.
|
|
48
|
+
"@atlaskit/link-provider": "^2.1.0",
|
|
48
49
|
"react": "^18.2.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
52
|
+
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
51
53
|
"typescript": "~5.4.2"
|
|
52
54
|
},
|
|
53
55
|
"platform-feature-flags": {
|
|
@@ -59,6 +61,12 @@
|
|
|
59
61
|
},
|
|
60
62
|
"tc_smart_link_embed_view": {
|
|
61
63
|
"type": "boolean"
|
|
64
|
+
},
|
|
65
|
+
"plan_smart_link_base_url": {
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
},
|
|
68
|
+
"smart_links_noun_support": {
|
|
69
|
+
"type": "boolean"
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
}
|