@atlaskit/editor-card-provider 4.2.3 → 4.2.5
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 +30 -10
- package/dist/es2019/provider.js +16 -2
- package/dist/esm/provider.js +31 -11
- package/package.json +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-card-provider
|
|
2
2
|
|
|
3
|
+
## 4.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#151981](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/151981)
|
|
8
|
+
[`81504547cb490`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81504547cb490) -
|
|
9
|
+
[ux] Issue Navigator links will be converted into smart link embed by default
|
|
10
|
+
|
|
11
|
+
## 4.2.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#141229](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141229)
|
|
16
|
+
[`9740656964ab1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9740656964ab1) -
|
|
17
|
+
Implement nounData embed preview extractors behind ff: smart_links_noun_support
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 4.2.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/provider.js
CHANGED
|
@@ -103,6 +103,9 @@ var isConfluenceTeamCalendars = function isConfluenceTeamCalendars(url) {
|
|
|
103
103
|
resourceId: 2
|
|
104
104
|
}));
|
|
105
105
|
};
|
|
106
|
+
var isJiraIssueNavigator = function isJiraIssueNavigator(url) {
|
|
107
|
+
return url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
|
|
108
|
+
};
|
|
106
109
|
var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
107
110
|
function EditorCardProvider(envKey, baseUrlOverride, product) {
|
|
108
111
|
var _this = this;
|
|
@@ -408,7 +411,11 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
|
408
411
|
if ((0, _platformFeatureFlags.fg)('tc_smart_link_embed_view')) {
|
|
409
412
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
410
413
|
}
|
|
411
|
-
|
|
414
|
+
var isJiraIssueNavigatorEvaluated;
|
|
415
|
+
if ((0, _platformFeatureFlags.fg)('jira_nin_smart_link')) {
|
|
416
|
+
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
417
|
+
}
|
|
418
|
+
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) || isRovoAgentProfilePage(url) || isJiraVersion(url) || isJiraPlanEvaluated || isJiraFormEvaluated || isJiraSummaryEvaluated || isCustomer360LandingPage(url) || isConfluenceTeamCalendarsEvaluated || isJiraIssueNavigatorEvaluated) {
|
|
412
419
|
return 'embed';
|
|
413
420
|
}
|
|
414
421
|
}
|
|
@@ -420,7 +427,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
|
420
427
|
*/
|
|
421
428
|
function () {
|
|
422
429
|
var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
|
|
423
|
-
var details, data, preview;
|
|
430
|
+
var details, embed, data, preview;
|
|
424
431
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
425
432
|
while (1) switch (_context8.prev = _context8.next) {
|
|
426
433
|
case 0:
|
|
@@ -429,30 +436,43 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
|
|
|
429
436
|
return this.cardClient.fetchData(url);
|
|
430
437
|
case 3:
|
|
431
438
|
details = _context8.sent;
|
|
432
|
-
|
|
433
|
-
|
|
439
|
+
if (!(0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
|
|
440
|
+
_context8.next = 9;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
if (details) {
|
|
434
444
|
_context8.next = 7;
|
|
435
445
|
break;
|
|
436
446
|
}
|
|
437
447
|
return _context8.abrupt("return", false);
|
|
438
448
|
case 7:
|
|
449
|
+
embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
|
|
450
|
+
return _context8.abrupt("return", !!embed);
|
|
451
|
+
case 9:
|
|
452
|
+
data = details && details.data;
|
|
453
|
+
if (data) {
|
|
454
|
+
_context8.next = 12;
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
return _context8.abrupt("return", false);
|
|
458
|
+
case 12:
|
|
439
459
|
if (!((0, _linkingCommon.getStatus)(details) !== 'resolved')) {
|
|
440
|
-
_context8.next =
|
|
460
|
+
_context8.next = 14;
|
|
441
461
|
break;
|
|
442
462
|
}
|
|
443
463
|
return _context8.abrupt("return", false);
|
|
444
|
-
case
|
|
464
|
+
case 14:
|
|
445
465
|
preview = (0, _linkExtractors.extractPreview)(data, 'web');
|
|
446
466
|
return _context8.abrupt("return", !!preview);
|
|
447
|
-
case
|
|
448
|
-
_context8.prev =
|
|
467
|
+
case 18:
|
|
468
|
+
_context8.prev = 18;
|
|
449
469
|
_context8.t0 = _context8["catch"](0);
|
|
450
470
|
return _context8.abrupt("return", false);
|
|
451
|
-
case
|
|
471
|
+
case 21:
|
|
452
472
|
case "end":
|
|
453
473
|
return _context8.stop();
|
|
454
474
|
}
|
|
455
|
-
}, _callee8, this, [[0,
|
|
475
|
+
}, _callee8, this, [[0, 18]]);
|
|
456
476
|
}));
|
|
457
477
|
function canBeResolvedAsEmbed(_x6) {
|
|
458
478
|
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';
|
|
@@ -50,6 +50,7 @@ const isRovoAgentProfilePage = url => {
|
|
|
50
50
|
};
|
|
51
51
|
const isCustomer360LandingPage = url => url.match(/^https:\/\/customer\.atlassian\.com\/.*$/);
|
|
52
52
|
const isConfluenceTeamCalendars = url => url.match(/\/wiki\/spaces\/(?<resourceContext>[^\/]+)\/calendars\/(?<resourceId>[a-zA-Z0-9-]+)/);
|
|
53
|
+
const isJiraIssueNavigator = url => url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
|
|
53
54
|
export class EditorCardProvider {
|
|
54
55
|
constructor(envKey, baseUrlOverride, product) {
|
|
55
56
|
_defineProperty(this, "getExperimentValue", (experimentName, parameterName, defaultValue) => {
|
|
@@ -178,7 +179,11 @@ export class EditorCardProvider {
|
|
|
178
179
|
if (fg('tc_smart_link_embed_view')) {
|
|
179
180
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
+
let isJiraIssueNavigatorEvaluated;
|
|
183
|
+
if (fg('jira_nin_smart_link')) {
|
|
184
|
+
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
185
|
+
}
|
|
186
|
+
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) || isRovoAgentProfilePage(url) || isJiraVersion(url) || isJiraPlanEvaluated || isJiraFormEvaluated || isJiraSummaryEvaluated || isCustomer360LandingPage(url) || isConfluenceTeamCalendarsEvaluated || isJiraIssueNavigatorEvaluated) {
|
|
182
187
|
return 'embed';
|
|
183
188
|
}
|
|
184
189
|
}
|
|
@@ -188,6 +193,15 @@ export class EditorCardProvider {
|
|
|
188
193
|
async canBeResolvedAsEmbed(url) {
|
|
189
194
|
try {
|
|
190
195
|
const details = await this.cardClient.fetchData(url);
|
|
196
|
+
|
|
197
|
+
// Noun entities supported
|
|
198
|
+
if (fg('smart_links_noun_support')) {
|
|
199
|
+
if (!details) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const embed = extractSmartLinkEmbed(details);
|
|
203
|
+
return !!embed;
|
|
204
|
+
}
|
|
191
205
|
const data = details && details.data;
|
|
192
206
|
if (!data) {
|
|
193
207
|
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';
|
|
@@ -95,6 +95,9 @@ var isConfluenceTeamCalendars = function isConfluenceTeamCalendars(url) {
|
|
|
95
95
|
resourceId: 2
|
|
96
96
|
}));
|
|
97
97
|
};
|
|
98
|
+
var isJiraIssueNavigator = function isJiraIssueNavigator(url) {
|
|
99
|
+
return url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
|
|
100
|
+
};
|
|
98
101
|
export var EditorCardProvider = /*#__PURE__*/function () {
|
|
99
102
|
function EditorCardProvider(envKey, baseUrlOverride, product) {
|
|
100
103
|
var _this = this;
|
|
@@ -400,7 +403,11 @@ export var EditorCardProvider = /*#__PURE__*/function () {
|
|
|
400
403
|
if (fg('tc_smart_link_embed_view')) {
|
|
401
404
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
402
405
|
}
|
|
403
|
-
|
|
406
|
+
var isJiraIssueNavigatorEvaluated;
|
|
407
|
+
if (fg('jira_nin_smart_link')) {
|
|
408
|
+
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
409
|
+
}
|
|
410
|
+
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) || isRovoAgentProfilePage(url) || isJiraVersion(url) || isJiraPlanEvaluated || isJiraFormEvaluated || isJiraSummaryEvaluated || isCustomer360LandingPage(url) || isConfluenceTeamCalendarsEvaluated || isJiraIssueNavigatorEvaluated) {
|
|
404
411
|
return 'embed';
|
|
405
412
|
}
|
|
406
413
|
}
|
|
@@ -412,7 +419,7 @@ export var EditorCardProvider = /*#__PURE__*/function () {
|
|
|
412
419
|
*/
|
|
413
420
|
function () {
|
|
414
421
|
var _canBeResolvedAsEmbed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(url) {
|
|
415
|
-
var details, data, preview;
|
|
422
|
+
var details, embed, data, preview;
|
|
416
423
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
417
424
|
while (1) switch (_context8.prev = _context8.next) {
|
|
418
425
|
case 0:
|
|
@@ -421,30 +428,43 @@ export var EditorCardProvider = /*#__PURE__*/function () {
|
|
|
421
428
|
return this.cardClient.fetchData(url);
|
|
422
429
|
case 3:
|
|
423
430
|
details = _context8.sent;
|
|
424
|
-
|
|
425
|
-
|
|
431
|
+
if (!fg('smart_links_noun_support')) {
|
|
432
|
+
_context8.next = 9;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
if (details) {
|
|
426
436
|
_context8.next = 7;
|
|
427
437
|
break;
|
|
428
438
|
}
|
|
429
439
|
return _context8.abrupt("return", false);
|
|
430
440
|
case 7:
|
|
441
|
+
embed = extractSmartLinkEmbed(details);
|
|
442
|
+
return _context8.abrupt("return", !!embed);
|
|
443
|
+
case 9:
|
|
444
|
+
data = details && details.data;
|
|
445
|
+
if (data) {
|
|
446
|
+
_context8.next = 12;
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
return _context8.abrupt("return", false);
|
|
450
|
+
case 12:
|
|
431
451
|
if (!(getStatus(details) !== 'resolved')) {
|
|
432
|
-
_context8.next =
|
|
452
|
+
_context8.next = 14;
|
|
433
453
|
break;
|
|
434
454
|
}
|
|
435
455
|
return _context8.abrupt("return", false);
|
|
436
|
-
case
|
|
456
|
+
case 14:
|
|
437
457
|
preview = extractPreview(data, 'web');
|
|
438
458
|
return _context8.abrupt("return", !!preview);
|
|
439
|
-
case
|
|
440
|
-
_context8.prev =
|
|
459
|
+
case 18:
|
|
460
|
+
_context8.prev = 18;
|
|
441
461
|
_context8.t0 = _context8["catch"](0);
|
|
442
462
|
return _context8.abrupt("return", false);
|
|
443
|
-
case
|
|
463
|
+
case 21:
|
|
444
464
|
case "end":
|
|
445
465
|
return _context8.stop();
|
|
446
466
|
}
|
|
447
|
-
}, _callee8, this, [[0,
|
|
467
|
+
}, _callee8, this, [[0, 18]]);
|
|
448
468
|
}));
|
|
449
469
|
function canBeResolvedAsEmbed(_x6) {
|
|
450
470
|
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.5",
|
|
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",
|
|
@@ -34,20 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/eslint-plugin-platform": "^2.5.0",
|
|
37
|
-
"@atlaskit/feature-gate-js-client": "^5.
|
|
38
|
-
"@atlaskit/json-ld-types": "^1.
|
|
37
|
+
"@atlaskit/feature-gate-js-client": "^5.3.0",
|
|
38
|
+
"@atlaskit/json-ld-types": "^1.2.0",
|
|
39
39
|
"@atlaskit/link-client-extension": "^4.0.0",
|
|
40
|
-
"@atlaskit/link-extractors": "^2.
|
|
41
|
-
"@atlaskit/linking-common": "^8.
|
|
40
|
+
"@atlaskit/link-extractors": "^2.3.0",
|
|
41
|
+
"@atlaskit/linking-common": "^8.1.0",
|
|
42
|
+
"@atlaskit/linking-types": "^9.10.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": {
|
|
@@ -62,6 +64,12 @@
|
|
|
62
64
|
},
|
|
63
65
|
"plan_smart_link_base_url": {
|
|
64
66
|
"type": "boolean"
|
|
67
|
+
},
|
|
68
|
+
"smart_links_noun_support": {
|
|
69
|
+
"type": "boolean"
|
|
70
|
+
},
|
|
71
|
+
"jira_nin_smart_link": {
|
|
72
|
+
"type": "boolean"
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
}
|