@atlaskit/smart-card 18.0.14 → 18.0.15

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 (154) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +9 -0
  3. package/dist/cjs/state/flexible-ui-context/index.js +4 -0
  4. package/dist/cjs/utils/analytics/analytics.js +52 -2
  5. package/dist/cjs/utils/analytics/index.js +18 -0
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/CardWithUrl/component.js +4 -2
  8. package/dist/cjs/view/CardWithUrl/loader.js +4 -2
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +26 -4
  10. package/dist/cjs/view/FlexibleCard/components/actions/index.js +18 -2
  11. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
  12. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +9 -2
  13. package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +9 -2
  14. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
  15. package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
  16. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
  17. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
  18. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +39 -19
  19. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +92 -17
  20. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +45 -9
  21. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -12
  22. package/dist/cjs/view/FlexibleCard/components/container/index.js +5 -0
  23. package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
  24. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +18 -3
  25. package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +9 -1
  26. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +9 -1
  27. package/dist/cjs/view/FlexibleCard/components/elements/index.js +96 -0
  28. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +9 -1
  29. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
  30. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +9 -2
  31. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +12 -6
  32. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +7 -3
  33. package/dist/cjs/view/FlexibleCard/index.js +6 -0
  34. package/dist/cjs/view/HoverCard/index.js +48 -10
  35. package/dist/cjs/view/HoverCard/styled.js +3 -1
  36. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -2
  37. package/dist/es2019/state/flexible-ui-context/index.js +5 -0
  38. package/dist/es2019/utils/analytics/analytics.js +35 -0
  39. package/dist/es2019/utils/analytics/index.js +1 -1
  40. package/dist/es2019/version.json +1 -1
  41. package/dist/es2019/view/CardWithUrl/component.js +4 -2
  42. package/dist/es2019/view/CardWithUrl/loader.js +4 -2
  43. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +37 -4
  44. package/dist/es2019/view/FlexibleCard/components/actions/index.js +18 -2
  45. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
  46. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +9 -2
  47. package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
  48. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
  49. package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
  50. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
  51. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
  52. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +31 -15
  53. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +77 -15
  54. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +35 -8
  55. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -11
  56. package/dist/es2019/view/FlexibleCard/components/container/index.js +5 -0
  57. package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
  58. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +18 -3
  59. package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +9 -1
  60. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +9 -1
  61. package/dist/es2019/view/FlexibleCard/components/elements/index.js +96 -0
  62. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +9 -1
  63. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
  64. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +8 -1
  65. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +11 -4
  66. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +5 -2
  67. package/dist/es2019/view/FlexibleCard/index.js +6 -0
  68. package/dist/es2019/view/HoverCard/index.js +40 -10
  69. package/dist/es2019/view/HoverCard/styled.js +6 -1
  70. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +10 -1
  71. package/dist/esm/state/flexible-ui-context/index.js +5 -0
  72. package/dist/esm/utils/analytics/analytics.js +41 -0
  73. package/dist/esm/utils/analytics/index.js +1 -1
  74. package/dist/esm/version.json +1 -1
  75. package/dist/esm/view/CardWithUrl/component.js +4 -2
  76. package/dist/esm/view/CardWithUrl/loader.js +4 -2
  77. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +25 -4
  78. package/dist/esm/view/FlexibleCard/components/actions/index.js +18 -2
  79. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
  80. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +9 -2
  81. package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
  82. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
  83. package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
  84. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
  85. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
  86. package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +33 -16
  87. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +79 -17
  88. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +39 -8
  89. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +22 -11
  90. package/dist/esm/view/FlexibleCard/components/container/index.js +5 -0
  91. package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
  92. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +18 -3
  93. package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +9 -1
  94. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +9 -1
  95. package/dist/esm/view/FlexibleCard/components/elements/index.js +96 -0
  96. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +9 -1
  97. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
  98. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +9 -2
  99. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +12 -6
  100. package/dist/esm/view/FlexibleCard/components/elements/utils.js +5 -3
  101. package/dist/esm/view/FlexibleCard/index.js +6 -0
  102. package/dist/esm/view/HoverCard/index.js +42 -10
  103. package/dist/esm/view/HoverCard/styled.js +2 -1
  104. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
  105. package/dist/types/state/flexible-ui-context/index.d.ts +4 -0
  106. package/dist/types/state/flexible-ui-context/types.d.ts +102 -0
  107. package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
  108. package/dist/types/utils/analytics/analytics.d.ts +4 -0
  109. package/dist/types/utils/analytics/index.d.ts +1 -1
  110. package/dist/types/utils/types.d.ts +2 -2
  111. package/dist/types/view/Card/index.d.ts +1 -1
  112. package/dist/types/view/Card/types.d.ts +1 -0
  113. package/dist/types/view/CardWithUrl/component.d.ts +1 -1
  114. package/dist/types/view/CardWithUrl/types.d.ts +1 -0
  115. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +8 -0
  116. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -2
  117. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +15 -0
  118. package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +6 -0
  119. package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +1 -1
  120. package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +6 -0
  121. package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +6 -0
  122. package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -2
  123. package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +6 -0
  124. package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +6 -0
  125. package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +5 -0
  126. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +5 -0
  127. package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +9 -2
  128. package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +11 -0
  129. package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +7 -3
  130. package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +8 -2
  131. package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -1
  132. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -5
  133. package/dist/types/view/FlexibleCard/components/container/index.d.ts +4 -0
  134. package/dist/types/view/FlexibleCard/components/container/types.d.ts +2 -2
  135. package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +7 -0
  136. package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +13 -0
  137. package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +7 -0
  138. package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +6 -0
  139. package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +5 -1
  140. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +77 -0
  141. package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +6 -0
  142. package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +6 -0
  143. package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +6 -0
  144. package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +6 -0
  145. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -2
  146. package/dist/types/view/FlexibleCard/components/elements/types.d.ts +2 -0
  147. package/dist/types/view/FlexibleCard/index.d.ts +6 -0
  148. package/dist/types/view/HoverCard/index.d.ts +3 -2
  149. package/dist/types/view/HoverCard/types.d.ts +5 -2
  150. package/package.json +1 -1
  151. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/utils.js +0 -105
  152. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/utils.js +0 -71
  153. package/dist/esm/view/FlexibleCard/components/blocks/title-block/utils.js +0 -76
  154. package/dist/types/view/FlexibleCard/components/blocks/title-block/utils.d.ts +0 -11
