@atlaskit/editor-card-provider 6.8.3 → 6.8.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.
@@ -198,7 +198,7 @@ function isExternalUrl(url) {
198
198
  function isCardNode(node) {
199
199
  return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
200
200
  }
201
- var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_ref) {
201
+ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
202
202
  function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient, supportedUrlFilter) {
203
203
  var _this;
204
204
  (0, _classCallCheck2.default)(this, EditorCardProvider);
@@ -226,7 +226,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
226
226
  }
227
227
  return _this;
228
228
  }
229
- (0, _inherits2.default)(EditorCardProvider, _ref);
229
+ (0, _inherits2.default)(EditorCardProvider, _NodeDataProvider);
230
230
  return (0, _createClass2.default)(EditorCardProvider, [{
231
231
  key: "refreshCache",
232
232
  value: function refreshCache(node) {
@@ -250,48 +250,27 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
250
250
  // if we can load a response from cache, use it first
251
251
  var key = this.nodeDataKey(jsonNode);
252
252
  var details = this.smartCardLocalCacheClient.getItem(key);
253
- if ((0, _expValEquals.expValEquals)('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
254
- // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
255
- var isResolvedCachedResponse = details && details.meta && (0, _linkingCommon.getStatus)(details) === 'resolved';
256
- if (isResolvedCachedResponse) {
257
- callback({
258
- data: details
259
- });
260
- }
261
-
262
- // if parent class NodeDataProvider has cached the network request for the node
263
- // we can skip fetching the data async and updating the session storage cache
264
- if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
265
- return;
266
- }
267
- } else {
268
- if (details) {
269
- callback({
270
- data: details
271
- });
272
- }
253
+ // NAVX-4712: Handle responses with non-resolved statuses that were previously cached
254
+ var isResolvedCachedResponse = details && details.meta && (0, _linkingCommon.getStatus)(details) === 'resolved';
255
+ if (isResolvedCachedResponse) {
256
+ callback({
257
+ data: details
258
+ });
259
+ }
273
260
 
274
- // if parent class NodeDataProvider has cached the network request for the node
275
- // we can skip fetching the data async and updating the session storage cache
276
- var cacheStatus = this.getCacheStatusForNode(jsonNode);
277
- if (cacheStatus === 'network') {
278
- return;
279
- }
261
+ // if parent class NodeDataProvider has cached the network request for the node
262
+ // we can skip fetching the data async and updating the session storage cache
263
+ if (isResolvedCachedResponse && this.getCacheStatusForNode(jsonNode) === 'network') {
264
+ return;
280
265
  }
281
266
 
282
267
  // fetch the latest data async and update the session storage cache
283
268
  this.getDataAsync(node, function (payload) {
284
- if ((0, _expValEquals.expValEquals)('platform_sl_fix_cache_unresolved', 'isEnabled', true)) {
285
- var response = payload.data;
286
- if (!payload.error && response !== null && response !== void 0 && response.meta) {
287
- var status = (0, _linkingCommon.getStatus)(response);
288
- if (status === 'resolved') {
289
- _this2.smartCardLocalCacheClient.setItem(key, response);
290
- }
291
- }
292
- } else {
293
- if (payload.data && !payload.error) {
294
- _this2.smartCardLocalCacheClient.setItem(key, payload.data);
269
+ var response = payload.data;
270
+ if (!payload.error && response !== null && response !== void 0 && response.meta) {
271
+ var status = (0, _linkingCommon.getStatus)(response);
272
+ if (status === 'resolved') {
273
+ _this2.smartCardLocalCacheClient.setItem(key, response);
295
274
  }
296
275
  }
297
276
  callback(payload);
@@ -330,17 +309,17 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
330
309
  value: function () {
331
310
  var _batchProviders = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(keys) {
332
311
  var providersData;
333
- return _regenerator.default.wrap(function _callee$(_context) {
312
+ return _regenerator.default.wrap(function (_context) {
334
313
  while (1) switch (_context.prev = _context.next) {
335
314
  case 0:
336
- _context.next = 2;
315
+ _context.next = 1;
337
316
  return this.fetchProvidersData();
338
- case 2:
317
+ case 1:
339
318
  providersData = _context.sent;
340
319
  return _context.abrupt("return", keys.map(function () {
341
320
  return providersData;
342
321
  }));
343
- case 4:
322
+ case 2:
344
323
  case "end":
345
324
  return _context.stop();
346
325
  }
@@ -355,32 +334,32 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
355
334
  key: "checkLinkResolved",
356
335
  value: function () {
357
336
  var _checkLinkResolved = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resourceUrl) {
358
- var response;
359
- return _regenerator.default.wrap(function _callee2$(_context2) {
337
+ var response, _t;
338
+ return _regenerator.default.wrap(function (_context2) {
360
339
  while (1) switch (_context2.prev = _context2.next) {
361
340
  case 0:
362
341
  _context2.prev = 0;
363
- _context2.next = 3;
342
+ _context2.next = 1;
364
343
  return this.fetchData(resourceUrl);
365
- case 3:
344
+ case 1:
366
345
  response = _context2.sent;
367
346
  if (!((0, _linkingCommon.getStatus)(response) !== 'not_found')) {
368
- _context2.next = 6;
347
+ _context2.next = 2;
369
348
  break;
370
349
  }
371
350
  return _context2.abrupt("return", true);
372
- case 6:
373
- _context2.next = 11;
351
+ case 2:
352
+ _context2.next = 4;
374
353
  break;
375
- case 8:
376
- _context2.prev = 8;
377
- _context2.t0 = _context2["catch"](0);
354
+ case 3:
355
+ _context2.prev = 3;
356
+ _t = _context2["catch"](0);
378
357
  return _context2.abrupt("return", false);
379
- case 11:
358
+ case 4:
380
359
  case "end":
381
360
  return _context2.stop();
382
361
  }
383
- }, _callee2, this, [[0, 8]]);
362
+ }, _callee2, this, [[0, 3]]);
384
363
  }));
385
364
  function checkLinkResolved(_x2) {
386
365
  return _checkLinkResolved.apply(this, arguments);
@@ -391,32 +370,32 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
391
370
  key: "fetchDataForResource",
392
371
  value: function () {
393
372
  var _fetchDataForResource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resourceUrl) {
394
- var response;
395
- return _regenerator.default.wrap(function _callee3$(_context3) {
373
+ var response, _t2;
374
+ return _regenerator.default.wrap(function (_context3) {
396
375
  while (1) switch (_context3.prev = _context3.next) {
397
376
  case 0:
398
377
  _context3.prev = 0;
399
- _context3.next = 3;
378
+ _context3.next = 1;
400
379
  return this.fetchData(resourceUrl);
401
- case 3:
380
+ case 1:
402
381
  response = _context3.sent;
403
382
  if (!((0, _linkingCommon.getStatus)(response) !== 'not_found')) {
404
- _context3.next = 6;
383
+ _context3.next = 2;
405
384
  break;
406
385
  }
407
386
  return _context3.abrupt("return", response);
408
- case 6:
409
- _context3.next = 11;
387
+ case 2:
388
+ _context3.next = 4;
410
389
  break;
411
- case 8:
412
- _context3.prev = 8;
413
- _context3.t0 = _context3["catch"](0);
390
+ case 3:
391
+ _context3.prev = 3;
392
+ _t2 = _context3["catch"](0);
414
393
  return _context3.abrupt("return", undefined);
415
- case 11:
394
+ case 4:
416
395
  case "end":
417
396
  return _context3.stop();
418
397
  }
419
- }, _callee3, this, [[0, 8]]);
398
+ }, _callee3, this, [[0, 3]]);
420
399
  }));
421
400
  function fetchDataForResource(_x3) {
422
401
  return _fetchDataForResource.apply(this, arguments);
@@ -436,13 +415,13 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
436
415
  value: function () {
437
416
  var _fetchProvidersData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
438
417
  var endpoint, response;
439
- return _regenerator.default.wrap(function _callee4$(_context4) {
418
+ return _regenerator.default.wrap(function (_context4) {
440
419
  while (1) switch (_context4.prev = _context4.next) {
441
420
  case 0:
442
421
  endpoint = "".concat(this.resolverUrl, "/providers");
443
- _context4.next = 3;
422
+ _context4.next = 1;
444
423
  return (0, _api.request)('post', endpoint, undefined, this.requestHeaders);
445
- case 3:
424
+ case 1:
446
425
  response = _context4.sent;
447
426
  return _context4.abrupt("return", {
448
427
  patterns: response.providers.reduce(function (allSources, provider) {
@@ -450,7 +429,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
450
429
  }, []),
451
430
  userPreferences: response.userPreferences
452
431
  });
453
- case 5:
432
+ case 2:
454
433
  case "end":
455
434
  return _context4.stop();
456
435
  }
@@ -465,28 +444,29 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
465
444
  key: "loadProviderData",
466
445
  value: function () {
467
446
  var _loadProviderData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
468
- return _regenerator.default.wrap(function _callee5$(_context5) {
447
+ var _t3;
448
+ return _regenerator.default.wrap(function (_context5) {
469
449
  while (1) switch (_context5.prev = _context5.next) {
470
450
  case 0:
471
451
  _context5.prev = 0;
472
- _context5.next = 3;
452
+ _context5.next = 1;
473
453
  return this.providersLoader.load('providersData');
474
- case 3:
454
+ case 1:
475
455
  this.providersData = _context5.sent;
476
- _context5.next = 11;
456
+ _context5.next = 3;
477
457
  break;
478
- case 6:
479
- _context5.prev = 6;
480
- _context5.t0 = _context5["catch"](0);
458
+ case 2:
459
+ _context5.prev = 2;
460
+ _t3 = _context5["catch"](0);
481
461
  // eslint-disable-next-line
482
- console.error('failed to fetch /providers', _context5.t0);
462
+ console.error('failed to fetch /providers', _t3);
483
463
  this.providersLoader.clear('providerData');
484
464
  return _context5.abrupt("return", undefined);
485
- case 11:
465
+ case 3:
486
466
  case "end":
487
467
  return _context5.stop();
488
468
  }
489
- }, _callee5, this, [[0, 6]]);
469
+ }, _callee5, this, [[0, 2]]);
490
470
  }));
491
471
  function loadProviderData() {
492
472
  return _loadProviderData.apply(this, arguments);
@@ -497,24 +477,25 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
497
477
  key: "findPattern",
498
478
  value: function () {
499
479
  var _findPattern = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(url) {
500
- return _regenerator.default.wrap(function _callee6$(_context6) {
480
+ var _t4;
481
+ return _regenerator.default.wrap(function (_context6) {
501
482
  while (1) switch (_context6.prev = _context6.next) {
502
483
  case 0:
503
- _context6.next = 2;
484
+ _context6.next = 1;
504
485
  return this.findPatternData(url);
505
- case 2:
506
- _context6.t0 = !!_context6.sent;
507
- if (_context6.t0) {
508
- _context6.next = 7;
486
+ case 1:
487
+ _t4 = !!_context6.sent;
488
+ if (_t4) {
489
+ _context6.next = 3;
509
490
  break;
510
491
  }
511
- _context6.next = 6;
492
+ _context6.next = 2;
512
493
  return this.checkLinkResolved(url);
513
- case 6:
514
- _context6.t0 = !!_context6.sent;
515
- case 7:
516
- return _context6.abrupt("return", _context6.t0);
517
- case 8:
494
+ case 2:
495
+ _t4 = !!_context6.sent;
496
+ case 3:
497
+ return _context6.abrupt("return", _t4);
498
+ case 4:
518
499
  case "end":
519
500
  return _context6.stop();
520
501
  }
@@ -542,41 +523,41 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
542
523
  var _this$providersData,
543
524
  _this4 = this;
544
525
  var userPreferences, defaultAppearance, appearances, allMatchedLabeledAppearances, longestMatchedLabeledAppearance;
545
- return _regenerator.default.wrap(function _callee7$(_context7) {
526
+ return _regenerator.default.wrap(function (_context7) {
546
527
  while (1) switch (_context7.prev = _context7.next) {
547
528
  case 0:
548
529
  if (this.providersData) {
549
- _context7.next = 3;
530
+ _context7.next = 1;
550
531
  break;
551
532
  }
552
- _context7.next = 3;
533
+ _context7.next = 1;
553
534
  return this.loadProviderData();
554
- case 3:
535
+ case 1:
555
536
  userPreferences = (_this$providersData = this.providersData) === null || _this$providersData === void 0 ? void 0 : _this$providersData.userPreferences;
556
537
  if (!userPreferences) {
557
- _context7.next = 12;
538
+ _context7.next = 3;
558
539
  break;
559
540
  }
560
541
  defaultAppearance = userPreferences.defaultAppearance, appearances = userPreferences.appearances;
561
- allMatchedLabeledAppearances = appearances.filter(function (_ref2) {
562
- var urlSegment = _ref2.urlSegment;
542
+ allMatchedLabeledAppearances = appearances.filter(function (_ref) {
543
+ var urlSegment = _ref.urlSegment;
563
544
  return _this4.doesUrlMatchPath(urlSegment, url);
564
545
  });
565
546
  if (!(allMatchedLabeledAppearances.length > 0)) {
566
- _context7.next = 10;
547
+ _context7.next = 2;
567
548
  break;
568
549
  }
569
550
  longestMatchedLabeledAppearance = allMatchedLabeledAppearances.reduce(function (previousLabeledAppearance, currentLabeledAppearance) {
570
551
  return previousLabeledAppearance.urlSegment.length > currentLabeledAppearance.urlSegment.length ? previousLabeledAppearance : currentLabeledAppearance;
571
552
  });
572
553
  return _context7.abrupt("return", longestMatchedLabeledAppearance.appearance);
573
- case 10:
554
+ case 2:
574
555
  if (!(defaultAppearance !== 'inline')) {
575
- _context7.next = 12;
556
+ _context7.next = 3;
576
557
  break;
577
558
  }
578
559
  return _context7.abrupt("return", defaultAppearance);
579
- case 12:
560
+ case 3:
580
561
  case "end":
581
562
  return _context7.stop();
582
563
  }
@@ -592,20 +573,20 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
592
573
  value: function () {
593
574
  var _findPatternData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url) {
594
575
  var _this$providersData2;
595
- return _regenerator.default.wrap(function _callee8$(_context8) {
576
+ return _regenerator.default.wrap(function (_context8) {
596
577
  while (1) switch (_context8.prev = _context8.next) {
597
578
  case 0:
598
579
  if (this.providersData) {
599
- _context8.next = 3;
580
+ _context8.next = 1;
600
581
  break;
601
582
  }
602
- _context8.next = 3;
583
+ _context8.next = 1;
603
584
  return this.loadProviderData();
604
- case 3:
585
+ case 1:
605
586
  return _context8.abrupt("return", (_this$providersData2 = this.providersData) === null || _this$providersData2 === void 0 ? void 0 : _this$providersData2.patterns.find(function (pattern) {
606
587
  return url.match(pattern.source);
607
588
  }));
608
- case 4:
589
+ case 2:
609
590
  case "end":
610
591
  return _context8.stop();
611
592
  }
@@ -644,10 +625,10 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
644
625
  key: "fetchData",
645
626
  value: function () {
646
627
  var _fetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
647
- return _regenerator.default.wrap(function _callee9$(_context9) {
628
+ return _regenerator.default.wrap(function (_context9) {
648
629
  while (1) switch (_context9.prev = _context9.next) {
649
630
  case 0:
650
- _context9.next = 2;
631
+ _context9.next = 1;
651
632
  return this.getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS({
652
633
  // It's ok to cast any resourceUrl to inlineCard here, because only URL is important for the request.
653
634
  type: 'inlineCard',
@@ -655,9 +636,9 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
655
636
  url: url
656
637
  }
657
638
  });
658
- case 2:
639
+ case 1:
659
640
  return _context9.abrupt("return", _context9.sent);
660
- case 3:
641
+ case 2:
661
642
  case "end":
662
643
  return _context9.stop();
663
644
  }
@@ -675,38 +656,38 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
675
656
  key: "canBeResolvedAsEmbed",
676
657
  value: (function () {
677
658
  var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(url) {
678
- var details, embed;
679
- return _regenerator.default.wrap(function _callee0$(_context0) {
659
+ var details, embed, _t5;
660
+ return _regenerator.default.wrap(function (_context0) {
680
661
  while (1) switch (_context0.prev = _context0.next) {
681
662
  case 0:
682
663
  _context0.prev = 0;
683
- _context0.next = 3;
664
+ _context0.next = 1;
684
665
  return this.fetchData(url);
685
- case 3:
666
+ case 1:
686
667
  details = _context0.sent;
687
668
  if (details) {
688
- _context0.next = 6;
669
+ _context0.next = 2;
689
670
  break;
690
671
  }
691
672
  return _context0.abrupt("return", false);
692
- case 6:
673
+ case 2:
693
674
  if (!((0, _linkingCommon.getStatus)(details) !== 'resolved')) {
694
- _context0.next = 8;
675
+ _context0.next = 3;
695
676
  break;
696
677
  }
697
678
  return _context0.abrupt("return", false);
698
- case 8:
679
+ case 3:
699
680
  embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
700
681
  return _context0.abrupt("return", !!embed);
701
- case 12:
702
- _context0.prev = 12;
703
- _context0.t0 = _context0["catch"](0);
682
+ case 4:
683
+ _context0.prev = 4;
684
+ _t5 = _context0["catch"](0);
704
685
  return _context0.abrupt("return", false);
705
- case 15:
686
+ case 5:
706
687
  case "end":
707
688
  return _context0.stop();
708
689
  }
709
- }, _callee0, this, [[0, 12]]);
690
+ }, _callee0, this, [[0, 4]]);
710
691
  }));
711
692
  function canBeResolvedAsEmbed(_x8) {
712
693
  return _canBeResolvedAsEmbed.apply(this, arguments);
@@ -717,14 +698,14 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
717
698
  key: "getAuthStatusFromResolveResponse",
718
699
  value: function () {
719
700
  var _getAuthStatusFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee1(url) {
720
- var _yield$this$fetchData, _yield$this$fetchData2, access, visibility;
721
- return _regenerator.default.wrap(function _callee1$(_context1) {
701
+ var _yield$this$fetchData, _yield$this$fetchData2, access, visibility, _t6;
702
+ return _regenerator.default.wrap(function (_context1) {
722
703
  while (1) switch (_context1.prev = _context1.next) {
723
704
  case 0:
724
705
  _context1.prev = 0;
725
- _context1.next = 3;
706
+ _context1.next = 1;
726
707
  return this.fetchData(url);
727
- case 3:
708
+ case 1:
728
709
  _yield$this$fetchData = _context1.sent;
729
710
  _yield$this$fetchData2 = _yield$this$fetchData.meta;
730
711
  access = _yield$this$fetchData2.access;
@@ -733,15 +714,15 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
733
714
  access: access,
734
715
  visibility: visibility
735
716
  });
736
- case 10:
737
- _context1.prev = 10;
738
- _context1.t0 = _context1["catch"](0);
717
+ case 2:
718
+ _context1.prev = 2;
719
+ _t6 = _context1["catch"](0);
739
720
  return _context1.abrupt("return", undefined);
740
- case 13:
721
+ case 3:
741
722
  case "end":
742
723
  return _context1.stop();
743
724
  }
744
- }, _callee1, this, [[0, 10]]);
725
+ }, _callee1, this, [[0, 2]]);
745
726
  }));
746
727
  function getAuthStatusFromResolveResponse(_x9) {
747
728
  return _getAuthStatusFromResolveResponse.apply(this, arguments);
@@ -755,33 +736,33 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
755
736
  key: "getDatasourceFromResolveResponse",
756
737
  value: (function () {
757
738
  var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(url) {
758
- var response, datasources;
759
- return _regenerator.default.wrap(function _callee10$(_context10) {
739
+ var response, datasources, _t7;
740
+ return _regenerator.default.wrap(function (_context10) {
760
741
  while (1) switch (_context10.prev = _context10.next) {
761
742
  case 0:
762
743
  _context10.prev = 0;
763
- _context10.next = 3;
744
+ _context10.next = 1;
764
745
  return this.fetchData(url);
765
- case 3:
746
+ case 1:
766
747
  response = _context10.sent;
767
748
  datasources = response && response.datasources || [];
768
749
  if (!(datasources.length > 0)) {
769
- _context10.next = 7;
750
+ _context10.next = 2;
770
751
  break;
771
752
  }
772
753
  return _context10.abrupt("return", datasources[0]);
773
- case 7:
774
- _context10.next = 12;
754
+ case 2:
755
+ _context10.next = 4;
775
756
  break;
776
- case 9:
777
- _context10.prev = 9;
778
- _context10.t0 = _context10["catch"](0);
757
+ case 3:
758
+ _context10.prev = 3;
759
+ _t7 = _context10["catch"](0);
779
760
  return _context10.abrupt("return", undefined);
780
- case 12:
761
+ case 4:
781
762
  case "end":
782
763
  return _context10.stop();
783
764
  }
784
- }, _callee10, this, [[0, 9]]);
765
+ }, _callee10, this, [[0, 3]]);
785
766
  }));
786
767
  function getDatasourceFromResolveResponse(_x0) {
787
768
  return _getDatasourceFromResolveResponse.apply(this, arguments);
@@ -801,36 +782,36 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
801
782
  key: "resolve",
802
783
  value: function () {
803
784
  var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
804
- var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, datasource, id, parameters, authStatus, access;
805
- return _regenerator.default.wrap(function _callee11$(_context11) {
785
+ var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, datasource, id, parameters, authStatus, access, _t8, _t9;
786
+ return _regenerator.default.wrap(function (_context11) {
806
787
  while (1) switch (_context11.prev = _context11.next) {
807
788
  case 0:
808
789
  _context11.prev = 0;
809
790
  if (!(shouldForceAppearance === true)) {
810
- _context11.next = 3;
791
+ _context11.next = 1;
811
792
  break;
812
793
  }
813
794
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, appearance));
814
- case 3:
795
+ case 1:
815
796
  hardCodedAppearance = this.getHardCodedAppearance(url);
816
- _context11.next = 6;
797
+ _context11.next = 2;
817
798
  return Promise.all([this.findPatternData(url), this.findUserPreference(url)]);
818
- case 6:
799
+ case 2:
819
800
  _yield$Promise$all = _context11.sent;
820
801
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
821
802
  matchedProviderPattern = _yield$Promise$all2[0];
822
803
  userPreference = _yield$Promise$all2[1];
823
804
  if (!(0, _platformFeatureFlags.fg)('issue-link-suggestions-in-comments')) {
824
- _context11.next = 16;
805
+ _context11.next = 4;
825
806
  break;
826
807
  }
827
808
  if (!(isJiraWorkItem(url) && this.isLocalUrl(url))) {
828
- _context11.next = 16;
809
+ _context11.next = 4;
829
810
  break;
830
811
  }
831
- _context11.next = 14;
812
+ _context11.next = 3;
832
813
  return this.fetchDataForResource(url);
833
- case 14:
814
+ case 3:
834
815
  data = _context11.sent;
835
816
  if (data) {
836
817
  issueAri = this.extractAriFromData(data);
@@ -838,26 +819,26 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
838
819
  (_this$onResolve = this.onResolve) === null || _this$onResolve === void 0 || _this$onResolve.call(this, url, issueAri);
839
820
  }
840
821
  }
841
- case 16:
822
+ case 4:
842
823
  if (!(shouldForceAppearance === false && userPreference === 'url')) {
843
- _context11.next = 18;
824
+ _context11.next = 5;
844
825
  break;
845
826
  }
846
827
  return _context11.abrupt("return", Promise.reject(undefined));
847
- case 18:
848
- _context11.t0 = !!matchedProviderPattern;
849
- if (_context11.t0) {
850
- _context11.next = 23;
828
+ case 5:
829
+ _t8 = !!matchedProviderPattern;
830
+ if (_t8) {
831
+ _context11.next = 7;
851
832
  break;
852
833
  }
853
- _context11.next = 22;
834
+ _context11.next = 6;
854
835
  return this.checkLinkResolved(url);
855
- case 22:
856
- _context11.t0 = _context11.sent;
857
- case 23:
858
- isSupported = _context11.t0;
836
+ case 6:
837
+ _t8 = _context11.sent;
838
+ case 7:
839
+ isSupported = _t8;
859
840
  if (!isSupported) {
860
- _context11.next = 48;
841
+ _context11.next = 14;
861
842
  break;
862
843
  }
863
844
  providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
@@ -876,23 +857,23 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
876
857
  // If not, we pick what editor (or any other client) requested
877
858
  appearance;
878
859
  if (!(preferredAppearance === userPreference && userPreference === 'embed')) {
879
- _context11.next = 33;
860
+ _context11.next = 9;
880
861
  break;
881
862
  }
882
- _context11.next = 31;
863
+ _context11.next = 8;
883
864
  return this.canBeResolvedAsEmbed(url);
884
- case 31:
865
+ case 8:
885
866
  canItBeEmbed = _context11.sent;
886
867
  if (!canItBeEmbed) {
887
868
  preferredAppearance = 'inline';
888
869
  }
889
- case 33:
890
- _context11.next = 35;
870
+ case 9:
871
+ _context11.next = 10;
891
872
  return this.getDatasourceFromResolveResponse(url);
892
- case 35:
873
+ case 10:
893
874
  datasource = _context11.sent;
894
875
  if (!datasource) {
895
- _context11.next = 39;
876
+ _context11.next = 11;
896
877
  break;
897
878
  }
898
879
  id = datasource.id, parameters = datasource.parameters;
@@ -905,42 +886,42 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
905
886
  type: 'table'
906
887
  }]
907
888
  }, url));
908
- case 39:
889
+ case 11:
909
890
  if (!(isEmbedFriendlyLocationEvaluated && !userPreference)) {
910
- _context11.next = 47;
891
+ _context11.next = 13;
911
892
  break;
912
893
  }
913
- _context11.next = 42;
894
+ _context11.next = 12;
914
895
  return this.getAuthStatusFromResolveResponse(url);
915
- case 42:
896
+ case 12:
916
897
  authStatus = _context11.sent;
917
898
  if (!authStatus) {
918
- _context11.next = 47;
899
+ _context11.next = 13;
919
900
  break;
920
901
  }
921
902
  access = authStatus.access;
922
903
  if (!(access === 'unauthorized')) {
923
- _context11.next = 47;
904
+ _context11.next = 13;
924
905
  break;
925
906
  }
926
907
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, 'block'));
927
- case 47:
908
+ case 13:
928
909
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
929
- case 48:
930
- _context11.next = 53;
910
+ case 14:
911
+ _context11.next = 16;
931
912
  break;
932
- case 50:
933
- _context11.prev = 50;
934
- _context11.t1 = _context11["catch"](0);
913
+ case 15:
914
+ _context11.prev = 15;
915
+ _t9 = _context11["catch"](0);
935
916
  // eslint-disable-next-line
936
- console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_context11.t1 instanceof Error ? " - ".concat(_context11.t1.name, " ").concat(_context11.t1.message) : ''), _context11.t1);
937
- case 53:
917
+ console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_t9 instanceof Error ? " - ".concat(_t9.name, " ").concat(_t9.message) : ''), _t9);
918
+ case 16:
938
919
  return _context11.abrupt("return", Promise.reject(undefined));
939
- case 54:
920
+ case 17:
940
921
  case "end":
941
922
  return _context11.stop();
942
923
  }
943
- }, _callee11, this, [[0, 50]]);
924
+ }, _callee11, this, [[0, 15]]);
944
925
  }));
945
926
  function resolve(_x1, _x10, _x11, _x12) {
946
927
  return _resolve.apply(this, arguments);