@atlaskit/editor-card-provider 6.1.1 → 6.2.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 +11 -0
- package/dist/cjs/provider.js +205 -177
- package/dist/es2019/provider.js +53 -37
- package/dist/esm/provider.js +205 -177
- package/dist/types/provider.d.ts +2 -0
- package/dist/types-ts4.5/provider.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-card-provider
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ee7dfc1442426`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee7dfc1442426) -
|
|
8
|
+
[ux] Make 3P Unauthenticated links pasted on a new line to convert to block card
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 6.1.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/cjs/provider.js
CHANGED
|
@@ -18,6 +18,7 @@ var _setPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/se
|
|
|
18
18
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
19
19
|
var _nodeDataProvider = require("@atlaskit/node-data-provider");
|
|
20
20
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
21
22
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
22
23
|
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
23
24
|
var _transformer = require("./transformer");
|
|
@@ -216,45 +217,27 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
216
217
|
while (1) switch (_context2.prev = _context2.next) {
|
|
217
218
|
case 0:
|
|
218
219
|
_context2.prev = 0;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
_context2.next = 4;
|
|
224
|
-
return this.getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS({
|
|
225
|
-
type: 'inlineCard',
|
|
226
|
-
attrs: {
|
|
227
|
-
url: resourceUrl
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
case 4:
|
|
231
|
-
_context2.t0 = _context2.sent;
|
|
232
|
-
_context2.next = 10;
|
|
233
|
-
break;
|
|
234
|
-
case 7:
|
|
235
|
-
_context2.next = 9;
|
|
236
|
-
return this.cardClient.fetchData(resourceUrl);
|
|
237
|
-
case 9:
|
|
238
|
-
_context2.t0 = _context2.sent;
|
|
239
|
-
case 10:
|
|
240
|
-
response = _context2.t0;
|
|
220
|
+
_context2.next = 3;
|
|
221
|
+
return this.fetchData(resourceUrl);
|
|
222
|
+
case 3:
|
|
223
|
+
response = _context2.sent;
|
|
241
224
|
if (!((0, _linkingCommon.getStatus)(response) !== 'not_found')) {
|
|
242
|
-
_context2.next =
|
|
225
|
+
_context2.next = 6;
|
|
243
226
|
break;
|
|
244
227
|
}
|
|
245
228
|
return _context2.abrupt("return", true);
|
|
246
|
-
case
|
|
247
|
-
_context2.next =
|
|
229
|
+
case 6:
|
|
230
|
+
_context2.next = 11;
|
|
248
231
|
break;
|
|
249
|
-
case
|
|
250
|
-
_context2.prev =
|
|
251
|
-
_context2.
|
|
232
|
+
case 8:
|
|
233
|
+
_context2.prev = 8;
|
|
234
|
+
_context2.t0 = _context2["catch"](0);
|
|
252
235
|
return _context2.abrupt("return", false);
|
|
253
|
-
case
|
|
236
|
+
case 11:
|
|
254
237
|
case "end":
|
|
255
238
|
return _context2.stop();
|
|
256
239
|
}
|
|
257
|
-
}, _callee2, this, [[0,
|
|
240
|
+
}, _callee2, this, [[0, 8]]);
|
|
258
241
|
}));
|
|
259
242
|
function checkLinkResolved(_x2) {
|
|
260
243
|
return _checkLinkResolved.apply(this, arguments);
|
|
@@ -270,45 +253,27 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
270
253
|
while (1) switch (_context3.prev = _context3.next) {
|
|
271
254
|
case 0:
|
|
272
255
|
_context3.prev = 0;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
_context3.next = 4;
|
|
278
|
-
return this.getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS({
|
|
279
|
-
type: 'inlineCard',
|
|
280
|
-
attrs: {
|
|
281
|
-
url: resourceUrl
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
case 4:
|
|
285
|
-
_context3.t0 = _context3.sent;
|
|
286
|
-
_context3.next = 10;
|
|
287
|
-
break;
|
|
288
|
-
case 7:
|
|
289
|
-
_context3.next = 9;
|
|
290
|
-
return this.cardClient.fetchData(resourceUrl);
|
|
291
|
-
case 9:
|
|
292
|
-
_context3.t0 = _context3.sent;
|
|
293
|
-
case 10:
|
|
294
|
-
response = _context3.t0;
|
|
256
|
+
_context3.next = 3;
|
|
257
|
+
return this.fetchData(resourceUrl);
|
|
258
|
+
case 3:
|
|
259
|
+
response = _context3.sent;
|
|
295
260
|
if (!((0, _linkingCommon.getStatus)(response) !== 'not_found')) {
|
|
296
|
-
_context3.next =
|
|
261
|
+
_context3.next = 6;
|
|
297
262
|
break;
|
|
298
263
|
}
|
|
299
264
|
return _context3.abrupt("return", response);
|
|
300
|
-
case
|
|
301
|
-
_context3.next =
|
|
265
|
+
case 6:
|
|
266
|
+
_context3.next = 11;
|
|
302
267
|
break;
|
|
303
|
-
case
|
|
304
|
-
_context3.prev =
|
|
305
|
-
_context3.
|
|
268
|
+
case 8:
|
|
269
|
+
_context3.prev = 8;
|
|
270
|
+
_context3.t0 = _context3["catch"](0);
|
|
306
271
|
return _context3.abrupt("return", undefined);
|
|
307
|
-
case
|
|
272
|
+
case 11:
|
|
308
273
|
case "end":
|
|
309
274
|
return _context3.stop();
|
|
310
275
|
}
|
|
311
|
-
}, _callee3, this, [[0,
|
|
276
|
+
}, _callee3, this, [[0, 8]]);
|
|
312
277
|
}));
|
|
313
278
|
function fetchDataForResource(_x3) {
|
|
314
279
|
return _fetchDataForResource.apply(this, arguments);
|
|
@@ -535,125 +500,162 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
535
500
|
return 'embed';
|
|
536
501
|
}
|
|
537
502
|
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Make a /resolve call and find out if result has embed capability
|
|
541
|
-
*/
|
|
542
503
|
}, {
|
|
543
|
-
key: "
|
|
544
|
-
value:
|
|
545
|
-
var
|
|
546
|
-
var details, embed;
|
|
504
|
+
key: "fetchData",
|
|
505
|
+
value: function () {
|
|
506
|
+
var _fetchData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url) {
|
|
547
507
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
548
508
|
while (1) switch (_context9.prev = _context9.next) {
|
|
549
509
|
case 0:
|
|
550
|
-
_context9.prev = 0;
|
|
551
510
|
if (!(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
552
|
-
_context9.next =
|
|
511
|
+
_context9.next = 6;
|
|
553
512
|
break;
|
|
554
513
|
}
|
|
555
|
-
_context9.next =
|
|
514
|
+
_context9.next = 3;
|
|
556
515
|
return this.getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS({
|
|
557
516
|
type: 'inlineCard',
|
|
558
517
|
attrs: {
|
|
559
518
|
url: url
|
|
560
519
|
}
|
|
561
520
|
});
|
|
562
|
-
case
|
|
521
|
+
case 3:
|
|
563
522
|
_context9.t0 = _context9.sent;
|
|
564
|
-
_context9.next = 10;
|
|
565
|
-
break;
|
|
566
|
-
case 7:
|
|
567
523
|
_context9.next = 9;
|
|
524
|
+
break;
|
|
525
|
+
case 6:
|
|
526
|
+
_context9.next = 8;
|
|
568
527
|
return this.cardClient.fetchData(url);
|
|
569
|
-
case
|
|
528
|
+
case 8:
|
|
570
529
|
_context9.t0 = _context9.sent;
|
|
530
|
+
case 9:
|
|
531
|
+
return _context9.abrupt("return", _context9.t0);
|
|
571
532
|
case 10:
|
|
572
|
-
|
|
533
|
+
case "end":
|
|
534
|
+
return _context9.stop();
|
|
535
|
+
}
|
|
536
|
+
}, _callee9, this);
|
|
537
|
+
}));
|
|
538
|
+
function fetchData(_x7) {
|
|
539
|
+
return _fetchData.apply(this, arguments);
|
|
540
|
+
}
|
|
541
|
+
return fetchData;
|
|
542
|
+
}()
|
|
543
|
+
/**
|
|
544
|
+
* Make a /resolve call and find out if result has embed capability
|
|
545
|
+
*/
|
|
546
|
+
}, {
|
|
547
|
+
key: "canBeResolvedAsEmbed",
|
|
548
|
+
value: (function () {
|
|
549
|
+
var _canBeResolvedAsEmbed = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(url) {
|
|
550
|
+
var details, embed;
|
|
551
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
552
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
553
|
+
case 0:
|
|
554
|
+
_context0.prev = 0;
|
|
555
|
+
_context0.next = 3;
|
|
556
|
+
return this.fetchData(url);
|
|
557
|
+
case 3:
|
|
558
|
+
details = _context0.sent;
|
|
573
559
|
if (details) {
|
|
574
|
-
|
|
560
|
+
_context0.next = 6;
|
|
575
561
|
break;
|
|
576
562
|
}
|
|
577
|
-
return
|
|
578
|
-
case
|
|
563
|
+
return _context0.abrupt("return", false);
|
|
564
|
+
case 6:
|
|
579
565
|
if (!((0, _linkingCommon.getStatus)(details) !== 'resolved')) {
|
|
580
|
-
|
|
566
|
+
_context0.next = 8;
|
|
581
567
|
break;
|
|
582
568
|
}
|
|
583
|
-
return
|
|
584
|
-
case
|
|
569
|
+
return _context0.abrupt("return", false);
|
|
570
|
+
case 8:
|
|
585
571
|
embed = (0, _linkExtractors.extractSmartLinkEmbed)(details);
|
|
586
|
-
return
|
|
587
|
-
case
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
return
|
|
591
|
-
case
|
|
572
|
+
return _context0.abrupt("return", !!embed);
|
|
573
|
+
case 12:
|
|
574
|
+
_context0.prev = 12;
|
|
575
|
+
_context0.t0 = _context0["catch"](0);
|
|
576
|
+
return _context0.abrupt("return", false);
|
|
577
|
+
case 15:
|
|
592
578
|
case "end":
|
|
593
|
-
return
|
|
579
|
+
return _context0.stop();
|
|
594
580
|
}
|
|
595
|
-
},
|
|
581
|
+
}, _callee0, this, [[0, 12]]);
|
|
596
582
|
}));
|
|
597
|
-
function canBeResolvedAsEmbed(
|
|
583
|
+
function canBeResolvedAsEmbed(_x8) {
|
|
598
584
|
return _canBeResolvedAsEmbed.apply(this, arguments);
|
|
599
585
|
}
|
|
600
586
|
return canBeResolvedAsEmbed;
|
|
587
|
+
}())
|
|
588
|
+
}, {
|
|
589
|
+
key: "getAuthStatusFromResolveResponse",
|
|
590
|
+
value: function () {
|
|
591
|
+
var _getAuthStatusFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee1(url) {
|
|
592
|
+
var _yield$this$fetchData, _yield$this$fetchData2, access, visibility;
|
|
593
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
594
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
595
|
+
case 0:
|
|
596
|
+
_context1.prev = 0;
|
|
597
|
+
_context1.next = 3;
|
|
598
|
+
return this.fetchData(url);
|
|
599
|
+
case 3:
|
|
600
|
+
_yield$this$fetchData = _context1.sent;
|
|
601
|
+
_yield$this$fetchData2 = _yield$this$fetchData.meta;
|
|
602
|
+
access = _yield$this$fetchData2.access;
|
|
603
|
+
visibility = _yield$this$fetchData2.visibility;
|
|
604
|
+
return _context1.abrupt("return", {
|
|
605
|
+
access: access,
|
|
606
|
+
visibility: visibility
|
|
607
|
+
});
|
|
608
|
+
case 10:
|
|
609
|
+
_context1.prev = 10;
|
|
610
|
+
_context1.t0 = _context1["catch"](0);
|
|
611
|
+
return _context1.abrupt("return", undefined);
|
|
612
|
+
case 13:
|
|
613
|
+
case "end":
|
|
614
|
+
return _context1.stop();
|
|
615
|
+
}
|
|
616
|
+
}, _callee1, this, [[0, 10]]);
|
|
617
|
+
}));
|
|
618
|
+
function getAuthStatusFromResolveResponse(_x9) {
|
|
619
|
+
return _getAuthStatusFromResolveResponse.apply(this, arguments);
|
|
620
|
+
}
|
|
621
|
+
return getAuthStatusFromResolveResponse;
|
|
601
622
|
}()
|
|
602
623
|
/**
|
|
603
624
|
* Make a /resolve call and find out if result has datasource capability
|
|
604
625
|
*/
|
|
605
|
-
)
|
|
606
626
|
}, {
|
|
607
627
|
key: "getDatasourceFromResolveResponse",
|
|
608
628
|
value: (function () {
|
|
609
|
-
var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
629
|
+
var _getDatasourceFromResolveResponse = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(url) {
|
|
610
630
|
var response, datasources;
|
|
611
|
-
return _regenerator.default.wrap(function
|
|
612
|
-
while (1) switch (
|
|
631
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
632
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
613
633
|
case 0:
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
_context0.next = 4;
|
|
620
|
-
return this.getDataAsPromise_DO_NOT_USE_OUTSIDE_MIGRATIONS({
|
|
621
|
-
type: 'inlineCard',
|
|
622
|
-
attrs: {
|
|
623
|
-
url: url
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
case 4:
|
|
627
|
-
_context0.t0 = _context0.sent;
|
|
628
|
-
_context0.next = 10;
|
|
629
|
-
break;
|
|
630
|
-
case 7:
|
|
631
|
-
_context0.next = 9;
|
|
632
|
-
return this.cardClient.fetchData(url);
|
|
633
|
-
case 9:
|
|
634
|
-
_context0.t0 = _context0.sent;
|
|
635
|
-
case 10:
|
|
636
|
-
response = _context0.t0;
|
|
634
|
+
_context10.prev = 0;
|
|
635
|
+
_context10.next = 3;
|
|
636
|
+
return this.fetchData(url);
|
|
637
|
+
case 3:
|
|
638
|
+
response = _context10.sent;
|
|
637
639
|
datasources = response && response.datasources || [];
|
|
638
640
|
if (!(datasources.length > 0)) {
|
|
639
|
-
|
|
641
|
+
_context10.next = 7;
|
|
640
642
|
break;
|
|
641
643
|
}
|
|
642
|
-
return
|
|
643
|
-
case
|
|
644
|
-
|
|
644
|
+
return _context10.abrupt("return", datasources[0]);
|
|
645
|
+
case 7:
|
|
646
|
+
_context10.next = 12;
|
|
645
647
|
break;
|
|
646
|
-
case
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return
|
|
650
|
-
case
|
|
648
|
+
case 9:
|
|
649
|
+
_context10.prev = 9;
|
|
650
|
+
_context10.t0 = _context10["catch"](0);
|
|
651
|
+
return _context10.abrupt("return", undefined);
|
|
652
|
+
case 12:
|
|
651
653
|
case "end":
|
|
652
|
-
return
|
|
654
|
+
return _context10.stop();
|
|
653
655
|
}
|
|
654
|
-
},
|
|
656
|
+
}, _callee10, this, [[0, 9]]);
|
|
655
657
|
}));
|
|
656
|
-
function getDatasourceFromResolveResponse(
|
|
658
|
+
function getDatasourceFromResolveResponse(_x0) {
|
|
657
659
|
return _getDatasourceFromResolveResponse.apply(this, arguments);
|
|
658
660
|
}
|
|
659
661
|
return getDatasourceFromResolveResponse;
|
|
@@ -670,38 +672,38 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
670
672
|
}, {
|
|
671
673
|
key: "resolve",
|
|
672
674
|
value: function () {
|
|
673
|
-
var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
674
|
-
var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, preferredAppearance, canItBeEmbed, datasource, id, parameters;
|
|
675
|
-
return _regenerator.default.wrap(function
|
|
676
|
-
while (1) switch (
|
|
675
|
+
var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
|
|
676
|
+
var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, datasource, id, parameters, isUnauthPasteAsBlockCardEnabledNoExposure, authStatus, access, isUnauthPasteAsBlockCardEnabled;
|
|
677
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
678
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
677
679
|
case 0:
|
|
678
|
-
|
|
680
|
+
_context11.prev = 0;
|
|
679
681
|
if (!(shouldForceAppearance === true)) {
|
|
680
|
-
|
|
682
|
+
_context11.next = 3;
|
|
681
683
|
break;
|
|
682
684
|
}
|
|
683
|
-
return
|
|
685
|
+
return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, appearance));
|
|
684
686
|
case 3:
|
|
685
687
|
hardCodedAppearance = this.getHardCodedAppearance(url);
|
|
686
|
-
|
|
688
|
+
_context11.next = 6;
|
|
687
689
|
return Promise.all([this.findPatternData(url), this.findUserPreference(url)]);
|
|
688
690
|
case 6:
|
|
689
|
-
_yield$Promise$all =
|
|
691
|
+
_yield$Promise$all = _context11.sent;
|
|
690
692
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
|
|
691
693
|
matchedProviderPattern = _yield$Promise$all2[0];
|
|
692
694
|
userPreference = _yield$Promise$all2[1];
|
|
693
695
|
if (!(0, _platformFeatureFlags.fg)('issue-link-suggestions-in-comments')) {
|
|
694
|
-
|
|
696
|
+
_context11.next = 16;
|
|
695
697
|
break;
|
|
696
698
|
}
|
|
697
699
|
if (!(isJiraWorkItem(url) && this.isLocalUrl(url))) {
|
|
698
|
-
|
|
700
|
+
_context11.next = 16;
|
|
699
701
|
break;
|
|
700
702
|
}
|
|
701
|
-
|
|
703
|
+
_context11.next = 14;
|
|
702
704
|
return this.fetchDataForResource(url);
|
|
703
705
|
case 14:
|
|
704
|
-
data =
|
|
706
|
+
data = _context11.sent;
|
|
705
707
|
if (data) {
|
|
706
708
|
issueAri = this.extractAriFromData(data);
|
|
707
709
|
if (issueAri) {
|
|
@@ -710,27 +712,28 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
710
712
|
}
|
|
711
713
|
case 16:
|
|
712
714
|
if (!(shouldForceAppearance === false && userPreference === 'url')) {
|
|
713
|
-
|
|
715
|
+
_context11.next = 18;
|
|
714
716
|
break;
|
|
715
717
|
}
|
|
716
|
-
return
|
|
718
|
+
return _context11.abrupt("return", Promise.reject(undefined));
|
|
717
719
|
case 18:
|
|
718
|
-
|
|
719
|
-
if (
|
|
720
|
-
|
|
720
|
+
_context11.t0 = !!matchedProviderPattern;
|
|
721
|
+
if (_context11.t0) {
|
|
722
|
+
_context11.next = 23;
|
|
721
723
|
break;
|
|
722
724
|
}
|
|
723
|
-
|
|
725
|
+
_context11.next = 22;
|
|
724
726
|
return this.checkLinkResolved(url);
|
|
725
727
|
case 22:
|
|
726
|
-
|
|
728
|
+
_context11.t0 = _context11.sent;
|
|
727
729
|
case 23:
|
|
728
|
-
isSupported =
|
|
730
|
+
isSupported = _context11.t0;
|
|
729
731
|
if (!isSupported) {
|
|
730
|
-
|
|
732
|
+
_context11.next = 51;
|
|
731
733
|
break;
|
|
732
734
|
}
|
|
733
735
|
providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
|
|
736
|
+
isEmbedFriendlyLocationEvaluated = isEmbedFriendlyLocation || isEmbedFriendlyLocation === undefined;
|
|
734
737
|
preferredAppearance = shouldForceAppearance === undefined ?
|
|
735
738
|
// Ignore both User and provider's appearances if older editor that doesn't send shouldForceAppearance
|
|
736
739
|
hardCodedAppearance || appearance :
|
|
@@ -739,33 +742,33 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
739
742
|
userPreference ||
|
|
740
743
|
// If user's default choice is "inline" or user hasn't specified preferences at all,
|
|
741
744
|
// we check whatever one of the hardcoded providers match url (jira /timeline, polaris, etc)
|
|
742
|
-
|
|
745
|
+
isEmbedFriendlyLocationEvaluated && hardCodedAppearance ||
|
|
743
746
|
// If non match, we see if this provider has default appearance for this particular regexp
|
|
744
747
|
providerDefaultAppearance ||
|
|
745
748
|
// If not, we pick what editor (or any other client) requested
|
|
746
749
|
appearance;
|
|
747
750
|
if (!(preferredAppearance === userPreference && userPreference === 'embed')) {
|
|
748
|
-
|
|
751
|
+
_context11.next = 33;
|
|
749
752
|
break;
|
|
750
753
|
}
|
|
751
|
-
|
|
754
|
+
_context11.next = 31;
|
|
752
755
|
return this.canBeResolvedAsEmbed(url);
|
|
753
|
-
case
|
|
754
|
-
canItBeEmbed =
|
|
756
|
+
case 31:
|
|
757
|
+
canItBeEmbed = _context11.sent;
|
|
755
758
|
if (!canItBeEmbed) {
|
|
756
759
|
preferredAppearance = 'inline';
|
|
757
760
|
}
|
|
758
|
-
case
|
|
759
|
-
|
|
761
|
+
case 33:
|
|
762
|
+
_context11.next = 35;
|
|
760
763
|
return this.getDatasourceFromResolveResponse(url);
|
|
761
|
-
case
|
|
762
|
-
datasource =
|
|
764
|
+
case 35:
|
|
765
|
+
datasource = _context11.sent;
|
|
763
766
|
if (!datasource) {
|
|
764
|
-
|
|
767
|
+
_context11.next = 39;
|
|
765
768
|
break;
|
|
766
769
|
}
|
|
767
770
|
id = datasource.id, parameters = datasource.parameters;
|
|
768
|
-
return
|
|
771
|
+
return _context11.abrupt("return", this.transformer.toDatasourceAdf({
|
|
769
772
|
id: id,
|
|
770
773
|
parameters: parameters,
|
|
771
774
|
// in the future when we support multiple views, we will need to pass this in as a parameter
|
|
@@ -774,25 +777,50 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
774
777
|
type: 'table'
|
|
775
778
|
}]
|
|
776
779
|
}, url));
|
|
777
|
-
case 38:
|
|
778
|
-
return _context1.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
|
|
779
780
|
case 39:
|
|
780
|
-
|
|
781
|
+
isUnauthPasteAsBlockCardEnabledNoExposure = !(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_sl_3p_unauth_paste_as_block_card', 'cohort', 'control', 'control');
|
|
782
|
+
if (!(isUnauthPasteAsBlockCardEnabledNoExposure && isEmbedFriendlyLocationEvaluated && !userPreference)) {
|
|
783
|
+
_context11.next = 50;
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
_context11.next = 43;
|
|
787
|
+
return this.getAuthStatusFromResolveResponse(url);
|
|
788
|
+
case 43:
|
|
789
|
+
authStatus = _context11.sent;
|
|
790
|
+
if (!authStatus) {
|
|
791
|
+
_context11.next = 50;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
access = authStatus.access;
|
|
795
|
+
if (!(access === 'unauthorized')) {
|
|
796
|
+
_context11.next = 50;
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
isUnauthPasteAsBlockCardEnabled = !(0, _expValEquals.expValEquals)('platform_sl_3p_unauth_paste_as_block_card', 'cohort', 'control', 'control');
|
|
800
|
+
if (!isUnauthPasteAsBlockCardEnabled) {
|
|
801
|
+
_context11.next = 50;
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, 'block'));
|
|
805
|
+
case 50:
|
|
806
|
+
return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
|
|
807
|
+
case 51:
|
|
808
|
+
_context11.next = 56;
|
|
781
809
|
break;
|
|
782
|
-
case
|
|
783
|
-
|
|
784
|
-
|
|
810
|
+
case 53:
|
|
811
|
+
_context11.prev = 53;
|
|
812
|
+
_context11.t1 = _context11["catch"](0);
|
|
785
813
|
// eslint-disable-next-line
|
|
786
|
-
console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(
|
|
787
|
-
case
|
|
788
|
-
return
|
|
789
|
-
case
|
|
814
|
+
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);
|
|
815
|
+
case 56:
|
|
816
|
+
return _context11.abrupt("return", Promise.reject(undefined));
|
|
817
|
+
case 57:
|
|
790
818
|
case "end":
|
|
791
|
-
return
|
|
819
|
+
return _context11.stop();
|
|
792
820
|
}
|
|
793
|
-
},
|
|
821
|
+
}, _callee11, this, [[0, 53]]);
|
|
794
822
|
}));
|
|
795
|
-
function resolve(
|
|
823
|
+
function resolve(_x1, _x10, _x11, _x12) {
|
|
796
824
|
return _resolve.apply(this, arguments);
|
|
797
825
|
}
|
|
798
826
|
return resolve;
|