@@ -11,9 +11,18 @@ import { SmartLinkSize, ActionName } from '../../constants';
11
11
  import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
12
12
  import { HoverCardContainer } from './styled';
13
13
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
14
- export var HoverCard = function HoverCard(_ref) {
14
+ import { withAnalyticsEvents, withAnalyticsContext } from '@atlaskit/analytics-next';
15
+ import { fireSmartLinkEvent } from '../../utils/analytics';
16
+ import { useSmartCardState as useLinkState } from '../../state/store';
17
+ import { useSmartLinkAnalytics } from '../../state/analytics';
18
+ import { getExtensionKey, getDefinitionId } from '../../state/helpers';
19
+ export var HoverCardComponent = function HoverCardComponent(_ref) {
15
20
  var children = _ref.children,
16
- url = _ref.url;
21
+ url = _ref.url,
22
+ createAnalyticsEvent = _ref.createAnalyticsEvent;
23
+ var analyticsHandler = useCallback(function (analyticsPayload) {
24
+ fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
25
+ }, [createAnalyticsEvent]);
17
26
  var delay = 300;
18
27
 
19
28
  var _React$useState = React.useState(false),
@@ -23,26 +32,45 @@ export var HoverCard = function HoverCard(_ref) {
23
32
 
24
33
  var fadeOutTimeoutId = useRef();
25
34
  var fadeInTimeoutId = useRef();
35
+ var cardOpenTime = useRef();
36
+ var linkState = useLinkState(url);
37
+ var analytics = useSmartLinkAnalytics(analyticsHandler);
38
+ var extensionKey = useMemo(function () {
39
+ return getExtensionKey(linkState.details);
40
+ }, [linkState]);
41
+ var definitionId = useMemo(function () {
42
+ return getDefinitionId(linkState.details);
43
+ }, [linkState]);
26
44
  var initHideCard = useCallback(function () {
27
45
  if (fadeInTimeoutId.current) {
28
46
  clearTimeout(fadeInTimeoutId.current);
29
47
  }
30
48
 
31
49
  fadeOutTimeoutId.current = setTimeout(function () {
50
+ //Check its previously open to avoid firing events when moving between the child and hover card components
51
+ if (isOpen === true && cardOpenTime.current) {
52
+ var hoverTime = Date.now() - cardOpenTime.current;
53
+ analytics.ui.hoverCardDismissedEvent('card', hoverTime, definitionId, extensionKey);
54
+ }
55
+
32
56
  setIsOpen(false);
33
57
  }, delay);
34
- }, [delay]);
58
+ }, [delay, isOpen, definitionId, extensionKey, analytics]);
35
59
  var initShowCard = useCallback(function () {
36
60
  if (fadeOutTimeoutId.current) {
37
61
  clearTimeout(fadeOutTimeoutId.current);
38
62
  }
39
63
 
40
64
  fadeInTimeoutId.current = setTimeout(function () {
65
+ //Check if its previously closed to avoid firing events when moving between the child and hover card components
66
+ if (isOpen === false) {
67
+ cardOpenTime.current = Date.now();
68
+ analytics.ui.hoverCardViewedEvent('card', definitionId, extensionKey);
69
+ }
70
+
41
71
  setIsOpen(true);
42
72
  }, delay);
43
- }, [delay]); //TODO: EDM-2905: Add analytics events
44
-
45
- var analyticsHandler = useCallback(function () {}, []);
73
+ }, [delay, isOpen, definitionId, extensionKey, analytics]);
46
74
  var linkActions = useSmartLinkActions({
47
75
  url: url,
48
76
  appearance: 'block',
@@ -69,11 +97,12 @@ export var HoverCard = function HoverCard(_ref) {
69
97
  }),
70
98
  iconPosition: 'before',
71
99
  onClick: function onClick() {
72
- return window.open(url, '_blank');
100
+ window.open(url, '_blank');
101
+ analytics.ui.hoverCardOpenLinkClickedEvent('card', definitionId, extensionKey);
73
102
  },
74
103
  testId: 'hover-card-open-button'
75
104
  };
