@atlaskit/smart-card 26.12.1 → 26.13.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/messages.js +21 -1
  3. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +8 -0
  4. package/dist/cjs/utils/analytics/analytics.js +139 -125
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -5
  7. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +31 -18
  8. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +6 -1
  9. package/dist/es2019/messages.js +21 -1
  10. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +8 -1
  11. package/dist/es2019/utils/analytics/analytics.js +13 -0
  12. package/dist/es2019/version.json +1 -1
  13. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +13 -5
  14. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +33 -20
  15. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -1
  16. package/dist/esm/messages.js +21 -1
  17. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +9 -1
  18. package/dist/esm/utils/analytics/analytics.js +130 -117
  19. package/dist/esm/version.json +1 -1
  20. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -5
  21. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +33 -20
  22. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +6 -1
  23. package/dist/types/messages.d.ts +1 -1
  24. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
  25. package/dist/types/state/flexible-ui-context/index.d.ts +2 -0
  26. package/dist/types/state/hooks/useSmartLink.d.ts +1 -0
  27. package/dist/types/utils/analytics/analytics.d.ts +1 -0
  28. package/dist/types/utils/mocks.d.ts +1 -0
  29. package/dist/types-ts4.5/messages.d.ts +1 -1
  30. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
  31. package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +2 -0
  32. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -0
  33. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -0
  34. package/dist/types-ts4.5/utils/mocks.d.ts +1 -0
  35. package/package.json +2 -2
  36. package/report.api.md +1 -0
  37. package/tmp/api-report-tmp.d.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`72d087f0de3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/72d087f0de3) - [ux] Update smart link unauthorised view when there is no auth flow available
8
+
9
+ ## 26.13.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`d2ef5ede462`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2ef5ede462) - Added a new analytics event that will fire on resolution of data for hover cards. The change is behind a FF and will only surface if we pass the FF as true to SmartCardProvider.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 26.12.1
4
20
 
5
21
  ### Patch Changes
@@ -92,7 +92,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
92
92
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
93
93
  },
94
94
  connect_unauthorised_account_description_no_provider: {
95
- id: 'fabric.linking.connect_unauthorised_account_description',
95
+ id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
96
96
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
97
97
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
98
98
  },
@@ -392,6 +392,26 @@ var messages = (0, _reactIntlNext.defineMessages)({
392
392
  defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
393
393
  description: 'Link safety check warning message'
394
394
  },
395
+ unauthorised_account_description: {
396
+ id: 'fabric.linking.unauthorised_account_description',
397
+ defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
398
+ description: 'Explains that user does not have access to a link.'
399
+ },
400
+ unauthorised_account_description_no_provider: {
401
+ id: 'fabric.linking.unauthorised_account_description_no_provider',
402
+ defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
403
+ description: 'Explains that user does not have access to a link.'
404
+ },
405
+ unauthorised_account_name: {
406
+ id: 'fabric.linking.unauthorised_account_name',
407
+ defaultMessage: "We can't display private pages from {context}",
408
+ description: 'Shown when a user does not have access to a link.'
409
+ },
410
+ unauthorised_account_name_no_provider: {
411
+ id: 'fabric.linking.unauthorised_account_name_no_provider',
412
+ defaultMessage: "We can't display private pages",
413
+ description: 'Shown when a user does not have access to a link.'
414
+ },
395
415
  unlink_account: {
396
416
  id: 'fabric.linking.unlink_account',
397
417
  defaultMessage: 'Unlink Account',
@@ -776,6 +776,14 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
776
776
  */
777
777
  smartLinkQuickActionFailed: function smartLinkQuickActionFailed(props) {
778
778
  return dispatchAnalytics(applyCommonAttributes((0, _analytics2.trackSmartLinkQuickActionFailed)(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
779
+ },
780
+ /**
781
+ * Fires a track event when we call loadMetadata() to get information for a hover card
782
+ */
783
+ hoverCardResolutionStarted: function hoverCardResolutionStarted() {
784
+ return dispatchAnalytics(applyCommonAttributes((0, _analytics2.trackHoverCardResolutionStarted)(_objectSpread({
785
+ display: 'hoverCardPreview'
786
+ }, commonAttributes)), commonAttributes));
779
787
  }
780
788
  };
781
789
  }, [commonAttributes, dispatchAnalytics]);
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.unresolvedEvent = exports.uiSmartLinkStatusOpenPreviewButtonClicked = exports.uiSmartLinkStatusLozengeButtonClicked = exports.uiSmartLinkStatusListItemButtonClicked = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiIframeFocusedEvent = exports.uiIframeDwelledEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackSmartLinkQuickActionSuccess = exports.trackSmartLinkQuickActionStarted = exports.trackSmartLinkQuickActionFailed = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.TrackQuickActionType = exports.TrackQuickActionFailureReason = exports.SmartLinkEvents = exports.ANALYTICS_CHANNEL = void 0;
7
+ exports.unresolvedEvent = exports.uiSmartLinkStatusOpenPreviewButtonClicked = exports.uiSmartLinkStatusLozengeButtonClicked = exports.uiSmartLinkStatusListItemButtonClicked = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiIframeFocusedEvent = exports.uiIframeDwelledEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackSmartLinkQuickActionSuccess = exports.trackSmartLinkQuickActionStarted = exports.trackSmartLinkQuickActionFailed = exports.trackHoverCardResolutionStarted = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.TrackQuickActionType = exports.TrackQuickActionFailureReason = exports.SmartLinkEvents = exports.ANALYTICS_CHANNEL = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -13,7 +13,8 @@ var _version = require("../../version.json");
13
13
  var _performance = require("../performance");
14
14
  var _excluded = ["smartLinkActionType"],
15
15
  _excluded2 = ["smartLinkActionType"],
16
- _excluded3 = ["smartLinkActionType"];
16
+ _excluded3 = ["smartLinkActionType"],
17
+ _excluded4 = ["display"];
17
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
19
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
20
  var ANALYTICS_CHANNEL = 'media';
@@ -297,13 +298,26 @@ var trackSmartLinkQuickActionFailed = function trackSmartLinkQuickActionFailed(_
297
298
  };
298
299
  };
299
300
  exports.trackSmartLinkQuickActionFailed = trackSmartLinkQuickActionFailed;
300
- var uiAuthEvent = function uiAuthEvent(_ref11) {
301
- var definitionId = _ref11.definitionId,
302
- extensionKey = _ref11.extensionKey,
303
- destinationProduct = _ref11.destinationProduct,
304
- destinationSubproduct = _ref11.destinationSubproduct,
305
- location = _ref11.location,
306
- display = _ref11.display;
301
+ var trackHoverCardResolutionStarted = function trackHoverCardResolutionStarted(_ref11) {
302
+ var display = _ref11.display,
303
+ attributes = (0, _objectWithoutProperties2.default)(_ref11, _excluded4);
304
+ return {
305
+ action: 'resolved',
306
+ actionSubject: 'hoverCard',
307
+ eventType: 'track',
308
+ attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
309
+ display: display
310
+ })
311
+ };
312
+ };
313
+ exports.trackHoverCardResolutionStarted = trackHoverCardResolutionStarted;
314
+ var uiAuthEvent = function uiAuthEvent(_ref12) {
315
+ var definitionId = _ref12.definitionId,
316
+ extensionKey = _ref12.extensionKey,
317
+ destinationProduct = _ref12.destinationProduct,
318
+ destinationSubproduct = _ref12.destinationSubproduct,
319
+ location = _ref12.location,
320
+ display = _ref12.display;
307
321
  return {
308
322
  action: 'clicked',
309
323
  actionSubject: 'button',
@@ -320,13 +334,13 @@ var uiAuthEvent = function uiAuthEvent(_ref11) {
320
334
  };
321
335
  };
322
336
  exports.uiAuthEvent = uiAuthEvent;
323
- var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref12) {
324
- var definitionId = _ref12.definitionId,
325
- extensionKey = _ref12.extensionKey,
326
- destinationProduct = _ref12.destinationProduct,
327
- destinationSubproduct = _ref12.destinationSubproduct,
328
- location = _ref12.location,
329
- display = _ref12.display;
337
+ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref13) {
338
+ var definitionId = _ref13.definitionId,
339
+ extensionKey = _ref13.extensionKey,
340
+ destinationProduct = _ref13.destinationProduct,
341
+ destinationSubproduct = _ref13.destinationSubproduct,
342
+ location = _ref13.location,
343
+ display = _ref13.display;
330
344
  return {
331
345
  action: 'clicked',
332
346
  actionSubject: 'smartLink',
@@ -343,17 +357,17 @@ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref12) {
343
357
  };
344
358
  };
345
359
  exports.uiAuthAlternateAccountEvent = uiAuthAlternateAccountEvent;
346
- var uiCardClickedEvent = function uiCardClickedEvent(_ref13) {
347
- var id = _ref13.id,
348
- display = _ref13.display,
349
- status = _ref13.status,
350
- definitionId = _ref13.definitionId,
351
- extensionKey = _ref13.extensionKey,
352
- isModifierKeyPressed = _ref13.isModifierKeyPressed,
353
- location = _ref13.location,
354
- destinationProduct = _ref13.destinationProduct,
355
- destinationSubproduct = _ref13.destinationSubproduct,
356
- actionSubjectId = _ref13.actionSubjectId;
360
+ var uiCardClickedEvent = function uiCardClickedEvent(_ref14) {
361
+ var id = _ref14.id,
362
+ display = _ref14.display,
363
+ status = _ref14.status,
364
+ definitionId = _ref14.definitionId,
365
+ extensionKey = _ref14.extensionKey,
366
+ isModifierKeyPressed = _ref14.isModifierKeyPressed,
367
+ location = _ref14.location,
368
+ destinationProduct = _ref14.destinationProduct,
369
+ destinationSubproduct = _ref14.destinationSubproduct,
370
+ actionSubjectId = _ref14.actionSubjectId;
357
371
  return {
358
372
  action: 'clicked',
359
373
  actionSubject: 'smartLink',
@@ -373,17 +387,17 @@ var uiCardClickedEvent = function uiCardClickedEvent(_ref13) {
373
387
  };
374
388
  };
375
389
  exports.uiCardClickedEvent = uiCardClickedEvent;
376
- var uiIframeDwelledEvent = function uiIframeDwelledEvent(_ref14) {
377
- var id = _ref14.id,
378
- display = _ref14.display,
379
- status = _ref14.status,
380
- definitionId = _ref14.definitionId,
381
- extensionKey = _ref14.extensionKey,
382
- location = _ref14.location,
383
- destinationProduct = _ref14.destinationProduct,
384
- destinationSubproduct = _ref14.destinationSubproduct,
385
- dwellTime = _ref14.dwellTime,
386
- dwellPercentVisible = _ref14.dwellPercentVisible;
390
+ var uiIframeDwelledEvent = function uiIframeDwelledEvent(_ref15) {
391
+ var id = _ref15.id,
392
+ display = _ref15.display,
393
+ status = _ref15.status,
394
+ definitionId = _ref15.definitionId,
395
+ extensionKey = _ref15.extensionKey,
396
+ location = _ref15.location,
397
+ destinationProduct = _ref15.destinationProduct,
398
+ destinationSubproduct = _ref15.destinationSubproduct,
399
+ dwellTime = _ref15.dwellTime,
400
+ dwellPercentVisible = _ref15.dwellPercentVisible;
387
401
  return {
388
402
  action: 'dwelled',
389
403
  actionSubject: 'smartLinkIframe',
@@ -403,15 +417,15 @@ var uiIframeDwelledEvent = function uiIframeDwelledEvent(_ref14) {
403
417
  };
404
418
  };
405
419
  exports.uiIframeDwelledEvent = uiIframeDwelledEvent;
406
- var uiIframeFocusedEvent = function uiIframeFocusedEvent(_ref15) {
407
- var id = _ref15.id,
408
- display = _ref15.display,
409
- status = _ref15.status,
410
- definitionId = _ref15.definitionId,
411
- extensionKey = _ref15.extensionKey,
412
- location = _ref15.location,
413
- destinationProduct = _ref15.destinationProduct,
414
- destinationSubproduct = _ref15.destinationSubproduct;
420
+ var uiIframeFocusedEvent = function uiIframeFocusedEvent(_ref16) {
421
+ var id = _ref16.id,
422
+ display = _ref16.display,
423
+ status = _ref16.status,
424
+ definitionId = _ref16.definitionId,
425
+ extensionKey = _ref16.extensionKey,
426
+ location = _ref16.location,
427
+ destinationProduct = _ref16.destinationProduct,
428
+ destinationSubproduct = _ref16.destinationSubproduct;
415
429
  return {
416
430
  action: 'focused',
417
431
  actionSubject: 'smartLinkIframe',
@@ -429,15 +443,15 @@ var uiIframeFocusedEvent = function uiIframeFocusedEvent(_ref15) {
429
443
  };
430
444
  };
431
445
  exports.uiIframeFocusedEvent = uiIframeFocusedEvent;
432
- var uiActionClickedEvent = function uiActionClickedEvent(_ref16) {
433
- var id = _ref16.id,
434
- actionType = _ref16.actionType,
435
- extensionKey = _ref16.extensionKey,
436
- display = _ref16.display,
437
- definitionId = _ref16.definitionId,
438
- destinationProduct = _ref16.destinationProduct,
439
- destinationSubproduct = _ref16.destinationSubproduct,
440
- location = _ref16.location;
446
+ var uiActionClickedEvent = function uiActionClickedEvent(_ref17) {
447
+ var id = _ref17.id,
448
+ actionType = _ref17.actionType,
449
+ extensionKey = _ref17.extensionKey,
450
+ display = _ref17.display,
451
+ definitionId = _ref17.definitionId,
452
+ destinationProduct = _ref17.destinationProduct,
453
+ destinationSubproduct = _ref17.destinationSubproduct,
454
+ location = _ref17.location;
441
455
  return {
442
456
  action: 'clicked',
443
457
  actionSubject: 'button',
@@ -456,13 +470,13 @@ var uiActionClickedEvent = function uiActionClickedEvent(_ref16) {
456
470
  };
457
471
  };
458
472
  exports.uiActionClickedEvent = uiActionClickedEvent;
459
- var uiClosedAuthEvent = function uiClosedAuthEvent(_ref17) {
460
- var display = _ref17.display,
461
- extensionKey = _ref17.extensionKey,
462
- definitionId = _ref17.definitionId,
463
- destinationProduct = _ref17.destinationProduct,
464
- destinationSubproduct = _ref17.destinationSubproduct,
465
- location = _ref17.location;
473
+ var uiClosedAuthEvent = function uiClosedAuthEvent(_ref18) {
474
+ var display = _ref18.display,
475
+ extensionKey = _ref18.extensionKey,
476
+ definitionId = _ref18.definitionId,
477
+ destinationProduct = _ref18.destinationProduct,
478
+ destinationSubproduct = _ref18.destinationSubproduct,
479
+ location = _ref18.location;
466
480
  return {
467
481
  action: 'closed',
468
482
  actionSubject: 'consentModal',
@@ -478,12 +492,12 @@ var uiClosedAuthEvent = function uiClosedAuthEvent(_ref17) {
478
492
  };
479
493
  };
480
494
  exports.uiClosedAuthEvent = uiClosedAuthEvent;
481
- var screenAuthPopupEvent = function screenAuthPopupEvent(_ref18) {
482
- var extensionKey = _ref18.extensionKey,
483
- definitionId = _ref18.definitionId,
484
- destinationProduct = _ref18.destinationProduct,
485
- destinationSubproduct = _ref18.destinationSubproduct,
486
- location = _ref18.location;
495
+ var screenAuthPopupEvent = function screenAuthPopupEvent(_ref19) {
496
+ var extensionKey = _ref19.extensionKey,
497
+ definitionId = _ref19.definitionId,
498
+ destinationProduct = _ref19.destinationProduct,
499
+ destinationSubproduct = _ref19.destinationSubproduct,
500
+ location = _ref19.location;
487
501
  return {
488
502
  actionSubject: 'consentModal',
489
503
  eventType: 'screen',
@@ -497,14 +511,14 @@ var screenAuthPopupEvent = function screenAuthPopupEvent(_ref18) {
497
511
  };
498
512
  };
499
513
  exports.screenAuthPopupEvent = screenAuthPopupEvent;
500
- var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref19) {
501
- var display = _ref19.display,
502
- status = _ref19.status,
503
- extensionKey = _ref19.extensionKey,
504
- definitionId = _ref19.definitionId,
505
- destinationProduct = _ref19.destinationProduct,
506
- destinationSubproduct = _ref19.destinationSubproduct,
507
- location = _ref19.location;
514
+ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
515
+ var display = _ref20.display,
516
+ status = _ref20.status,
517
+ extensionKey = _ref20.extensionKey,
518
+ definitionId = _ref20.definitionId,
519
+ destinationProduct = _ref20.destinationProduct,
520
+ destinationSubproduct = _ref20.destinationSubproduct,
521
+ location = _ref20.location;
508
522
  return {
509
523
  action: 'renderSuccess',
510
524
  actionSubject: 'smartLink',
@@ -521,15 +535,15 @@ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref19) {
521
535
  };
522
536
  };
523
537
  exports.uiRenderSuccessEvent = uiRenderSuccessEvent;
524
- var uiRenderFailedEvent = function uiRenderFailedEvent(_ref20) {
525
- var display = _ref20.display,
526
- error = _ref20.error,
527
- errorInfo = _ref20.errorInfo,
528
- extensionKey = _ref20.extensionKey,
529
- definitionId = _ref20.definitionId,
530
- destinationProduct = _ref20.destinationProduct,
531
- destinationSubproduct = _ref20.destinationSubproduct,
532
- location = _ref20.location;
538
+ var uiRenderFailedEvent = function uiRenderFailedEvent(_ref21) {
539
+ var display = _ref21.display,
540
+ error = _ref21.error,
541
+ errorInfo = _ref21.errorInfo,
542
+ extensionKey = _ref21.extensionKey,
543
+ definitionId = _ref21.definitionId,
544
+ destinationProduct = _ref21.destinationProduct,
545
+ destinationSubproduct = _ref21.destinationSubproduct,
546
+ location = _ref21.location;
533
547
  return {
534
548
  actionSubject: 'smartLink',
535
549
  action: 'renderFailed',
@@ -547,16 +561,16 @@ var uiRenderFailedEvent = function uiRenderFailedEvent(_ref20) {
547
561
  };
548
562
  };
549
563
  exports.uiRenderFailedEvent = uiRenderFailedEvent;
550
- var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref21) {
551
- var id = _ref21.id,
552
- previewDisplay = _ref21.previewDisplay,
553
- extensionKey = _ref21.extensionKey,
554
- definitionId = _ref21.definitionId,
555
- destinationProduct = _ref21.destinationProduct,
556
- destinationSubproduct = _ref21.destinationSubproduct,
557
- location = _ref21.location,
558
- previewInvokeMethod = _ref21.previewInvokeMethod,
559
- status = _ref21.status;
564
+ var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref22) {
565
+ var id = _ref22.id,
566
+ previewDisplay = _ref22.previewDisplay,
567
+ extensionKey = _ref22.extensionKey,
568
+ definitionId = _ref22.definitionId,
569
+ destinationProduct = _ref22.destinationProduct,
570
+ destinationSubproduct = _ref22.destinationSubproduct,
571
+ location = _ref22.location,
572
+ previewInvokeMethod = _ref22.previewInvokeMethod,
573
+ status = _ref22.status;
560
574
  return {
561
575
  action: 'viewed',
562
576
  actionSubject: 'hoverCard',
@@ -575,17 +589,17 @@ var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref21) {
575
589
  };
576
590
  };
577
591
  exports.uiHoverCardViewedEvent = uiHoverCardViewedEvent;
578
- var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref22) {
579
- var id = _ref22.id,
580
- previewDisplay = _ref22.previewDisplay,
581
- hoverTime = _ref22.hoverTime,
582
- extensionKey = _ref22.extensionKey,
583
- definitionId = _ref22.definitionId,
584
- destinationProduct = _ref22.destinationProduct,
585
- destinationSubproduct = _ref22.destinationSubproduct,
586
- location = _ref22.location,
587
- previewInvokeMethod = _ref22.previewInvokeMethod,
588
- status = _ref22.status;
592
+ var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref23) {
593
+ var id = _ref23.id,
594
+ previewDisplay = _ref23.previewDisplay,
595
+ hoverTime = _ref23.hoverTime,
596
+ extensionKey = _ref23.extensionKey,
597
+ definitionId = _ref23.definitionId,
598
+ destinationProduct = _ref23.destinationProduct,
599
+ destinationSubproduct = _ref23.destinationSubproduct,
600
+ location = _ref23.location,
601
+ previewInvokeMethod = _ref23.previewInvokeMethod,
602
+ status = _ref23.status;
589
603
  return {
590
604
  action: 'dismissed',
591
605
  actionSubject: 'hoverCard',
@@ -605,15 +619,15 @@ var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref22) {
605
619
  };
606
620
  };
607
621
  exports.uiHoverCardDismissedEvent = uiHoverCardDismissedEvent;
608
- var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref23) {
609
- var id = _ref23.id,
610
- previewDisplay = _ref23.previewDisplay,
611
- extensionKey = _ref23.extensionKey,
612
- definitionId = _ref23.definitionId,
613
- destinationProduct = _ref23.destinationProduct,
614
- destinationSubproduct = _ref23.destinationSubproduct,
615
- location = _ref23.location,
616
- previewInvokeMethod = _ref23.previewInvokeMethod;
622
+ var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref24) {
623
+ var id = _ref24.id,
624
+ previewDisplay = _ref24.previewDisplay,
625
+ extensionKey = _ref24.extensionKey,
626
+ definitionId = _ref24.definitionId,
627
+ destinationProduct = _ref24.destinationProduct,
628
+ destinationSubproduct = _ref24.destinationSubproduct,
629
+ location = _ref24.location,
630
+ previewInvokeMethod = _ref24.previewInvokeMethod;
617
631
  return {
618
632
  action: 'clicked',
619
633
  actionSubject: 'button',
@@ -642,15 +656,15 @@ var uiLearnMoreLinkClickedEvent = function uiLearnMoreLinkClickedEvent() {
642
656
  };
643
657
  };
644
658
  exports.uiLearnMoreLinkClickedEvent = uiLearnMoreLinkClickedEvent;
645
- var chunkloadFailedEvent = function chunkloadFailedEvent(_ref24) {
646
- var display = _ref24.display,
647
- error = _ref24.error,
648
- errorInfo = _ref24.errorInfo,
649
- extensionKey = _ref24.extensionKey,
650
- definitionId = _ref24.definitionId,
651
- destinationProduct = _ref24.destinationProduct,
652
- destinationSubproduct = _ref24.destinationSubproduct,
653
- location = _ref24.location;
659
+ var chunkloadFailedEvent = function chunkloadFailedEvent(_ref25) {
660
+ var display = _ref25.display,
661
+ error = _ref25.error,
662
+ errorInfo = _ref25.errorInfo,
663
+ extensionKey = _ref25.extensionKey,
664
+ definitionId = _ref25.definitionId,
665
+ destinationProduct = _ref25.destinationProduct,
666
+ destinationSubproduct = _ref25.destinationSubproduct,
667
+ location = _ref25.location;
654
668
  return {
655
669
  action: 'chunkLoadFailed',
656
670
  actionSubject: 'smartLink',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.12.1",
3
+ "version": "26.13.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
11
  var _react = _interopRequireWildcard(require("react"));
12
+ var _reactIntlNext = require("react-intl-next");
11
13
  var _FlexibleCard = _interopRequireDefault(require("../../../FlexibleCard"));
12
14
  var _AuthorizeAction = require("../../actions/flexible/AuthorizeAction");
13
15
  var _footer = _interopRequireDefault(require("../../components/flexible/footer"));
@@ -17,6 +19,7 @@ var _linkExtractors = require("@atlaskit/link-extractors");
17
19
  var _UnauthorisedViewContent = _interopRequireDefault(require("../../../common/UnauthorisedViewContent"));
18
20
  var _react2 = require("@emotion/react");
19
21
  var _token = require("../../../../utils/token");
22
+ var _messages = require("../../../../messages");
20
23
  var _templateObject;
21
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -53,6 +56,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
53
56
  onAuthorize();
54
57
  }
55
58
  }, [onAuthorize, extensionKey, analytics.track]);
59
+ var content = (0, _react.useMemo)(function () {
60
+ return onAuthorize ? /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
61
+ providerName: providerName,
62
+ analytics: analytics,
63
+ testId: testId
64
+ }) : /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
65
+ values: {
66
+ context: providerName
67
+ }
68
+ }));
69
+ }, [analytics, onAuthorize, providerName, testId]);
56
70
  var actions = (0, _react.useMemo)(function () {
57
71
  return onAuthorize ? [(0, _AuthorizeAction.AuthorizeAction)(handleAuthorize, providerName)] : [];
58
72
  }, [handleAuthorize, onAuthorize, providerName]);
@@ -71,11 +85,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
71
85
  }), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, {
72
86
  overrideCss: contentStyles,
73
87
  testId: "".concat(testId, "-content")
74
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
75
- providerName: providerName,
76
- analytics: analytics,
77
- testId: testId
78
- }))), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
88
+ }, /*#__PURE__*/_react.default.createElement("div", null, content)), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
79
89
  actions: actions,
80
90
  status: _constants.SmartLinkStatus.Unauthorized,
81
91
  actionGroupAppearance: "primary"
@@ -15,7 +15,6 @@ var _UnauthorisedViewContent = _interopRequireDefault(require("../../common/Unau
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
18
- var _context$image;
19
18
  var analytics = _ref.analytics,
20
19
  link = _ref.link,
21
20
  context = _ref.context,
@@ -37,6 +36,36 @@ var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
37
36
  onAuthorise();
38
37
  }
39
38
  }, [onAuthorise, analytics.track, extensionKey]);
39
+ var view = (0, _react.useMemo)(function () {
40
+ var _context$image2;
41
+ if (onAuthorise) {
42
+ var _context$image;
43
+ return /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
44
+ button: {
45
+ appearance: 'primary',
46
+ text: 'connect_unauthorised_account_action',
47
+ testId: 'connect-account'
48
+ },
49
+ context: context && context.text,
50
+ description: "connect_unauthorised_account_description",
51
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : _constants.UnauthorisedImage,
52
+ onClick: handleOnAuthorizeClick,
53
+ testId: testId,
54
+ title: "connect_link_account_card_name"
55
+ }, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
56
+ analytics: analytics,
57
+ providerName: context === null || context === void 0 ? void 0 : context.text,
58
+ testId: testId
59
+ }));
60
+ }
61
+ return /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
62
+ description: context !== null && context !== void 0 && context.text ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider',
63
+ image: (_context$image2 = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image2 !== void 0 ? _context$image2 : _constants.LockImage,
64
+ context: context === null || context === void 0 ? void 0 : context.text,
65
+ testId: testId,
66
+ title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
67
+ });
68
+ }, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
40
69
  return /*#__PURE__*/_react.default.createElement(_ExpandedFrame.ExpandedFrame, {
41
70
  href: link,
42
71
  icon: icon,
@@ -47,22 +76,6 @@ var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
47
76
  onClick: onClick,
48
77
  testId: testId,
49
78
  allowScrollBar: true
50
- }, /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
51
- image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : _constants.UnauthorisedImage,
52
- title: "connect_link_account_card_name",
53
- description: "connect_unauthorised_account_description",
54
- context: context && context.text,
55
- button: onAuthorise ? {
56
- appearance: 'primary',
57
- text: 'connect_unauthorised_account_action',
58
- testId: 'connect-account'
59
- } : undefined,
60
- onClick: onAuthorise ? handleOnAuthorizeClick : undefined,
61
- testId: testId
62
- }, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
63
- analytics: analytics,
64
- providerName: context === null || context === void 0 ? void 0 : context.text,
65
- testId: testId
66
- })));
79
+ }, view);
67
80
  };
68
81
  exports.EmbedCardUnauthorisedView = EmbedCardUnauthorisedView;
@@ -20,6 +20,7 @@ var _constants = require("../../../constants");
20
20
  var _SmartLinkAnalyticsContext = require("../../../utils/analytics/SmartLinkAnalyticsContext");
21
21
  var _actions = require("../../../state/actions");
22
22
  var _analytics = require("../../../state/analytics");
23
+ var _linkProvider = require("@atlaskit/link-provider");
23
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
26
  /** @jsx jsx */
@@ -61,6 +62,7 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
61
62
  var analytics = (0, _analytics.useSmartLinkAnalytics)(url, undefined, id);
62
63
  var _useSmartCardActions = (0, _actions.useSmartCardActions)(id, url, analytics),
63
64
  loadMetadata = _useSmartCardActions.loadMetadata;
65
+ var enableHoverCardResolutionTracking = (0, _linkProvider.useFeatureFlag)('enableHoverCardResolutionTracking');
64
66
  var setMousePosition = (0, _react2.useCallback)(function (event) {
65
67
  if (isOpen && canOpen) {
66
68
  return;
@@ -129,9 +131,12 @@ var HoverCardComponent = function HoverCardComponent(_ref) {
129
131
  if (!resolveTimeOutId.current && isLinkUnresolved) {
130
132
  resolveTimeOutId.current = setTimeout(function () {
131
133
  loadMetadata();
134
+ if (enableHoverCardResolutionTracking) {
135
+ analytics.track.hoverCardResolutionStarted();
136
+ }
132
137
  }, RESOLVE_DELAY);
133
138
  }
134
- }, [linkState, loadMetadata]);
139
+ }, [analytics.track, enableHoverCardResolutionTracking, linkState.metadataStatus, linkState.status, loadMetadata]);
135
140
  var initShowCard = (0, _react2.useCallback)(function (event) {
136
141
  // clearing out fadeOutTimeoutId in case it's already counting down to hide the card
137
142
  if (fadeOutTimeoutId.current) {
@@ -86,7 +86,7 @@ export const messages = defineMessages({
86
86
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
87
87
  },
88
88
  connect_unauthorised_account_description_no_provider: {
89
- id: 'fabric.linking.connect_unauthorised_account_description',
89
+ id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
90
90
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
91
91
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
92
92
  },
@@ -386,6 +386,26 @@ export const messages = defineMessages({
386
386
  defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
387
387
  description: 'Link safety check warning message'
388
388
  },
389
+ unauthorised_account_description: {
390
+ id: 'fabric.linking.unauthorised_account_description',
391
+ defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
392
+ description: 'Explains that user does not have access to a link.'
393
+ },
394
+ unauthorised_account_description_no_provider: {
395
+ id: 'fabric.linking.unauthorised_account_description_no_provider',
396
+ defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
397
+ description: 'Explains that user does not have access to a link.'
398
+ },
399
+ unauthorised_account_name: {
400
+ id: 'fabric.linking.unauthorised_account_name',
401
+ defaultMessage: "We can't display private pages from {context}",
402
+ description: 'Shown when a user does not have access to a link.'
403
+ },
404
+ unauthorised_account_name_no_provider: {
405
+ id: 'fabric.linking.unauthorised_account_name_no_provider',
406
+ defaultMessage: "We can't display private pages",
407
+ description: 'Shown when a user does not have access to a link.'
408
+ },
389
409
  unlink_account: {
390
410
  id: 'fabric.linking.unlink_account',
391
411
  defaultMessage: 'Unlink Account',