@atlaskit/editor-card-provider 5.0.3 → 5.1.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,22 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#174410](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/174410)
8
+ [`80d17e2d01bc0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/80d17e2d01bc0) -
9
+ Issue Editor - Only call onResolve callback for resolved links if local links (not remote links)
10
+
11
+ ## 5.0.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [#167423](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/167423)
16
+ [`064579ff3e75c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/064579ff3e75c) -
17
+ Move smart_links_noun_support feature gate to link-extractor
18
+ - Updated dependencies
19
+
3
20
  ## 5.0.3
4
21
 
5
22
  ### Patch Changes
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.editorCardProvider = exports.EditorCardProvider = void 0;
8
+ exports.isJiraWorkItem = exports.editorCardProvider = exports.EditorCardProvider = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -105,8 +105,11 @@ var isConfluenceTeamCalendars = function isConfluenceTeamCalendars(url) {
105
105
  var isJiraIssueNavigator = function isJiraIssueNavigator(url) {
106
106
  return url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
107
107
  };
108
+ var isJiraWorkItem = exports.isJiraWorkItem = function isJiraWorkItem(url) {
109
+ return /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
110
+ };
108
111
  var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
109
- function EditorCardProvider(envKey, baseUrlOverride, product) {
112
+ function EditorCardProvider(envKey, baseUrlOverride, product, onResolve) {
110
113
  var _this = this;
111
114
  (0, _classCallCheck2.default)(this, EditorCardProvider);
112
115
  (0, _defineProperty2.default)(this, "getExperimentValue", function (experimentName, parameterName, defaultValue) {
@@ -119,6 +122,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
119
122
  this.baseUrl = baseUrlOverride || (0, _linkingCommon.getBaseUrl)(envKey);
120
123
  this.resolverUrl = (0, _linkingCommon.getResolverUrl)(envKey, baseUrlOverride);
121
124
  this.transformer = new _transformer.Transformer();
125
+ this.onResolve = onResolve;
122
126
  this.requestHeaders = {
123
127
  Origin: this.baseUrl
124
128
  };
@@ -197,19 +201,63 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
197
201
  return checkLinkResolved;
198
202
  }()
199
203
  }, {
200
- key: "fetchProvidersData",
204
+ key: "fetchDataForResource",
201
205
  value: function () {
202
- var _fetchProvidersData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
203
- var endpoint, response;
206
+ var _fetchDataForResource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resourceUrl) {
207
+ var response;
204
208
  return _regenerator.default.wrap(function _callee3$(_context3) {
205
209
  while (1) switch (_context3.prev = _context3.next) {
206
210
  case 0:
207
- endpoint = "".concat(this.resolverUrl, "/providers");
211
+ _context3.prev = 0;
208
212
  _context3.next = 3;
209
- return api.request('post', endpoint, undefined, this.requestHeaders);
213
+ return this.cardClient.fetchData(resourceUrl);
210
214
  case 3:
211
215
  response = _context3.sent;
212
- return _context3.abrupt("return", {
216
+ if (!((0, _linkingCommon.getStatus)(response) !== 'not_found')) {
217
+ _context3.next = 6;
218
+ break;
219
+ }
220
+ return _context3.abrupt("return", response);
221
+ case 6:
222
+ _context3.next = 11;
223
+ break;
224
+ case 8:
225
+ _context3.prev = 8;
226
+ _context3.t0 = _context3["catch"](0);
227
+ return _context3.abrupt("return", undefined);
228
+ case 11:
229
+ case "end":
230
+ return _context3.stop();
231
+ }
232
+ }, _callee3, this, [[0, 8]]);
233
+ }));
234
+ function fetchDataForResource(_x3) {
235
+ return _fetchDataForResource.apply(this, arguments);
236
+ }
237
+ return fetchDataForResource;
238
+ }()
239
+ }, {
240
+ key: "extractAriFromData",
241
+ value: function extractAriFromData(responseData) {
242
+ if (responseData.data && 'atlassian:ari' in responseData.data) {
243
+ return responseData.data['atlassian:ari'];
244
+ }
245
+ return undefined;
246
+ }
247
+ }, {
248
+ key: "fetchProvidersData",
249
+ value: function () {
250
+ var _fetchProvidersData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
251
+ var endpoint, response;
252
+ return _regenerator.default.wrap(function _callee4$(_context4) {
253
+ while (1) switch (_context4.prev = _context4.next) {
254
+ case 0:
255
+ endpoint = "".concat(this.resolverUrl, "/providers");
256
+ _context4.next = 3;
257
+ return api.request('post', endpoint, undefined, this.requestHeaders);
258
+ case 3:
259
+ response = _context4.sent;
260
+ return _context4.abrupt("return", {
213
261
  patterns: response.providers.reduce(function (allSources, provider) {
214
262
  return allSources.concat(provider.patterns);
215
263
  }, []),
@@ -217,9 +265,9 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
217
265
  });
218
266
  case 5:
219
267
  case "end":
220
- return _context3.stop();
268
+ return _context4.stop();
221
269
  }
222
- }, _callee3, this);
270
+ }, _callee4, this);
223
271
  }));