76
- }, [url]);
105
+ }, [url, definitionId, extensionKey, analytics]);
77
106
 
78
107
  var cardComponent = function cardComponent() {
79
108
  return jsx("div", {
@@ -101,7 +130,7 @@ export var HoverCard = function HoverCard(_ref) {
101
130
  testId: "hover-card",
102
131
  isOpen: isOpen,
103
132
  onClose: onClose,
104
- placement: "bottom",
133
+ placement: "bottom-start",
105
134
  content: cardComponent,
106
135
  trigger: function trigger(triggerProps) {
107
136
  return jsx("span", _extends({}, triggerProps, {
@@ -110,4 +139,7 @@ export var HoverCard = function HoverCard(_ref) {
110
139
  }), children);
111
140
  }
112
141
  });
113
- };
142
+ };
143
+ export var HoverCard = withAnalyticsContext({
144
+ source: 'smartLinkPreviewHoverCard'
145
+ })(withAnalyticsEvents()(HoverCardComponent));
@@ -3,4 +3,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject;
4
4
 
5
5
  import { css } from '@emotion/core';
6
- export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n max-width: 500px;\n padding: 0;\n"])));
6
+ import { loadingPlaceholderClassName } from '../../index';
7
+ export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n max-width: 350px;\n padding: 0;\n\n .", " {\n display: none;\n }\n"])), loadingPlaceholderClassName);
@@ -1,5 +1,6 @@
1
1
  import { AnalyticsHandler } from '../../utils/types';
2
2
  import { CardInnerAppearance } from '../../view/Card/types';
3
+ import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
3
4
  import { CardType } from '../store/types';
4
5
  import { APIError } from '../../client/errors';
5
6
  import { InvokeType } from '../../model/invoke-opts';
@@ -9,8 +10,11 @@ export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler
9
10
  authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
10
11
  cardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined) => void;
