@atlaskit/editor-card-provider 5.6.2 → 5.6.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/api.js +4 -1
- package/dist/cjs/provider.js +10 -23
- package/dist/es2019/api.js +4 -1
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/provider.js +10 -20
- package/dist/esm/api.js +4 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/provider.js +12 -23
- package/dist/types/provider.d.ts +1 -3
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/provider.d.ts +1 -3
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-card-provider
|
|
2
2
|
|
|
3
|
+
## 5.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`12965b4e6ff8c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/12965b4e6ff8c) -
|
|
8
|
+
[https://product-fabric.atlassian.net/browse/ED-29210](ED-29210) - change
|
|
9
|
+
`@atlaskit/editor-card-provider` package ownership from
|
|
10
|
+
`Navigation Experiences - Linking Platform` to `Editor: Lego`
|
|
11
|
+
|
|
12
|
+
## 5.6.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`7c6ff04dd40e8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c6ff04dd40e8) -
|
|
17
|
+
FG/Experiment jsc_nin_smart_link - jira_nin_smart_link Cleanup
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 5.6.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/api.js
CHANGED
|
@@ -21,6 +21,7 @@ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0,
|
|
|
21
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
22
|
var ALLOWED_RESPONSE_STATUS_CODES = [200, 401, 404];
|
|
23
23
|
var NetworkError = exports.NetworkError = /*#__PURE__*/function (_Error) {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
25
|
function NetworkError(error) {
|
|
25
26
|
(0, _classCallCheck2.default)(this, NetworkError);
|
|
26
27
|
return _callSuper(this, NetworkError, [error]);
|
|
@@ -34,7 +35,9 @@ function request(_x, _x2, _x3, _x4) {
|
|
|
34
35
|
return _request.apply(this, arguments);
|
|
35
36
|
}
|
|
36
37
|
function _request() {
|
|
37
|
-
_request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(method, url,
|
|
38
|
+
_request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(method, url,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
data, headers) {
|
|
38
41
|
var requestConfig, response;
|
|
39
42
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
40
43
|
while (1) switch (_context.prev = _context.next) {
|
package/dist/cjs/provider.js
CHANGED
|
@@ -13,7 +13,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
18
17
|
var _setPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/setPrototypeOf"));
|
|
19
18
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
@@ -22,14 +21,12 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
|
22
21
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
23
22
|
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
24
23
|
var _transformer = require("./transformer");
|
|
25
|
-
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
26
24
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
27
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
|
-
var
|
|
29
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
+
var _api = require("./api");
|
|
30
27
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
31
28
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
32
|
-
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, 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); }
|
|
29
|
+
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, 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); } /* eslint-disable require-unicode-regexp,prefer-regex-literals */
|
|
33
30
|
var BATCH_WAIT_TIME = 50;
|
|
34
31
|
|
|
35
32
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
@@ -137,13 +134,6 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
137
134
|
var _this;
|
|
138
135
|
(0, _classCallCheck2.default)(this, EditorCardProvider);
|
|
139
136
|
_this = _callSuper(this, EditorCardProvider);
|
|
140
|
-
(0, _defineProperty2.default)(_this, "getExperimentValue", function (experimentName, parameterName, defaultValue) {
|
|
141
|
-
try {
|
|
142
|
-
return _featureGateJsClient.default.getExperimentValue(experimentName, parameterName, defaultValue);
|
|
143
|
-
} catch (_unused) {
|
|
144
|
-
return defaultValue;
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
137
|
_this.name = 'editorCardProvider';
|
|
148
138
|
_this.baseUrl = baseUrlOverride || (0, _linkingCommon.getBaseUrl)(envKey);
|
|
149
139
|
_this.resolverUrl = (0, _linkingCommon.getResolverUrl)(envKey, baseUrlOverride);
|
|
@@ -340,7 +330,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
340
330
|
case 0:
|
|
341
331
|
endpoint = "".concat(this.resolverUrl, "/providers");
|
|
342
332
|
_context4.next = 3;
|
|
343
|
-
return
|
|
333
|
+
return (0, _api.request)('post', endpoint, undefined, this.requestHeaders);
|
|
344
334
|
case 3:
|
|
345
335
|
response = _context4.sent;
|
|
346
336
|
return _context4.abrupt("return", {
|
|
@@ -538,21 +528,17 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
538
528
|
if ((0, _platformFeatureFlags.fg)('tc_smart_link_embed_view')) {
|
|
539
529
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
540
530
|
}
|
|
541
|
-
|
|
542
|
-
if (this.getExperimentValue('jsc_nin_smart_link', 'isEnabled', false)) {
|
|
543
|
-
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
544
|
-
}
|
|
545
|
-
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) {
|
|
531
|
+
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 || isJiraIssueNavigator(url)) {
|
|
546
532
|
return 'embed';
|
|
547
533
|
}
|
|
548
534
|
}
|
|
549
|
-
|
|
550
|
-
key: "canBeResolvedAsEmbed",
|
|
551
|
-
value: (
|
|
535
|
+
|
|
552
536
|
/**
|
|
553
537
|
* Make a /resolve call and find out if result has embed capability
|
|
554
538
|
*/
|
|
555
|
-
|
|
539
|
+
}, {
|
|
540
|
+
key: "canBeResolvedAsEmbed",
|
|
541
|
+
value: (function () {
|
|
556
542
|
var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
|
|
557
543
|
var details, embed;
|
|
558
544
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
@@ -810,4 +796,5 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
810
796
|
}()
|
|
811
797
|
}]);
|
|
812
798
|
}(_nodeDataProvider.NodeDataProvider);
|
|
813
|
-
var editorCardProvider = exports.editorCardProvider = new EditorCardProvider();
|
|
799
|
+
var editorCardProvider = exports.editorCardProvider = new EditorCardProvider();
|
|
800
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
package/dist/es2019/api.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const ALLOWED_RESPONSE_STATUS_CODES = [200, 401, 404];
|
|
2
2
|
export class NetworkError extends Error {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
4
|
constructor(error) {
|
|
4
5
|
super(error);
|
|
5
6
|
}
|
|
@@ -8,7 +9,9 @@ export class NetworkError extends Error {
|
|
|
8
9
|
// NOTE: This is copied from @atlaskit/link-provider as we are in the middle of a deprecation.
|
|
9
10
|
// To read more, see https://hello.atlassian.net/browse/ENGHEALTH-661
|
|
10
11
|
// Also: https://product-fabric.atlassian.net/browse/EDM-5755
|
|
11
|
-
export async function request(method, url,
|
|
12
|
+
export async function request(method, url,
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
data, headers) {
|
|
12
15
|
const requestConfig = {
|
|
13
16
|
method,
|
|
14
17
|
credentials: 'include',
|
package/dist/es2019/index.js
CHANGED
package/dist/es2019/provider.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable require-unicode-regexp,prefer-regex-literals */
|
|
2
|
+
|
|
2
3
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
3
4
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
4
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import { getStatus } from '@atlaskit/linking-common';
|
|
6
|
+
import { getStatus, getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
|
|
6
7
|
import DataLoader from 'dataloader';
|
|
7
8
|
import { Transformer } from './transformer';
|
|
8
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
9
9
|
import { CardClient } from '@atlaskit/link-provider';
|
|
10
|
-
import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
|
|
11
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import
|
|
11
|
+
import { request } from './api';
|
|
13
12
|
const BATCH_WAIT_TIME = 50;
|
|
14
13
|
|
|
15
14
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
@@ -70,13 +69,6 @@ export const isJiraWorkItem = url => /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
|
|
|
70
69
|
export class EditorCardProvider extends NodeDataProvider {
|
|
71
70
|
constructor(envKey, baseUrlOverride, product, onResolve, customCardClient) {
|
|
72
71
|
super();
|
|
73
|
-
_defineProperty(this, "getExperimentValue", (experimentName, parameterName, defaultValue) => {
|
|
74
|
-
try {
|
|
75
|
-
return FeatureGates.getExperimentValue(experimentName, parameterName, defaultValue);
|
|
76
|
-
} catch {
|
|
77
|
-
return defaultValue;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
72
|
this.name = 'editorCardProvider';
|
|
81
73
|
this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
|
|
82
74
|
this.resolverUrl = getResolverUrl(envKey, baseUrlOverride);
|
|
@@ -156,7 +148,7 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
156
148
|
}
|
|
157
149
|
async fetchProvidersData() {
|
|
158
150
|
const endpoint = `${this.resolverUrl}/providers`;
|
|
159
|
-
const response = await
|
|
151
|
+
const response = await request('post', endpoint, undefined, this.requestHeaders);
|
|
160
152
|
return {
|
|
161
153
|
patterns: response.providers.reduce((allSources, provider) => {
|
|
162
154
|
return allSources.concat(provider.patterns);
|
|
@@ -237,14 +229,11 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
237
229
|
if (fg('tc_smart_link_embed_view')) {
|
|
238
230
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
239
231
|
}
|
|
240
|
-
|
|
241
|
-
if (this.getExperimentValue('jsc_nin_smart_link', 'isEnabled', false)) {
|
|
242
|
-
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
243
|
-
}
|
|
244
|
-
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) {
|
|
232
|
+
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 || isJiraIssueNavigator(url)) {
|
|
245
233
|
return 'embed';
|
|
246
234
|
}
|
|
247
235
|
}
|
|
236
|
+
|
|
248
237
|
/**
|
|
249
238
|
* Make a /resolve call and find out if result has embed capability
|
|
250
239
|
*/
|
|
@@ -331,7 +320,7 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
331
320
|
if (shouldForceAppearance === false && userPreference === 'url') {
|
|
332
321
|
return Promise.reject(undefined);
|
|
333
322
|
}
|
|
334
|
-
|
|
323
|
+
const isSupported = !!matchedProviderPattern || (await this.checkLinkResolved(url));
|
|
335
324
|
if (isSupported) {
|
|
336
325
|
const providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
|
|
337
326
|
let preferredAppearance = shouldForceAppearance === undefined ?
|
|
@@ -378,4 +367,5 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
378
367
|
return Promise.reject(undefined);
|
|
379
368
|
}
|
|
380
369
|
}
|
|
381
|
-
export const editorCardProvider = new EditorCardProvider();
|
|
370
|
+
export const editorCardProvider = new EditorCardProvider();
|
|
371
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
package/dist/esm/api.js
CHANGED
|
@@ -13,6 +13,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
var ALLOWED_RESPONSE_STATUS_CODES = [200, 401, 404];
|
|
15
15
|
export var NetworkError = /*#__PURE__*/function (_Error) {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
17
|
function NetworkError(error) {
|
|
17
18
|
_classCallCheck(this, NetworkError);
|
|
18
19
|
return _callSuper(this, NetworkError, [error]);
|
|
@@ -28,7 +29,9 @@ export function request(_x, _x2, _x3, _x4) {
|
|
|
28
29
|
return _request.apply(this, arguments);
|
|
29
30
|
}
|
|
30
31
|
function _request() {
|
|
31
|
-
_request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(method, url,
|
|
32
|
+
_request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(method, url,
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
data, headers) {
|
|
32
35
|
var requestConfig, response;
|
|
33
36
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
34
37
|
while (1) switch (_context.prev = _context.next) {
|
package/dist/esm/index.js
CHANGED
package/dist/esm/provider.js
CHANGED
|
@@ -5,24 +5,23 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
8
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
10
9
|
import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf";
|
|
11
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
13
|
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); }
|
|
14
|
+
/* eslint-disable require-unicode-regexp,prefer-regex-literals */
|
|
15
|
+
|
|
15
16
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
16
17
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
17
18
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
|
-
import { getStatus } from '@atlaskit/linking-common';
|
|
19
|
+
import { getStatus, getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
|
|
19
20
|
import DataLoader from 'dataloader';
|
|
20
21
|
import { Transformer } from './transformer';
|
|
21
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
22
22
|
import { CardClient } from '@atlaskit/link-provider';
|
|
23
|
-
import { getBaseUrl, getResolverUrl } from '@atlaskit/linking-common';
|
|
24
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
|
-
import
|
|
24
|
+
import { request } from './api';
|
|
26
25
|
var BATCH_WAIT_TIME = 50;
|
|
27
26
|
|
|
28
27
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
@@ -130,13 +129,6 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
130
129
|
var _this;
|
|
131
130
|
_classCallCheck(this, EditorCardProvider);
|
|
132
131
|
_this = _callSuper(this, EditorCardProvider);
|
|
133
|
-
_defineProperty(_this, "getExperimentValue", function (experimentName, parameterName, defaultValue) {
|
|
134
|
-
try {
|
|
135
|
-
return FeatureGates.getExperimentValue(experimentName, parameterName, defaultValue);
|
|
136
|
-
} catch (_unused) {
|
|
137
|
-
return defaultValue;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
132
|
_this.name = 'editorCardProvider';
|
|
141
133
|
_this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
|
|
142
134
|
_this.resolverUrl = getResolverUrl(envKey, baseUrlOverride);
|
|
@@ -333,7 +325,7 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
333
325
|
case 0:
|
|
334
326
|
endpoint = "".concat(this.resolverUrl, "/providers");
|
|
335
327
|
_context4.next = 3;
|
|
336
|
-
return
|
|
328
|
+
return request('post', endpoint, undefined, this.requestHeaders);
|
|
337
329
|
case 3:
|
|
338
330
|
response = _context4.sent;
|
|
339
331
|
return _context4.abrupt("return", {
|
|
@@ -531,21 +523,17 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
531
523
|
if (fg('tc_smart_link_embed_view')) {
|
|
532
524
|
isConfluenceTeamCalendarsEvaluated = isConfluenceTeamCalendars(url);
|
|
533
525
|
}
|
|
534
|
-
|
|
535
|
-
if (this.getExperimentValue('jsc_nin_smart_link', 'isEnabled', false)) {
|
|
536
|
-
isJiraIssueNavigatorEvaluated = isJiraIssueNavigator(url);
|
|
537
|
-
}
|
|
538
|
-
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) {
|
|
526
|
+
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 || isJiraIssueNavigator(url)) {
|
|
539
527
|
return 'embed';
|
|
540
528
|
}
|
|
541
529
|
}
|
|
542
|
-
|
|
543
|
-
key: "canBeResolvedAsEmbed",
|
|
544
|
-
value: (
|
|
530
|
+
|
|
545
531
|
/**
|
|
546
532
|
* Make a /resolve call and find out if result has embed capability
|
|
547
533
|
*/
|
|
548
|
-
|
|
534
|
+
}, {
|
|
535
|
+
key: "canBeResolvedAsEmbed",
|
|
536
|
+
value: (function () {
|
|
549
537
|
var _canBeResolvedAsEmbed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url) {
|
|
550
538
|
var details, embed;
|
|
551
539
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
@@ -803,4 +791,5 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
803
791
|
}()
|
|
804
792
|
}]);
|
|
805
793
|
}(NodeDataProvider);
|
|
806
|
-
export var editorCardProvider = new EditorCardProvider();
|
|
794
|
+
export var editorCardProvider = new EditorCardProvider();
|
|
795
|
+
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
package/dist/types/provider.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { JSONNode } from '@atlaskit/editor-json-transformer';
|
|
2
2
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
3
|
-
import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
|
|
3
|
+
import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType, type EnvironmentsKeys } from '@atlaskit/linking-common';
|
|
4
4
|
import { type CardProvider } from './types';
|
|
5
5
|
import { CardClient } from '@atlaskit/link-provider';
|
|
6
|
-
import { type EnvironmentsKeys } from '@atlaskit/linking-common';
|
|
7
6
|
import { type JsonLd } from '@atlaskit/json-ld-types';
|
|
8
7
|
export declare const isJiraWorkItem: (url: string) => boolean;
|
|
9
8
|
type CardNode = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
|
|
@@ -41,7 +40,6 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
|
|
|
41
40
|
* @returns 'embed' for the card appearance to embed by default
|
|
42
41
|
*/
|
|
43
42
|
protected getHardCodedAppearance(url: string): CardAppearance | undefined;
|
|
44
|
-
private getExperimentValue;
|
|
45
43
|
/**
|
|
46
44
|
* Make a /resolve call and find out if result has embed capability
|
|
47
45
|
*/
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CardAppearance } from '@atlaskit/linking-common';
|
|
2
2
|
export interface CardProvider {
|
|
3
|
-
resolve(url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean)
|
|
3
|
+
resolve: (url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean) => Promise<any>;
|
|
4
4
|
}
|
|
5
5
|
export type ORSCheckResponse = {
|
|
6
6
|
isSupported: boolean;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { JSONNode } from '@atlaskit/editor-json-transformer';
|
|
2
2
|
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
3
|
-
import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
|
|
3
|
+
import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType, type EnvironmentsKeys } from '@atlaskit/linking-common';
|
|
4
4
|
import { type CardProvider } from './types';
|
|
5
5
|
import { CardClient } from '@atlaskit/link-provider';
|
|
6
|
-
import { type EnvironmentsKeys } from '@atlaskit/linking-common';
|
|
7
6
|
import { type JsonLd } from '@atlaskit/json-ld-types';
|
|
8
7
|
export declare const isJiraWorkItem: (url: string) => boolean;
|
|
9
8
|
type CardNode = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
|
|
@@ -41,7 +40,6 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
|
|
|
41
40
|
* @returns 'embed' for the card appearance to embed by default
|
|
42
41
|
*/
|
|
43
42
|
protected getHardCodedAppearance(url: string): CardAppearance | undefined;
|
|
44
|
-
private getExperimentValue;
|
|
45
43
|
/**
|
|
46
44
|
* Make a /resolve call and find out if result has embed capability
|
|
47
45
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CardAppearance } from '@atlaskit/linking-common';
|
|
2
2
|
export interface CardProvider {
|
|
3
|
-
resolve(url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean)
|
|
3
|
+
resolve: (url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean) => Promise<any>;
|
|
4
4
|
}
|
|
5
5
|
export type ORSCheckResponse = {
|
|
6
6
|
isSupported: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-card-provider",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
|
-
"team": "
|
|
11
|
+
"team": "Editor: Lego",
|
|
12
12
|
"website": {
|
|
13
13
|
"name": "EditorCardProvider"
|
|
14
14
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/linking-types": "^14.0.0",
|
|
39
39
|
"@atlaskit/node-data-provider": "^5.0.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^12.8.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"dataloader": "^2.1.0"
|
|
44
44
|
},
|
|
@@ -59,9 +59,6 @@
|
|
|
59
59
|
"plan_smart_link_base_url": {
|
|
60
60
|
"type": "boolean"
|
|
61
61
|
},
|
|
62
|
-
"jira_nin_smart_link": {
|
|
63
|
-
"type": "boolean"
|
|
64
|
-
},
|
|
65
62
|
"issue-link-suggestions-in-comments": {
|
|
66
63
|
"type": "boolean"
|
|
67
64
|
}
|