@atlaskit/smart-card 20.0.2 → 20.0.5
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 +20 -0
- package/dist/cjs/extractors/block/index.js +2 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +26 -6
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/components/Provider.js +3 -2
- package/dist/cjs/view/CardWithUrl/loader.js +5 -9
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +143 -0
- package/dist/cjs/view/HoverCard/components/{hover-card-content.js → HoverCardContent.js} +21 -25
- package/dist/cjs/view/HoverCard/index.js +25 -126
- package/dist/cjs/view/HoverCard/styled.js +11 -1
- package/dist/cjs/view/HoverCard/utils.js +3 -3
- package/dist/es2019/extractors/block/index.js +2 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +24 -7
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/components/Provider.js +3 -2
- package/dist/es2019/view/CardWithUrl/loader.js +6 -10
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +102 -0
- package/dist/es2019/view/HoverCard/components/{hover-card-content.js → HoverCardContent.js} +12 -21
- package/dist/es2019/view/HoverCard/index.js +26 -97
- package/dist/es2019/view/HoverCard/styled.js +8 -0
- package/dist/es2019/view/HoverCard/utils.js +1 -1
- package/dist/esm/extractors/block/index.js +2 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +27 -7
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/components/Provider.js +3 -2
- package/dist/esm/view/CardWithUrl/loader.js +6 -10
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +114 -0
- package/dist/esm/view/HoverCard/components/{hover-card-content.js → HoverCardContent.js} +12 -21
- package/dist/esm/view/HoverCard/index.js +24 -109
- package/dist/esm/view/HoverCard/styled.js +8 -0
- package/dist/esm/view/HoverCard/utils.js +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +9 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +2 -0
- package/dist/types/view/HoverCard/components/HoverCardComponent.d.ts +4 -0
- package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +9 -0
- package/dist/types/view/HoverCard/index.d.ts +2 -4
- package/dist/types/view/HoverCard/styled.d.ts +2 -0
- package/dist/types/view/HoverCard/types.d.ts +7 -0
- package/dist/types/view/HoverCard/utils.d.ts +1 -1
- package/package.json +3 -3
- package/report.api.md +864 -159
- package/dist/types/view/HoverCard/components/hover-card-content.d.ts +0 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import Popup from '@atlaskit/popup';
|
|
6
|
+
import { jsx } from '@emotion/core';
|
|
7
|
+
import React, { useCallback, useRef } from 'react';
|
|
8
|
+
import { useSmartLinkActions } from '../../../state/hooks-external/useSmartLinkActions';
|
|
9
|
+
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
10
|
+
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
11
|
+
import HoverCardContent from '../components/HoverCardContent';
|
|
12
|
+
import { HoverCardContainer } from '../styled';
|
|
13
|
+
import { SMART_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
14
|
+
export var hoverCardClassName = 'smart-links-hover-preview';
|
|
15
|
+
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
url = _ref.url,
|
|
18
|
+
analyticsHandler = _ref.analyticsHandler,
|
|
19
|
+
analytics = _ref.analytics;
|
|
20
|
+
var delay = 300;
|
|
21
|
+
|
|
22
|
+
var _React$useState = React.useState(false),
|
|
23
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24
|
+
isOpen = _React$useState2[0],
|
|
25
|
+
setIsOpen = _React$useState2[1];
|
|
26
|
+
|
|
27
|
+
var fadeOutTimeoutId = useRef();
|
|
28
|
+
var fadeInTimeoutId = useRef();
|
|
29
|
+
var cardOpenTime = useRef();
|
|
30
|
+
var renderers = useSmartLinkRenderers();
|
|
31
|
+
var linkState = useLinkState(url);
|
|
32
|
+
var hoverDisplay = 'card';
|
|
33
|
+
var invokeMethod = 'mouse_hover';
|
|
34
|
+
var hideCard = useCallback(function () {
|
|
35
|
+
//Check its previously open to avoid firing events when moving between the child and hover card components
|
|
36
|
+
if (isOpen === true && cardOpenTime.current) {
|
|
37
|
+
var hoverTime = Date.now() - cardOpenTime.current;
|
|
38
|
+
analytics.ui.hoverCardDismissedEvent('card', hoverTime, 'mouse_hover');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setIsOpen(false);
|
|
42
|
+
}, [analytics.ui, isOpen]);
|
|
43
|
+
var initHideCard = useCallback(function () {
|
|
44
|
+
if (fadeInTimeoutId.current) {
|
|
45
|
+
clearTimeout(fadeInTimeoutId.current);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
fadeOutTimeoutId.current = setTimeout(function () {
|
|
49
|
+
return hideCard();
|
|
50
|
+
}, delay);
|
|
51
|
+
}, [hideCard]);
|
|
52
|
+
var initShowCard = useCallback(function () {
|
|
53
|
+
if (fadeOutTimeoutId.current) {
|
|
54
|
+
clearTimeout(fadeOutTimeoutId.current);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fadeInTimeoutId.current = setTimeout(function () {
|
|
58
|
+
//Check if its previously closed to avoid firing events when moving between the child and hover card components
|
|
59
|
+
if (isOpen === false) {
|
|
60
|
+
cardOpenTime.current = Date.now();
|
|
61
|
+
analytics.ui.hoverCardViewedEvent(hoverDisplay, invokeMethod);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setIsOpen(true);
|
|
65
|
+
}, delay);
|
|
66
|
+
}, [delay, isOpen, analytics.ui]);
|
|
67
|
+
var linkActions = useSmartLinkActions({
|
|
68
|
+
url: url,
|
|
69
|
+
appearance: SMART_CARD_ANALYTICS_DISPLAY,
|
|
70
|
+
analyticsHandler: analyticsHandler
|
|
71
|
+
});
|
|
72
|
+
var onActionClick = useCallback(function (actionId) {
|
|
73
|
+
if (actionId === 'preview-content') {
|
|
74
|
+
hideCard();
|
|
75
|
+
}
|
|
76
|
+
}, [hideCard]); // Stop hover preview content to propagate event to parent.
|
|
77
|
+
|
|
78
|
+
var onClick = useCallback(function (e) {
|
|
79
|
+
return e.stopPropagation();
|
|
80
|
+
}, []);
|
|
81
|
+
return jsx(Popup, {
|
|
82
|
+
testId: "hover-card",
|
|
83
|
+
isOpen: isOpen,
|
|
84
|
+
onClose: hideCard,
|
|
85
|
+
placement: "bottom-start",
|
|
86
|
+
content: function content(_ref2) {
|
|
87
|
+
var update = _ref2.update;
|
|
88
|
+
return jsx("div", {
|
|
89
|
+
onMouseEnter: initShowCard,
|
|
90
|
+
onMouseLeave: initHideCard,
|
|
91
|
+
onClick: onClick,
|
|
92
|
+
css: HoverCardContainer // class name for trello to exclude click events
|
|
93
|
+
,
|
|
94
|
+
className: hoverCardClassName
|
|
95
|
+
}, jsx(HoverCardContent, {
|
|
96
|
+
analytics: analytics,
|
|
97
|
+
cardActions: linkActions,
|
|
98
|
+
cardState: linkState,
|
|
99
|
+
onActionClick: onActionClick,
|
|
100
|
+
onResolve: update,
|
|
101
|
+
renderers: renderers,
|
|
102
|
+
url: url
|
|
103
|
+
}));
|
|
104
|
+
},
|
|
105
|
+
trigger: function trigger(triggerProps) {
|
|
106
|
+
return jsx("span", _extends({}, triggerProps, {
|
|
107
|
+
onMouseEnter: initShowCard,
|
|
108
|
+
onMouseLeave: initHideCard
|
|
109
|
+
}), children);
|
|
110
|
+
},
|
|
111
|
+
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
112
|
+
|
|
113
|
+
});
|
|
114
|
+
};
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
+
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
2
|
+
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
1
3
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { getSimulatedMetadata, HOVER_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
4
|
+
import { ActionName, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
4
5
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
-
import {
|
|
6
|
+
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
7
|
+
import { getExtensionKey } from '../../../state/helpers';
|
|
8
|
+
import { isSpecialEvent } from '../../../utils';
|
|
6
9
|
import FlexibleCard from '../../FlexibleCard';
|
|
7
10
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
12
|
-
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
13
|
-
var flexibleUiOptions = {
|
|
14
|
-
hideElevation: true,
|
|
15
|
-
size: SmartLinkSize.Medium,
|
|
16
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
17
|
-
theme: SmartLinkTheme.Black,
|
|
18
|
-
hidePadding: true
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
|
|
11
|
+
import { flexibleUiOptions, footerBlockCss, metadataBlockCss, titleBlockCss } from '../styled';
|
|
12
|
+
import { getSimulatedMetadata, SMART_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
13
|
+
export var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
|
|
22
14
|
return {
|
|
23
15
|
name: ActionName.CustomAction,
|
|
24
16
|
icon: /*#__PURE__*/React.createElement(ShortcutIcon, {
|
|
@@ -37,8 +29,7 @@ var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
|
|
|
37
29
|
testId: 'hover-card-open-button'
|
|
38
30
|
};
|
|
39
31
|
};
|
|
40
|
-
|
|
41
|
-
var toFooterActions = function toFooterActions(cardActions, onActionClick) {
|
|
32
|
+
export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
|
|
42
33
|
return cardActions.map(function (action) {
|
|
43
34
|
return {
|
|
44
35
|
content: action.text,
|
|
@@ -69,14 +60,14 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
69
60
|
useEffect(function () {
|
|
70
61
|
// Since hover preview only render on resolved status,
|
|
71
62
|
// there is no need to check for statuses.
|
|
72
|
-
analytics.ui.renderSuccessEvent(
|
|
63
|
+
analytics.ui.renderSuccessEvent(SMART_CARD_ANALYTICS_DISPLAY, cardState.status);
|
|
73
64
|
}, [analytics.ui, cardState.status]);
|
|
74
65
|
var extensionKey = useMemo(function () {
|
|
75
66
|
return getExtensionKey(cardState.details);
|
|
76
67
|
}, [cardState.details]);
|
|
77
68
|
var onClick = useCallback(function (event) {
|
|
78
69
|
var isModifierKeyPressed = isSpecialEvent(event);
|
|
79
|
-
analytics.ui.cardClickedEvent(undefined,
|
|
70
|
+
analytics.ui.cardClickedEvent(undefined, SMART_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
|
|
80
71
|
}, [cardState.status, analytics.ui]);
|
|
81
72
|
var titleActions = useMemo(function () {
|
|
82
73
|
return [getOpenAction(url, analytics, onActionClick)];
|
|
@@ -1,121 +1,36 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
|
|
4
3
|
/** @jsx jsx */
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
6
|
-
import React, { useCallback, useRef } from 'react';
|
|
7
|
-
import Popup from '@atlaskit/popup';
|
|
8
|
-
import { useSmartLinkActions } from '../../state/hooks-external/useSmartLinkActions';
|
|
9
|
-
import { HoverCardContainer } from './styled';
|
|
10
4
|
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
13
8
|
import { useSmartLinkAnalytics } from '../../state/analytics';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
id =
|
|
21
|
-
|
|
22
|
-
createAnalyticsEvent =
|
|
9
|
+
import { fireSmartLinkEvent } from '../../utils/analytics';
|
|
10
|
+
import { HoverCardComponent } from './components/HoverCardComponent';
|
|
11
|
+
import { SMART_CARD_ANALYTICS_DISPLAY } from './utils';
|
|
12
|
+
|
|
13
|
+
var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
14
|
+
var url = props.url,
|
|
15
|
+
id = props.id,
|
|
16
|
+
children = props.children,
|
|
17
|
+
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
23
18
|
var analyticsHandler = useCallback(function (analyticsPayload) {
|
|
24
19
|
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
25
20
|
}, [createAnalyticsEvent]);
|
|
26
|
-
var delay = 300;
|
|
27
|
-
|
|
28
|
-
var _React$useState = React.useState(false),
|
|
29
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
-
isOpen = _React$useState2[0],
|
|
31
|
-
setIsOpen = _React$useState2[1];
|
|
32
|
-
|
|
33
|
-
var fadeOutTimeoutId = useRef();
|
|
34
|
-
var fadeInTimeoutId = useRef();
|
|
35
|
-
var cardOpenTime = useRef();
|
|
36
|
-
var renderers = useSmartLinkRenderers();
|
|
37
|
-
var linkState = useLinkState(url);
|
|
38
21
|
var analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (fadeInTimeoutId.current) {
|
|
50
|
-
clearTimeout(fadeInTimeoutId.current);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
fadeOutTimeoutId.current = setTimeout(function () {
|
|
54
|
-
return hideCard();
|
|
55
|
-
}, delay);
|
|
56
|
-
}, [hideCard]);
|
|
57
|
-
var initShowCard = useCallback(function () {
|
|
58
|
-
if (fadeOutTimeoutId.current) {
|
|
59
|
-
clearTimeout(fadeOutTimeoutId.current);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
fadeInTimeoutId.current = setTimeout(function () {
|
|
63
|
-
//Check if its previously closed to avoid firing events when moving between the child and hover card components
|
|
64
|
-
if (isOpen === false) {
|
|
65
|
-
cardOpenTime.current = Date.now();
|
|
66
|
-
analytics.ui.hoverCardViewedEvent('card', 'mouse_hover');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
setIsOpen(true);
|
|
70
|
-
}, delay);
|
|
71
|
-
}, [delay, isOpen, analytics.ui]);
|
|
72
|
-
var linkActions = useSmartLinkActions({
|
|
73
|
-
url: url,
|
|
74
|
-
appearance: HOVER_CARD_ANALYTICS_DISPLAY,
|
|
75
|
-
analyticsHandler: analyticsHandler
|
|
76
|
-
});
|
|
77
|
-
var onActionClick = useCallback(function (actionId) {
|
|
78
|
-
if (actionId === 'preview-content') {
|
|
79
|
-
hideCard();
|
|
80
|
-
}
|
|
81
|
-
}, [hideCard]); // Stop hover preview content to propagate event to parent.
|
|
82
|
-
|
|
83
|
-
var onClick = useCallback(function (e) {
|
|
84
|
-
return e.stopPropagation();
|
|
85
|
-
}, []);
|
|
86
|
-
return jsx(Popup, {
|
|
87
|
-
testId: "hover-card",
|
|
88
|
-
isOpen: isOpen,
|
|
89
|
-
onClose: hideCard,
|
|
90
|
-
placement: "bottom-start",
|
|
91
|
-
content: function content(_ref2) {
|
|
92
|
-
var update = _ref2.update;
|
|
93
|
-
return jsx("div", {
|
|
94
|
-
onMouseEnter: initShowCard,
|
|
95
|
-
onMouseLeave: initHideCard,
|
|
96
|
-
className: hoverCardClassName,
|
|
97
|
-
css: HoverCardContainer,
|
|
98
|
-
onClick: onClick
|
|
99
|
-
}, jsx(HoverCardContent, {
|
|
100
|
-
analytics: analytics,
|
|
101
|
-
cardActions: linkActions,
|
|
102
|
-
cardState: linkState,
|
|
103
|
-
onActionClick: onActionClick,
|
|
104
|
-
onResolve: update,
|
|
105
|
-
renderers: renderers,
|
|
106
|
-
url: url
|
|
107
|
-
}));
|
|
108
|
-
},
|
|
109
|
-
trigger: function trigger(triggerProps) {
|
|
110
|
-
return jsx("span", _extends({}, triggerProps, {
|
|
111
|
-
onMouseEnter: initShowCard,
|
|
112
|
-
onMouseLeave: initHideCard
|
|
113
|
-
}), children);
|
|
114
|
-
},
|
|
115
|
-
zIndex: 511 // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
116
|
-
|
|
117
|
-
});
|
|
22
|
+
var onError = useCallback(function (error, info) {
|
|
23
|
+
analytics.ui.renderFailedEvent(SMART_CARD_ANALYTICS_DISPLAY, id, error, info);
|
|
24
|
+
}, [analytics.ui, id]);
|
|
25
|
+
return jsx(ErrorBoundary, {
|
|
26
|
+
fallback: children,
|
|
27
|
+
onError: onError
|
|
28
|
+
}, jsx(HoverCardComponent, _extends({}, props, {
|
|
29
|
+
analyticsHandler: analyticsHandler,
|
|
30
|
+
analytics: analytics
|
|
31
|
+
}), children));
|
|
118
32
|
};
|
|
33
|
+
|
|
119
34
|
export var HoverCard = withAnalyticsContext({
|
|
120
35
|
source: 'smartLinkPreviewHoverCard'
|
|
121
|
-
})(withAnalyticsEvents()(
|
|
36
|
+
})(withAnalyticsEvents()(HoverCardWithErrorBoundary));
|
|
@@ -4,6 +4,14 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/core';
|
|
6
6
|
import { loadingPlaceholderClassName } from '../../index';
|
|
7
|
+
import { SmartLinkSize, SmartLinkTheme } from '../../constants';
|
|
8
|
+
export var flexibleUiOptions = {
|
|
9
|
+
hideElevation: true,
|
|
10
|
+
size: SmartLinkSize.Medium,
|
|
11
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
12
|
+
theme: SmartLinkTheme.Black,
|
|
13
|
+
hidePadding: true
|
|
14
|
+
};
|
|
7
15
|
var blockGap = '0.5rem';
|
|
8
16
|
var elementGap = '0.5rem';
|
|
9
17
|
var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementName } from '../../constants';
|
|
2
|
-
export var
|
|
2
|
+
export var SMART_CARD_ANALYTICS_DISPLAY = 'flexible';
|
|
3
3
|
export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
4
4
|
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5
5
|
var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ErrorInfo } from 'react';
|
|
1
2
|
import { CardType, APIError } from '@atlaskit/linking-common';
|
|
2
3
|
import { AnalyticsHandler } from '../../utils/types';
|
|
3
4
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -83,6 +84,14 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
|
|
|
83
84
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
84
85
|
*/
|
|
85
86
|
renderSuccessEvent: (display: CardInnerAppearance, status: CardType, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
87
|
+
/**
|
|
88
|
+
* This fires an event that represents when a Smart Link renders unsuccessfuly.
|
|
89
|
+
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
90
|
+
* @param id The unique ID for this Smart Link.
|
|
91
|
+
* @param error: An error representing why the Smart Link render failed.
|
|
92
|
+
* @param errorInfo: Additional details about the error including the stack trace.
|
|
93
|
+
*/
|
|
94
|
+
renderFailedEvent: (display: CardInnerAppearance, id: string | undefined, error: Error, errorInfo: ErrorInfo) => void;
|
|
86
95
|
/**
|
|
87
96
|
* This fires an event that represents a hover preview being opened.
|
|
88
97
|
* @param hoverDisplay Whether the hover preview was displayed as a card or embed.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { AnalyticsHandler } from '../../utils/types';
|
|
2
3
|
export declare function useSmartLink(id: string, url: string, dispatchAnalytics: AnalyticsHandler): {
|
|
3
4
|
state: import("@atlaskit/linking-common").CardState;
|
|
@@ -17,6 +18,7 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
17
18
|
hoverCardOpenLinkClickedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
|
|
18
19
|
closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
19
20
|
renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, status: import("@atlaskit/linking-common/types").CardType, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
21
|
+
renderFailedEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string | undefined, error: Error, errorInfo: import("react").ErrorInfo) => void;
|
|
20
22
|
hoverCardViewedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
21
23
|
hoverCardDismissedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, hoverTime: number, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
22
24
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsFacade } from '../../../state/analytics';
|
|
3
|
+
import { LinkAction } from '../../../state/hooks-external/useSmartLinkActions';
|
|
4
|
+
import { ActionItem } from '../../FlexibleCard/components/blocks/types';
|
|
5
|
+
import { HoverCardContentProps } from '../types';
|
|
6
|
+
export declare const getOpenAction: (url: string, analytics: AnalyticsFacade, onActionClick?: ((actionId: string) => void) | undefined) => ActionItem;
|
|
7
|
+
export declare const toFooterActions: (cardActions: LinkAction[], onActionClick?: ((actionId: string) => void) | undefined) => ActionItem[];
|
|
8
|
+
declare const HoverCardContent: React.FC<HoverCardContentProps>;
|
|
9
|
+
export default HoverCardContent;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { HoverCardProps } from './types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const HoverCardComponent: FC<HoverCardProps>;
|
|
5
|
-
export declare const HoverCard: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "id" | "analyticsContext" | "key" | "url"> & React.RefAttributes<any>>;
|
|
3
|
+
export declare const HoverCard: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "id" | "analyticsContext" | "key" | "url"> & import("react").RefAttributes<any>>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FlexibleUiOptions } from '../FlexibleCard/types';
|
|
2
|
+
export declare const flexibleUiOptions: FlexibleUiOptions;
|
|
1
3
|
export declare const HoverCardContainer: import("@emotion/utils").SerializedStyles;
|
|
2
4
|
export declare const titleBlockCss: import("@emotion/utils").SerializedStyles;
|
|
3
5
|
export declare const metadataBlockCss: import("@emotion/utils").SerializedStyles;
|
|
@@ -4,9 +4,16 @@ import { AnalyticsFacade } from '../../state/analytics';
|
|
|
4
4
|
import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
|
|
5
5
|
import { CardState } from '@atlaskit/linking-common';
|
|
6
6
|
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
7
|
+
import { AnalyticsHandler } from '../../utils/types';
|
|
8
|
+
import { ReactElement } from 'react';
|
|
7
9
|
export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
8
10
|
id?: string;
|
|
9
11
|
url: string;
|
|
12
|
+
children: ReactElement;
|
|
13
|
+
}
|
|
14
|
+
export interface HoverCardComponentProps extends HoverCardProps {
|
|
15
|
+
analyticsHandler: AnalyticsHandler;
|
|
16
|
+
analytics: AnalyticsFacade;
|
|
10
17
|
}
|
|
11
18
|
export declare type PreviewDisplay = 'card' | 'embed';
|
|
12
19
|
export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const SMART_CARD_ANALYTICS_DISPLAY = "flexible";
|
|
3
3
|
export declare const getSimulatedMetadata: (extensionKey?: string, types?: JsonLd.Primitives.ObjectType[]) => JsonLd.Primitives.Property<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.5",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
36
|
"@atlaskit/linking-common": "^1.2.0",
|
|
37
|
-
"@atlaskit/logo": "^13.
|
|
37
|
+
"@atlaskit/logo": "^13.8.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.1.0",
|
|
39
39
|
"@atlaskit/media-common": "^2.15.0",
|
|
40
40
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/link-provider": "^1.1.
|
|
61
|
+
"@atlaskit/link-provider": "^1.1.2",
|
|
62
62
|
"react": "^16.8.0",
|
|
63
63
|
"react-dom": "^16.8.0",
|
|
64
64
|
"react-intl-next": "npm:react-intl@^5.18.1"
|