11
12
  actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: CardInnerAppearance, invokeType: InvokeType) => void;
13
+ hoverCardOpenLinkClickedEvent: (previewDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => void;
12
14
  closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
13
15
  renderSuccessEvent: (display: CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
16
+ hoverCardViewedEvent: (hoverDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => void;
17
+ hoverCardDismissedEvent: (hoverDisplay: PreviewDisplay, hoverTime: number, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => void;
14
18
  };
15
19
  operational: {
16
20
  resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { FlexibleUiDataContext } from './types';
3
+ /**
4
+ * This provides the data that will be used by Smart Links Flexible UI to populate it's
5
+ * underlying elements.
6
+ */
3
7
  export declare const FlexibleUiContext: import("react").Context<FlexibleUiDataContext | undefined>;
4
8
  export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefined;
@@ -1,26 +1,128 @@
1
1
  import { LinkLozenge } from '../../extractors/common/lozenge/types';
2
2
  import { LinkPerson } from '../../extractors/common/person/types';
3
3
  import { IconType, MediaType } from '../../constants';
4
+ /**
5
+ * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
+ * underlying elements.
7
+ */
4
8
  export declare type FlexibleUiDataContext = {
9
+ /**
10
+ * An array containing data used to populate the AuthorGroup element.
11
+ * @see AvatarGroup
12
+ */
5
13
  authorGroup?: LinkPerson[];
14
+ /**
15
+ * An array containing a @type {LinkPerson} used to populate the CollaboratorGroup element.
16
+ * @see CollaboratorGroup
17
+ */
6
18
  collaboratorGroup?: LinkPerson[];
19
+ /**
20
+ * Contains the number of comments of the linked resource.
21
+ * @type number
22
+ * @see CommentCount
23
+ */
7
24
  commentCount?: number;
25
+ /**
26
+ * Contains the number of views of the linked resource.
27
+ * @type number
28
+ * @see ViewCount
29
+ */
8
30
  viewCount?: number;
31
+ /**
32
+ * Contains the number of react of the linked resource.
33
+ * @type number
34
+ * @see ReactCount
35
+ */
9
36
  reactCount?: number;
37
+ /**
38
+ * Contains the number of votes of the linked resource.
39
+ * @type number
40
+ * @see VoteCount
41
+ */
10
42
  voteCount?: number;
43
+ /**
44
+ * Contains the name of the entity that created the resource.
45
+ * @type string
46
+ * @see CreatedBy
47
+ */
11
48
  createdBy?: string;
49
+ /**
50
+ * Contains the ISO timestamp of when the resource was created.
51
+ * @type string - ISO Timestamp
52
+ * @see CreatedOn
53
+ */
12
54
  createdOn?: string;
55
+ /**
56
+ * Contains the favicon of the resource.
57
+ * @type Icon
58
+ * @see LinkIcon
59
+ */
13
60
  linkIcon?: Icon;
61
+ /**
62
+ * Contains the name of the entity that last modified the resource.
63
+ * @type string
64
+ * @see ModifiedBy
65
+ */
14
66
  modifiedBy?: string;
67
+ /**
68
+ * Contains the ISO timestamp of when the resource was last modified.
69
+ * @type string - ISO Timestamp
70
+ * @see ModifiedOn
71
+ */
15
72
  modifiedOn?: string;
73
+ /**
74
+ * Contains the preview (typically the thumbnail) of the resource.
75
+ * @type Media
76
+ * @see Preview
77
+ */
16
78
  preview?: Media;
79
+ /**
80
+ * Contains the priority icon of the resource.
81
+ * @type Icon
82
+ * @see Priority
83
+ */
17
84
  priority?: Icon;
85
+ /**
86
+ * Contains the programming language of the resource.
87
+ * @type string
88
+ * @see ProgrammingLanguage
89
+ */
18
90
  programmingLanguage?: string;
91
+ /**
92
+ * Contains the snippet of the resource.
93
+ * @type string
94
+ * @see Snippet
95
+ */
19
96
  snippet?: string;
97
+ /**
98
+ * Contains the number of subscribers of the linked resource.
99
+ * @type number
100
+ * @see SubscriberCount
101
+ */
20
102
  subscriberCount?: number;
103
+ /**
104
+ * Contains the number of subscribers of the linked resource.
105
+ * @type number
106
+ * @see SubscriberCount
107
+ */
21
108
  state?: LinkLozenge;
109
+ /**
110
+ * Contains the Title of the linked resource.
111
+ * @type string
112
+ * @see Title
113
+ */
22
114
  title?: string;
115
+ /**
116
+ * Contains the url of the linked resource.
117
+ * @type string
118
+ * @see Title
119
+ */
23
120
  url?: string;
121
+ /**
122
+ * Contains the provider icon of the linked resource.
123
+ * @type Icon
124
+ * @see Provider
125
+ */
24
126
  provider?: Icon;
25
127
  };
26
128
  export declare type Icon = {
@@ -14,8 +14,11 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
14
14
  authAlternateAccountEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
15
15
  cardClickedEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined) => void;
16
16
  actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, invokeType: import("../../model/invoke-opts").InvokeType) => void;
17
+ hoverCardOpenLinkClickedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
17
18
  closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
18
19
  renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
20
+ hoverCardViewedEvent: (hoverDisplay: import("../../view/HoverCard/types").PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
21
+ hoverCardDismissedEvent: (hoverDisplay: import("../../view/HoverCard/types").PreviewDisplay, hoverTime: number, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
19
22
  };
20
23
  operational: {
21
24
  resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
@@ -2,6 +2,7 @@ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { AnalyticsPayload } from '../types';
3
3
  import { ErrorInfo } from 'react';
4
4
  import { CardInnerAppearance } from '../../view/Card/types';
5
+ import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
5
6
  import { APIError } from '../../client/errors';
6
7
  export declare const ANALYTICS_CHANNEL = "media";
7
8
  export declare const context: {
@@ -28,3 +29,6 @@ export declare const uiClosedAuthEvent: (display: CardInnerAppearance, definitio
28
29
  export declare const screenAuthPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
29
30
  export declare const uiRenderSuccessEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
30
31
  export declare const uiRenderFailedEvent: (display: CardInnerAppearance, error: Error, errorInfo: ErrorInfo) => AnalyticsPayload;
32
+ export declare const uiHoverCardViewedEvent: (hoverDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
33
+ export declare const uiHoverCardDismissedEvent: (hoverDisplay: PreviewDisplay, hoverTime: number, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
34
+ export declare const uiHoverCardOpenLinkClickedEvent: (previewDisplay: string, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
@@ -1,5 +1,5 @@
1
1
  import { CardType } from '../../state/store/types';
2
2
  import { APIError } from '../../client/errors';
3
3
  import { AnalyticsPayload } from '../types';
4
- export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, } from './analytics';
4
+ export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, } from './analytics';
5
5
  export declare const instrumentEvent: (id: string, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => AnalyticsPayload | undefined;
@@ -1,7 +1,7 @@
1
1
  import { GasPayload } from '@atlaskit/analytics-gas-types';
2
2
  import { CardInnerAppearance } from '../view/Card/types';
3
- export declare type AnalyticsAction = 'resolved' | 'unresolved' | 'connectSucceeded' | 'connectFailed' | 'connected' | 'clicked' | 'closed' | 'renderFailed' | 'renderWithStatus' | 'renderSuccess' | 'inserted';
4
- export declare type AnalyticsActionSubject = 'smartLink' | 'smartLinkAction' | 'applicationAccount' | 'button' | 'consentModal';
3
+ export declare type AnalyticsAction = 'resolved' | 'unresolved' | 'connectSucceeded' | 'connectFailed' | 'connected' | 'clicked' | 'closed' | 'renderFailed' | 'renderWithStatus' | 'renderSuccess' | 'inserted' | 'viewed' | 'dismissed';
4
+ export declare type AnalyticsActionSubject = 'smartLink' | 'smartLinkAction' | 'applicationAccount' | 'button' | 'consentModal' | 'hoverCard';
5
5
  export declare type AnalyticsPayload = GasPayload & {
6
6
  action?: AnalyticsAction;
7
7
  actionSubject: AnalyticsActionSubject;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CardAppearance, CardPlatform, CardProps } from './types';
3
3
  import { WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "forwardedRef" | "isFrameVisible" | "importer" | "container" | "embedIframeRef" | "inlinePreloaderStyle"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "forwardedRef" | "importer" | "container" | "inlinePreloaderStyle" | "showHoverPreview"> & React.RefAttributes<any>>;
5
5
  export type { CardAppearance, CardProps, CardPlatform };
@@ -29,4 +29,5 @@ export interface CardProps extends WithAnalyticsEventsProps {
29
29
  inlinePreloaderStyle?: InlinePreloaderStyle;
30
30
  ui?: FlexibleUiOptions;
31
31
  children?: React.ReactNode;
32
+ showHoverPreview?: boolean;
32
33
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CardWithUrlContentProps } from './types';
3
- export declare function CardWithUrlContent({ id, url, isSelected, isFrameVisible, platform, onClick, appearance, dispatchAnalytics, onResolve, testId, showActions, inheritDimensions, embedIframeRef, inlinePreloaderStyle, ui, children, }: CardWithUrlContentProps): JSX.Element;
3
+ export declare function CardWithUrlContent({ id, url, isSelected, isFrameVisible, platform, onClick, appearance, dispatchAnalytics, onResolve, testId, showActions, inheritDimensions, embedIframeRef, inlinePreloaderStyle, ui, children, showHoverPreview, }: CardWithUrlContentProps): JSX.Element;
@@ -21,4 +21,5 @@ export declare type CardWithUrlContentProps = {
21
21
  inlinePreloaderStyle?: InlinePreloaderStyle;
22
22
  ui?: FlexibleUiOptions;
23
23
  children?: React.ReactNode;
24
+ showHoverPreview?: boolean;
24
25
  };
@@ -4,5 +4,13 @@ import { Spacing } from '@atlaskit/button';
4
4
  import { SmartLinkSize } from '../../../../../constants';
5
5
  import { ActionProps } from './types';
6
6
  export declare const sizeToSpacing: Record<SmartLinkSize, Spacing>;
7
+ /**
8
+ * An action that can be triggered with an on click.
9
+ * @public
10
+ * @param {ActionProps} ActionProps - The props necessary for the Action.
11
+ * @see DeleteAction
12
+ * @see EditAction
13
+ * @see CustomAction
14
+ */
7
15
  declare const Action: React.FC<ActionProps>;
8
16
  export default Action;
@@ -1,9 +1,9 @@
1
+ import { SerializedStyles } from '@emotion/core';
1
2
  import { SmartLinkSize } from '../../../../../constants';
2
3
  import { Appearance } from '@atlaskit/button/types';
3
4
  import { ReactChild } from 'react';
4
5
  export declare type ActionProps = {
5
6
  size?: SmartLinkSize;
6
- testId?: string;
7
7
  content?: React.ReactNode;
8
8
  appearance?: Appearance;
9
9
  onClick: () => any;
@@ -11,9 +11,11 @@ export declare type ActionProps = {
11
11
  iconPosition?: 'before' | 'after';
12
12
  tooltipMessage?: React.ReactNode;
13
13
  asDropDownItem?: boolean;
14
+ overrideCss?: SerializedStyles;
15
+ testId?: string;
14
16
  };
15
17
  export declare type ActionIconProps = {
16
18
  size?: SmartLinkSize;
17
- testId?: string;
18
19
  icon?: ReactChild;
20
+ testId?: string;
19
21
  };
@@ -1,5 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { ActionProps } from './action/types';
3
+ /**
4
+ * Creates a DeleteAction component. Accepts default ActionProps, but defaults
5
+ * the icon to a cross icon.
6
+ * @see Action
7
+ */
3
8
  export declare const DeleteAction: import("react").FC<ActionProps>;
9
+ /**
10
+ * Creates a EditAction component. Accepts default ActionProps, but defaults
11
+ * the icon to an edit (pencil) icon.
12
+ * @see Action
13
+ */
4
14
  export declare const EditAction: import("react").FC<ActionProps>;
15
+ /**
16
+ * Creates a CustomAction component. Accepts default ActionProps. Required to provide
17
+ * your own icon or text.
18
+ * @see Action
19
+ */
5
20
  export declare const CustomAction: import("react").FC<ActionProps>;
@@ -1,4 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { ActionGroupProps } from './types';
3
+ /**
4
+ * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
5
+ * preferences.
6
+ * @param {ActionGroupProps} ActionGroupProps
7
+ * @see Action
8
+ */
3
9
  declare const ActionGroup: React.FC<ActionGroupProps>;
4
10
  export default ActionGroup;
@@ -5,8 +5,8 @@ export declare type ActionGroupProps = {
5
5
  items: ActionItem[];
6
6
  size?: SmartLinkSize;
7
7
  direction?: SmartLinkDirection;
8
- testId?: string;
9
8
  appearance?: Appearance;
10
9
  visibleButtonsNum?: number;
11
10
  onDropdownOpenChange?: (isOpen: boolean) => void;
11
+ testId?: string;
12
12
  };
@@ -1,5 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { BlockProps } from '../types';
4
+ /**
5
+ * A block represents a collection of elements and actions that are arranged in a row.
6
+ * All elements and actions should be contained within a Block.
7
+ * @param {ActionGroupProps} ActionGroupProps
8
+ * @see Action
9
+ */
4
10
  declare const Block: React.FC<BlockProps>;
5
11
  export default Block;
@@ -4,5 +4,11 @@ import { SerializedStyles } from '@emotion/core';
4
4
  import { ElementGroupProps } from './types';
5
5
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
6
6
  export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth) => SerializedStyles;
7
+ /**
8
+ * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
9
+ * preferences.
10
+ * @param {ActionGroupProps} ActionGroupProps
11
+ * @see Action
12
+ */
7
13
  declare const ElementGroup: React.FC<ElementGroupProps>;
8
14
  export default ElementGroup;
@@ -2,9 +2,9 @@ import { Interpolation } from '@emotion/core';
2
2
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
3
3
  export declare type ElementGroupProps = {
4
4
  align?: SmartLinkAlignment;
5
- css?: Interpolation;
6
5
  direction?: SmartLinkDirection;
6
+ overrideCss?: Interpolation;
7
7
  size?: SmartLinkSize;
8
- testId?: string;
9
8
  width?: SmartLinkWidth;
9
+ testId?: string;
10
10
  };
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
2
  import { FooterBlockProps } from './types';
3
+ /**
4
+ * Represents a FooterBlock, designed to contain elements and actions that should appear
5
+ * at the bottom of a link card.
6
+ * @param {FooterBlockProps} FooterBlockProps
7
+ * @see Block
8
+ */
3
9
  declare const FooterBlock: React.FC<FooterBlockProps>;
4
10
  export default FooterBlock;
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
2
  import { MetadataBlockProps } from './types';
3
+ /**
4
+ * Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
5
+ * Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
6
+ * @param {MetadataBlockProps} MetadataBlockProps
7
+ * @see Block
8
+ */
3
9
  declare const MetadataBlock: React.FC<MetadataBlockProps>;
4
10
  export default MetadataBlock;
@@ -1,4 +1,9 @@
1
1
  import React from 'react';
2
2
  import { PreviewBlockProps } from './types';
3
+ /**
4
+ * Represents a PreviewBlock, which typically contains media or other large format content.
5
+ * @param {PreviewBlock} PreviewBlock
6
+ * @see Block
7
+ */
3
8
  declare const PreviewBlock: React.FC<PreviewBlockProps>;
4
9
  export default PreviewBlock;
@@ -1,4 +1,9 @@
1
1
  import React from 'react';
2
2
  import { SnippetBlockProps } from './types';
3
+ /**
4
+ * Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
5
+ * @param {SnippetBlock} SnippetBlock
6
+ * @see Block
7
+ */
3
8
  declare const SnippetBlock: React.FC<SnippetBlockProps>;
4
9
  export default SnippetBlock;
@@ -1,5 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { TitleBlockProps } from '../types';
4
- declare const TitleBlockErroredView: React.FC<TitleBlockProps>;
3
+ import { TitleBlockViewProps } from '../types';
4
+ /**
5
+ * Represents an Errored TitleBlock view.
6
+ * This will render when a Smart Link did not successfully resolve.
7
+ * This may be a result of a Smart Link not having the correct credentials,
8
+ * or the backend response was errored or malformed.
9
+ * @see TitleBlock
10
+ */
11
+ declare const TitleBlockErroredView: React.FC<TitleBlockViewProps>;
5
12
  export default TitleBlockErroredView;
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
2
  import { TitleBlockProps } from './types';
3
+ /**
4
+ * Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
5
+ * This contains an icon, the link, and any associated metadata and actions in one block.
6
+ * The TitleBlock will also render differently given the state of the smart link.
7
+ * This can be found in the corresponding Resolving, Resolved and Errored views.
8
+ * @param {TitleBlockProps} TitleBlockProps
9
+ * @see Block
10
+ * @see TitleBlockResolvingView
11
+ * @see TitleBlockResolvedView
12
+ * @see TitleBlockErroredView
13
+ */
3
14
  declare const TitleBlock: React.FC<TitleBlockProps>;
4
15
  export default TitleBlock;
@@ -1,5 +1,9 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
- import { TitleBlockProps } from '../types';
4
- declare const TitleBlockResolvedView: React.FC<TitleBlockProps>;
2
+ import { TitleBlockViewProps } from '../types';
3
+ /**
4
+ * This renders a fully resolved TitleBlock.
5
+ * This should render when a Smart Link returns a valid response.
6
+ * @see TitleBlock
7
+ */
8
+ declare const TitleBlockResolvedView: React.FC<TitleBlockViewProps>;
5
9
  export default TitleBlockResolvedView;
@@ -1,5 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { TitleBlockProps } from '../types';
4
- declare const TitleBlockResolvingView: React.FC<TitleBlockProps>;
3
+ import { TitleBlockViewProps } from '../types';
4
+ /**
5
+ * This represents a TitleBlock for a Smart Link that is currently waiting
6
+ * for a request to finish.
7
+ * This should render when a Smart Link has sent a request.
8
+ * @see TitleBlock
9
+ */
10
+ declare const TitleBlockResolvingView: React.FC<TitleBlockViewProps>;
5
11
  export default TitleBlockResolvingView;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { BlockProps, ElementItem, ActionItem } from '../types';
3
3
  import { SmartLinkPosition, SmartLinkTheme } from '../../../../../constants';
4
4
  import { RetryOptions } from '../../../types';
@@ -6,6 +6,11 @@ import { LinkProps } from '../../elements/link/types';
6
6
  export declare type TitleBlockProps = BlockProps & {
7
7
  maxLines?: number;
8
8
  metadata?: ElementItem[];
9
+ /** Determines the position of the icon in the TitleBlock.
10
+ * Top: Icon will be rendered in the "top" left of the TitleBlock
11
+ * Center: Icon will be rendered "center" relative to the vertical height of the TitleBlock.
12
+ * If direction is Horizontal, icon will be rendered in the center relative to the horizontal width of the TitleBlock.
13
+ */
9
14
  position?: SmartLinkPosition;
10
15
  retry?: RetryOptions;
11
16
  subtitle?: ElementItem[];
@@ -16,3 +21,7 @@ export declare type TitleBlockProps = BlockProps & {
16
21
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
17
22
  anchorTarget?: LinkProps['target'];
18
23
  };
24
+ export declare type TitleBlockViewProps = TitleBlockProps & {
25
+ actionGroup?: React.ReactNode;
26
+ title: React.ReactNode;
27
+ };