224
272
  function fetchProvidersData() {
225
273
  return _fetchProvidersData.apply(this, arguments);
@@ -229,29 +277,29 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
229
277
  }, {
230
278
  key: "loadProviderData",
231
279
  value: function () {
232
- var _loadProviderData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
233
- return _regenerator.default.wrap(function _callee4$(_context4) {
234
- while (1) switch (_context4.prev = _context4.next) {
280
+ var _loadProviderData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
281
+ return _regenerator.default.wrap(function _callee5$(_context5) {
282
+ while (1) switch (_context5.prev = _context5.next) {
235
283
  case 0:
236
- _context4.prev = 0;
237
- _context4.next = 3;
284
+ _context5.prev = 0;
285
+ _context5.next = 3;
238
286
  return this.providersLoader.load('providersData');
239
287
  case 3:
240
- this.providersData = _context4.sent;
241
- _context4.next = 11;
288
+ this.providersData = _context5.sent;
289
+ _context5.next = 11;
242
290
  break;
243
291
  case 6:
244
- _context4.prev = 6;
245
- _context4.t0 = _context4["catch"](0);
292
+ _context5.prev = 6;
293
+ _context5.t0 = _context5["catch"](0);
246
294
  // eslint-disable-next-line
247
- console.error('failed to fetch /providers', _context4.t0);
295
+ console.error('failed to fetch /providers', _context5.t0);
248
296
  this.providersLoader.clear('providerData');
249
- return _context4.abrupt("return", undefined);
297
+ return _context5.abrupt("return", undefined);
250
298
  case 11:
251
299
  case "end":
252
- return _context4.stop();
300
+ return _context5.stop();
253
301
  }
254
- }, _callee4, this, [[0, 6]]);
302
+ }, _callee5, this, [[0, 6]]);
255
303
  }));
256
304
  function loadProviderData() {
257
305
  return _loadProviderData.apply(this, arguments);
@@ -261,31 +309,31 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
261
309
  }, {
262
310
  key: "findPattern",
263
311
  value: function () {
264
- var _findPattern = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(url) {
265
- return _regenerator.default.wrap(function _callee5$(_context5) {
266
- while (1) switch (_context5.prev = _context5.next) {
312
+ var _findPattern = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(url) {
313
+ return _regenerator.default.wrap(function _callee6$(_context6) {
314
+ while (1) switch (_context6.prev = _context6.next) {
267
315
  case 0:
268
- _context5.next = 2;
316
+ _context6.next = 2;
269
317
  return this.findPatternData(url);
270
318
  case 2:
271
- _context5.t0 = !!_context5.sent;
272
- if (_context5.t0) {
273
- _context5.next = 7;
319
+ _context6.t0 = !!_context6.sent;
320
+ if (_context6.t0) {
321
+ _context6.next = 7;
274
322
  break;
275
323
  }
276
- _context5.next = 6;
324
+ _context6.next = 6;
277
325
  return this.checkLinkResolved(url);
278
326
  case 6:
279
- _context5.t0 = !!_context5.sent;
327
+ _context6.t0 = !!_context6.sent;
280
328
  case 7:
281
- return _context5.abrupt("return", _context5.t0);
329
+ return _context6.abrupt("return", _context6.t0);
282
330
  case 8:
283
331
  case "end":
284
- return _context5.stop();
332
+ return _context6.stop();
285
333
  }
286
- }, _callee5, this);
334
+ }, _callee6, this);
287
335
  }));
288
- function findPattern(_x3) {
336
+ function findPattern(_x4) {
289
337
  return _findPattern.apply(this, arguments);
290
338
  }
291
339
  return findPattern;
@@ -303,23 +351,23 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
303
351
  }, {
304
352
  key: "findUserPreference",
305
353
  value: function () {
306
- var _findUserPreference = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(url) {
354
+ var _findUserPreference = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(url) {
307
355
  var _this$providersData,
308
356
  _this2 = this;
309
357
  var userPreferences, defaultAppearance, appearances, allMatchedLabeledAppearances, longestMatchedLabeledAppearance;
310
- return _regenerator.default.wrap(function _callee6$(_context6) {
311
- while (1) switch (_context6.prev = _context6.next) {
358
+ return _regenerator.default.wrap(function _callee7$(_context7) {
359
+ while (1) switch (_context7.prev = _context7.next) {
312
360
  case 0:
313
361
  if (this.providersData) {
314
- _context6.next = 3;
362
+ _context7.next = 3;
315
363
  break;
316
364
  }
317
- _context6.next = 3;
365
+ _context7.next = 3;
318
366
  return this.loadProviderData();
319
367
  case 3:
320
368
  userPreferences = (_this$providersData = this.providersData) === null || _this$providersData === void 0 ? void 0 : _this$providersData.userPreferences;
321
369
  if (!userPreferences) {
322
- _context6.next = 12;
370
+ _context7.next = 12;
323
371
  break;
324
372
  }
325
373
  defaultAppearance = userPreferences.defaultAppearance, appearances = userPreferences.appearances;
@@ -328,26 +376,26 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
328
376
  return _this2.doesUrlMatchPath(urlSegment, url);
329
377
  });
330
378
  if (!(allMatchedLabeledAppearances.length > 0)) {
331
- _context6.next = 10;
379
+ _context7.next = 10;
332
380
  break;
333
381
  }
334
382
  longestMatchedLabeledAppearance = allMatchedLabeledAppearances.reduce(function (previousLabeledAppearance, currentLabeledAppearance) {
335
383
  return previousLabeledAppearance.urlSegment.length > currentLabeledAppearance.urlSegment.length ? previousLabeledAppearance : currentLabeledAppearance;
336
384
  });
337
- return _context6.abrupt("return", longestMatchedLabeledAppearance.appearance);
385
+ return _context7.abrupt("return", longestMatchedLabeledAppearance.appearance);
338
386
  case 10:
339
387
  if (!(defaultAppearance !== 'inline')) {
340
- _context6.next = 12;
388
+ _context7.next = 12;
341
389
  break;
342
390
  }
343
- return _context6.abrupt("return", defaultAppearance);
391
+ return _context7.abrupt("return", defaultAppearance);
344
392
  case 12:
345
393
  case "end":
346
- return _context6.stop();
394
+ return _context7.stop();
347
395
  }
348
- }, _callee6, this);
396
+ }, _callee7, this);
349
397
  }));
350
- function findUserPreference(_x4) {
398
+ function findUserPreference(_x5) {
351
399
  return _findUserPreference.apply(this, arguments);
352
400
  }
353
401
  return findUserPreference;
@@ -355,28 +403,28 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
355
403
  }, {
356
404
  key: "findPatternData",
357
405
  value: function () {
358
- var _findPatternData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(url) {
406
+ var _findPatternData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
359
407
  var _this$providersData2;
360
- return _regenerator.default.wrap(function _callee7$(_context7) {
361
- while (1) switch (_context7.prev = _context7.next) {
408
+ return _regenerator.default.wrap(function _callee8$(_context8) {
409
+ while (1) switch (_context8.prev = _context8.next) {
362
410
  case 0:
363
411
  if (this.providersData) {
364
- _context7.next = 3;
412
+ _context8.next = 3;
365
413
  break;
366
414
  }
367
- _context7.next = 3;
415
+ _context8.next = 3;
368
416
  return this.loadProviderData();
369
417
  case 3:
370
- return _context7.abrupt("return", (_this$providersData2 = this.providersData) === null || _this$providersData2 === void 0 ? void 0 : _this$providersData2.patterns.find(function (pattern) {
418
+ return _context8.abrupt("return", (_this$providersData2 = this.providersData) === null || _this$providersData2 === void 0 ? void 0 : _this$providersData2.patterns.find(function (pattern) {
371
419
  return url.match(pattern.source);
372
420
  }));
373
421
  case 4:
374
422
  case "end":
375
- return _context7.stop();
423
+ return _context8.stop();
376
424
  }
377
- }, _callee7, this);
425
+ }, _callee8, this);
378
426
  }));
379
- function findPatternData(_x5) {
427
+ function findPatternData(_x6) {
380
428
  return _findPatternData.apply(this, arguments);
381
429
  }
382
430
  return findPatternData;
@@ -425,55 +473,41 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
425
473
  * Make a /resolve call and find out if result has embed capability
426
474
  */
427
475
  function () {
428
- var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
429
- var details, embed, data, preview;
430
- return _regenerator.default.wrap(function _callee8$(_context8) {
431
- while (1) switch (_context8.prev = _context8.next) {
476
+ var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
477
+ var details, embed;
478
+ return _regenerator.default.wrap(function _callee9$(_context9) {
479
+ while (1) switch (_context9.prev = _context9.next) {
432
480
  case 0:
433
- _context8.prev = 0;
434
- _context8.next = 3;
481
+ _context9.prev = 0;
482
+ _context9.next = 3;
435
483
  return this.cardClient.fetchData(url);
436
484
  case 3:
437
- details = _context8.sent;
438
- if (!(0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
439
- _context8.next = 9;
440
- break;
441
- }
485
+ details = _context9.sent;
442
486
  if (details) {
443
- _context8.next = 7;
487
+ _context9.next = 6;
444
488
  break;
445
489
  }
446
- return _context8.abrupt("return", false);
447
- case 7:
448
- embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
449
- return _context8.abrupt("return", !!embed);
450
- case 9:
451
- data = details && details.data;
452
- if (data) {
453
- _context8.next = 12;
454
- break;
455
- }
456
- return _context8.abrupt("return", false);
457
- case 12:
490
+ return _context9.abrupt("return", false);
491
+ case 6:
458
492
  if (!((0, _linkingCommon.getStatus)(details) !== 'resolved')) {
459
- _context8.next = 14;
493
+ _context9.next = 8;
460
494
  break;
461
495
  }
462
- return _context8.abrupt("return", false);
463
- case 14:
464
- preview = (0, _linkExtractors.extractPreview)(data, 'web');
465
- return _context8.abrupt("return", !!preview);
466
- case 18:
467
- _context8.prev = 18;
468
- _context8.t0 = _context8["catch"](0);
469
- return _context8.abrupt("return", false);
470
- case 21:
496
+ return _context9.abrupt("return", false);
497
+ case 8:
498
+ embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
499
+ return _context9.abrupt("return", !!embed);
500
+ case 12:
501
+ _context9.prev = 12;
502
+ _context9.t0 = _context9["catch"](0);
503
+ return _context9.abrupt("return", false);
504
+ case 15:
471
505
  case "end":
472
- return _context8.stop();
506
+ return _context9.stop();
473
507
  }
474
- }, _callee8, this, [[0, 18]]);
508
+ }, _callee9, this, [[0, 12]]);
475
509
  }));
476
- function canBeResolvedAsEmbed(_x6) {
510
+ function canBeResolvedAsEmbed(_x7) {
477
511
  return _canBeResolvedAsEmbed.apply(this, arguments);
478
512
  }
479
513
  return canBeResolvedAsEmbed;
@@ -485,82 +519,110 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
485
519
  }, {
486
520
  key: "getDatasourceFromResolveResponse",
487
521
  value: (function () {
488
- var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
522
+ var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(url) {
489
523
  var response, datasources;
490
- return _regenerator.default.wrap(function _callee9$(_context9) {
491
- while (1) switch (_context9.prev = _context9.next) {
524
+ return _regenerator.default.wrap(function _callee0$(_context0) {
525
+ while (1) switch (_context0.prev = _context0.next) {
492
526
  case 0:
493
- _context9.prev = 0;
494
- _context9.next = 3;
527
+ _context0.prev = 0;
528
+ _context0.next = 3;
495
529
  return this.cardClient.fetchData(url);
496
530
  case 3:
497
- response = _context9.sent;
531
+ response = _context0.sent;
498
532
  datasources = response && response.datasources || [];
499
533
  if (!(datasources.length > 0)) {
500
- _context9.next = 7;
534
+ _context0.next = 7;
501
535
  break;
502
536
  }
503
- return _context9.abrupt("return", datasources[0]);
537
+ return _context0.abrupt("return", datasources[0]);
504
538
  case 7:
505
- _context9.next = 12;
539
+ _context0.next = 12;
506
540
  break;
507
541
  case 9:
508
- _context9.prev = 9;
509
- _context9.t0 = _context9["catch"](0);
510
- return _context9.abrupt("return", undefined);
542
+ _context0.prev = 9;
543
+ _context0.t0 = _context0["catch"](0);
544
+ return _context0.abrupt("return", undefined);
511
545
  case 12:
512
546
  case "end":
513
- return _context9.stop();
547
+ return _context0.stop();
514
548
  }
515
- }, _callee9, this, [[0, 9]]);
549
+ }, _callee0, this, [[0, 9]]);
516
550
  }));
517
- function getDatasourceFromResolveResponse(_x7) {
551
+ function getDatasourceFromResolveResponse(_x8) {
518
552
  return _getDatasourceFromResolveResponse.apply(this, arguments);
519
553
  }
520
554
  return getDatasourceFromResolveResponse;
521
- }())
555
+ }()
556
+ /**
557
+ * This is used to determine if the url is a local Jira url or a remote one.
558
+ */
559
+ )
560
+ }, {
561
+ key: "isLocalUrl",
562
+ value: function isLocalUrl(url) {
563
+ return new URL(url).origin === this.baseUrl;
564
+ }
522
565
  }, {
523
566
  key: "resolve",
524
567
  value: function () {
525
- var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
526
- var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, isSupported, providerDefaultAppearance, preferredAppearance, canItBeEmbed, datasource, id, parameters;
527
- return _regenerator.default.wrap(function _callee0$(_context0) {
528
- while (1) switch (_context0.prev = _context0.next) {
568
+ var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee1(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
569
+ var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, preferredAppearance, canItBeEmbed, datasource, id, parameters;
570
+ return _regenerator.default.wrap(function _callee1$(_context1) {
571
+ while (1) switch (_context1.prev = _context1.next) {
529
572
  case 0:
530
- _context0.prev = 0;
573
+ _context1.prev = 0;
531
574
  if (!(shouldForceAppearance === true)) {
532
- _context0.next = 3;
575
+ _context1.next = 3;
533
576
  break;
534
577
  }
535
- return _context0.abrupt("return", this.transformer.toSmartlinkAdf(url, appearance));
578
+ return _context1.abrupt("return", this.transformer.toSmartlinkAdf(url, appearance));
536
579
  case 3:
537
580
  hardCodedAppearance = this.getHardCodedAppearance(url);
538
- _context0.next = 6;
581
+ _context1.next = 6;
539
582
  return Promise.all([this.findPatternData(url), this.findUserPreference(url)]);
540
583
  case 6:
541
- _yield$Promise$all = _context0.sent;
584
+ _yield$Promise$all = _context1.sent;
542
585
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
543
586
  matchedProviderPattern = _yield$Promise$all2[0];
544
587
  userPreference = _yield$Promise$all2[1];
588
+ if (!(0, _platformFeatureFlags.fg)('issue-link-suggestions-in-comments')) {
589
+ _context1.next = 16;
590
+ break;
591
+ }
592
+ if (!(isJiraWorkItem(url) && this.isLocalUrl(url))) {
593
+ _context1.next = 16;
594
+ break;
595
+ }
596
+ _context1.next = 14;
597
+ return this.fetchDataForResource(url);
598
+ case 14:
599
+ data = _context1.sent;
600
+ if (data) {
601
+ issueAri = this.extractAriFromData(data);
602
+ if (issueAri) {
603
+ (_this$onResolve = this.onResolve) === null || _this$onResolve === void 0 || _this$onResolve.call(this, url, issueAri);
604
+ }
605
+ }
606
+ case 16:
545
607
  if (!(shouldForceAppearance === false && userPreference === 'url')) {
546
- _context0.next = 12;
608
+ _context1.next = 18;
547
609
  break;
548
610
  }
549
- return _context0.abrupt("return", Promise.reject(undefined));
550
- case 12:
551
- _context0.t0 = !!matchedProviderPattern;
552
- if (_context0.t0) {
553
- _context0.next = 17;
611
+ return _context1.abrupt("return", Promise.reject(undefined));
612
+ case 18:
613
+ _context1.t0 = !!matchedProviderPattern;
614
+ if (_context1.t0) {
615
+ _context1.next = 23;
554
616
  break;
555
617
  }
556
- _context0.next = 16;
618
+ _context1.next = 22;
557
619
  return this.checkLinkResolved(url);
558
- case 16:
559
- _context0.t0 = _context0.sent;
560
- case 17:
561
- isSupported = _context0.t0;
620
+ case 22:
621
+ _context1.t0 = _context1.sent;
622
+ case 23:
623
+ isSupported = _context1.t0;
562
624
  if (!isSupported) {
563
- _context0.next = 33;
625
+ _context1.next = 39;
564
626
  break;
565
627
  }
566
628
  providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
@@ -578,27 +640,27 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
578
640
  // If not, we pick what editor (or any other client) requested
579
641
  appearance;
580
642
  if (!(preferredAppearance === userPreference && userPreference === 'embed')) {
581
- _context0.next = 26;
643
+ _context1.next = 32;
582
644
  break;
583
645
  }
584
- _context0.next = 24;
646
+ _context1.next = 30;
585
647
  return this.canBeResolvedAsEmbed(url);
586
- case 24:
587
- canItBeEmbed = _context0.sent;
648
+ case 30:
649
+ canItBeEmbed = _context1.sent;
588
650
  if (!canItBeEmbed) {
589
651
  preferredAppearance = 'inline';
590
652
  }
591
- case 26:
592
- _context0.next = 28;
653
+ case 32:
654
+ _context1.next = 34;
593
655
  return this.getDatasourceFromResolveResponse(url);
594
- case 28:
595
- datasource = _context0.sent;
656
+ case 34:
657
+ datasource = _context1.sent;
596
658
  if (!datasource) {
597
- _context0.next = 32;
659
+ _context1.next = 38;
598
660
  break;
599
661
  }
600
662
  id = datasource.id, parameters = datasource.parameters;
601
- return _context0.abrupt("return", this.transformer.toDatasourceAdf({
663
+ return _context1.abrupt("return", this.transformer.toDatasourceAdf({
602
664
  id: id,
603
665
  parameters: parameters,
604
666
  // in the future when we support multiple views, we will need to pass this in as a parameter
@@ -607,25 +669,25 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
607
669
  type: 'table'
608
670
  }]
609
671
  }, url));
610
- case 32:
611
- return _context0.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
612
- case 33:
613
- _context0.next = 38;
614
- break;
615
- case 35:
616
- _context0.prev = 35;
617
- _context0.t1 = _context0["catch"](0);
618
- // eslint-disable-next-line
619
- console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_context0.t1 instanceof Error ? " - ".concat(_context0.t1.name, " ").concat(_context0.t1.message) : ''), _context0.t1);
620
672
  case 38:
621
- return _context0.abrupt("return", Promise.reject(undefined));
673
+ return _context1.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
622
674
  case 39:
675
+ _context1.next = 44;
676
+ break;
677
+ case 41:
678
+ _context1.prev = 41;
679
+ _context1.t1 = _context1["catch"](0);
680
+ // eslint-disable-next-line
681
+ console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_context1.t1 instanceof Error ? " - ".concat(_context1.t1.name, " ").concat(_context1.t1.message) : ''), _context1.t1);
682
+ case 44:
683
+ return _context1.abrupt("return", Promise.reject(undefined));
684
+ case 45:
623
685
  case "end":
624
- return _context0.stop();
686
+ return _context1.stop();
625
687
  }
626
- }, _callee0, this, [[0, 35]]);
688
+ }, _callee1, this, [[0, 41]]);
627
689
  }));
628
- function resolve(_x8, _x9, _x0, _x1) {
690
+ function resolve(_x9, _x0, _x1, _x10) {
629
691
  return _resolve.apply(this, arguments);
630
692
  }
631
693
  return resolve;