@atlaskit/smart-card 19.1.23 → 19.1.26
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 +19 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +2 -1
- package/dist/cjs/utils/analytics/analytics.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/HoverCard/components/hover-card-content.js +16 -6
- package/dist/cjs/view/HoverCard/styled.js +10 -4
- package/dist/cjs/view/HoverCard/utils.js +2 -2
- package/dist/cjs/view/InlineCard/Frame/styled.js +1 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/components/hover-card-content.js +16 -7
- package/dist/es2019/view/HoverCard/styled.js +29 -2
- package/dist/es2019/view/HoverCard/utils.js +2 -2
- package/dist/es2019/view/InlineCard/Frame/styled.js +1 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +2 -1
- package/dist/esm/utils/analytics/analytics.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/components/hover-card-content.js +16 -7
- package/dist/esm/view/HoverCard/styled.js +5 -2
- package/dist/esm/view/HoverCard/utils.js +2 -2
- package/dist/esm/view/InlineCard/Frame/styled.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +1 -1
- package/dist/types/view/HoverCard/styled.d.ts +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 19.1.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`00c79cca5b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/00c79cca5b0) - hover card white space changes
|
|
8
|
+
|
|
9
|
+
## 19.1.25
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`de8de71a806`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de8de71a806) - Hover Preview: Fix Hover Preview analytics event details get applied to other Smart Links analytics
|
|
14
|
+
- [`ae023956743`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ae023956743) - Smart Links Analytics types are exported to allow their usage from outside of the package
|
|
15
|
+
|
|
16
|
+
## 19.1.24
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`cd729a0a41b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd729a0a41b) - [ux][ed-15030] Set the background color of smart cards properly in dark mode
|
|
21
|
+
|
|
3
22
|
## 19.1.23
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -92,7 +92,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchAnalytic
|
|
|
92
92
|
var location = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : defaultLocation;
|
|
93
93
|
var destinationProduct = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : extractedProduct;
|
|
94
94
|
var destinationSubproduct = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : extractedSubproduct;
|
|
95
|
-
|
|
95
|
+
var actionSubjectId = arguments.length > 9 ? arguments[9] : undefined;
|
|
96
|
+
return dispatchAnalytics((0, _analytics.uiCardClickedEvent)(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId));
|
|
96
97
|
},
|
|
97
98
|
|
|
98
99
|
/**
|
|
@@ -235,11 +235,11 @@ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(display,
|
|
|
235
235
|
|
|
236
236
|
exports.uiAuthAlternateAccountEvent = uiAuthAlternateAccountEvent;
|
|
237
237
|
|
|
238
|
-
var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct) {
|
|
238
|
+
var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId) {
|
|
239
239
|
return {
|
|
240
240
|
action: 'clicked',
|
|
241
241
|
actionSubject: 'smartLink',
|
|
242
|
-
actionSubjectId:
|
|
242
|
+
actionSubjectId: actionSubjectId,
|
|
243
243
|
eventType: 'ui',
|
|
244
244
|
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
245
245
|
id: id,
|
package/dist/cjs/version.json
CHANGED
|
@@ -29,15 +29,18 @@ var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"))
|
|
|
29
29
|
|
|
30
30
|
var _helpers = require("../../../state/helpers");
|
|
31
31
|
|
|
32
|
+
var _styled = require("../styled");
|
|
33
|
+
|
|
32
34
|
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); }
|
|
33
35
|
|
|
34
36
|
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; }
|
|
35
37
|
|
|
36
38
|
var flexibleUiOptions = {
|
|
37
39
|
hideElevation: true,
|
|
38
|
-
size: _constants.SmartLinkSize.
|
|
40
|
+
size: _constants.SmartLinkSize.Medium,
|
|
39
41
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
40
|
-
theme: _constants.SmartLinkTheme.Black
|
|
42
|
+
theme: _constants.SmartLinkTheme.Black,
|
|
43
|
+
hidePadding: true
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
var getOpenAction = function getOpenAction(url, analytics) {
|
|
@@ -89,7 +92,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
89
92
|
}, [cardState.details]);
|
|
90
93
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
91
94
|
var isModifierKeyPressed = (0, _utils2.isSpecialEvent)(event);
|
|
92
|
-
analytics.ui.cardClickedEvent(undefined, _utils.HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed);
|
|
95
|
+
analytics.ui.cardClickedEvent(undefined, _utils.HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
|
|
93
96
|
}, [cardState.status, analytics.ui]);
|
|
94
97
|
var titleActions = (0, _react.useMemo)(function () {
|
|
95
98
|
return [getOpenAction(url, analytics)];
|
|
@@ -112,13 +115,20 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
112
115
|
ui: flexibleUiOptions,
|
|
113
116
|
url: url
|
|
114
117
|
}, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, {
|
|
115
|
-
actions: titleActions
|
|
118
|
+
actions: titleActions,
|
|
119
|
+
overrideCss: _styled.titleBlockCss,
|
|
120
|
+
size: _constants.SmartLinkSize.Large,
|
|
121
|
+
position: _constants.SmartLinkPosition.Center
|
|
116
122
|
}), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
117
123
|
primary: primary,
|
|
118
124
|
secondary: secondary,
|
|
119
|
-
size: _constants.SmartLinkSize.
|
|
125
|
+
size: _constants.SmartLinkSize.Large,
|
|
126
|
+
overrideCss: _styled.metadataBlockCss,
|
|
127
|
+
maxLines: 1
|
|
120
128
|
}), body, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
121
|
-
actions: footerActions
|
|
129
|
+
actions: footerActions,
|
|
130
|
+
size: _constants.SmartLinkSize.Large,
|
|
131
|
+
overrideCss: _styled.footerBlockCss
|
|
122
132
|
}));
|
|
123
133
|
};
|
|
124
134
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.HoverCardContainer = void 0;
|
|
8
|
+
exports.titleBlockCss = exports.metadataBlockCss = exports.footerBlockCss = exports.HoverCardContainer = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -13,7 +13,13 @@ var _core = require("@emotion/core");
|
|
|
13
13
|
|
|
14
14
|
var _index = require("../../index");
|
|
15
15
|
|
|
16
|
-
var _templateObject;
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
17
17
|
|
|
18
|
-
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n
|
|
19
|
-
exports.HoverCardContainer = HoverCardContainer;
|
|
18
|
+
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: 24rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), _index.loadingPlaceholderClassName);
|
|
19
|
+
exports.HoverCardContainer = HoverCardContainer;
|
|
20
|
+
var titleBlockCss = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n gap: 0.5rem;\n"])));
|
|
21
|
+
exports.titleBlockCss = titleBlockCss;
|
|
22
|
+
var metadataBlockCss = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:first-of-type {\n flex-grow: 7;\n /* horizontal spacing between elements in group */\n > span {\n margin-right: 0.5rem;\n }\n }\n /* secondary element group */\n [data-smart-element-group]:last-of-type {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: 0.5rem;\n }\n }\n"])));
|
|
23
|
+
exports.metadataBlockCss = metadataBlockCss;
|
|
24
|
+
var footerBlockCss = (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n padding-top: 0.25rem;\n"])));
|
|
25
|
+
exports.footerBlockCss = footerBlockCss;
|
|
@@ -17,8 +17,8 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
17
17
|
case 'confluence-object-provider':
|
|
18
18
|
return {
|
|
19
19
|
metadata: {
|
|
20
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy
|
|
21
|
-
secondary: []
|
|
20
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy],
|
|
21
|
+
secondary: [_constants.ElementName.CommentCount, _constants.ElementName.ReactCount]
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -78,7 +78,7 @@ var Wrapper = _styled.default.a(_templateObject || (_templateObject = (0, _tagge
|
|
|
78
78
|
}), function (props) {
|
|
79
79
|
return props.withoutBackground ? '' : (0, _components.themed)({
|
|
80
80
|
light: (0, _tokens.token)('elevation.surface.raised', 'white'),
|
|
81
|
-
dark: (0, _tokens.token)('elevation.surface.raised',
|
|
81
|
+
dark: (0, _tokens.token)('elevation.surface.raised', BACKGROUND_COLOR_DARK)
|
|
82
82
|
});
|
|
83
83
|
}, function (props) {
|
|
84
84
|
return props.withoutBackground ? '' : (0, _components.themed)({
|
|
@@ -61,7 +61,7 @@ export const useSmartLinkAnalytics = (url, dispatchAnalytics, id, defaultLocatio
|
|
|
61
61
|
* @param destinationProduct The product the Smart Link is linked to.
|
|
62
62
|
* @returns
|
|
63
63
|
*/
|
|
64
|
-
cardClickedEvent: (id = defaultId, display, status, definitionId = extractedDefinitionId, extensionKey = extractedExtensionKey, isModifierKeyPressed, location = defaultLocation, destinationProduct = extractedProduct, destinationSubproduct = extractedSubproduct) => dispatchAnalytics(uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct)),
|
|
64
|
+
cardClickedEvent: (id = defaultId, display, status, definitionId = extractedDefinitionId, extensionKey = extractedExtensionKey, isModifierKeyPressed, location = defaultLocation, destinationProduct = extractedProduct, destinationSubproduct = extractedSubproduct, actionSubjectId) => dispatchAnalytics(uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId)),
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
@@ -174,10 +174,10 @@ export const uiAuthAlternateAccountEvent = (display, definitionId, extensionKey)
|
|
|
174
174
|
display
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
export const uiCardClickedEvent = (id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct) => ({
|
|
177
|
+
export const uiCardClickedEvent = (id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId) => ({
|
|
178
178
|
action: 'clicked',
|
|
179
179
|
actionSubject: 'smartLink',
|
|
180
|
-
actionSubjectId
|
|
180
|
+
actionSubjectId,
|
|
181
181
|
eventType: 'ui',
|
|
182
182
|
attributes: { ...context,
|
|
183
183
|
id,
|
package/dist/es2019/version.json
CHANGED
|
@@ -2,17 +2,19 @@ import React, { useCallback, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
3
3
|
import { getSimulatedMetadata, HOVER_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
4
4
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
5
|
+
import { ActionName, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
6
6
|
import FlexibleCard from '../../FlexibleCard';
|
|
7
7
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
8
8
|
import { isSpecialEvent } from '../../../utils';
|
|
9
9
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
10
|
import { getExtensionKey } from '../../../state/helpers';
|
|
11
|
+
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
11
12
|
const flexibleUiOptions = {
|
|
12
13
|
hideElevation: true,
|
|
13
|
-
size: SmartLinkSize.
|
|
14
|
+
size: SmartLinkSize.Medium,
|
|
14
15
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
15
|
-
theme: SmartLinkTheme.Black
|
|
16
|
+
theme: SmartLinkTheme.Black,
|
|
17
|
+
hidePadding: true
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
const getOpenAction = (url, analytics) => ({
|
|
@@ -54,7 +56,7 @@ const HoverCardContent = ({
|
|
|
54
56
|
const extensionKey = useMemo(() => getExtensionKey(cardState.details), [cardState.details]);
|
|
55
57
|
const onClick = useCallback(event => {
|
|
56
58
|
const isModifierKeyPressed = isSpecialEvent(event);
|
|
57
|
-
analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed);
|
|
59
|
+
analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
|
|
58
60
|
}, [cardState.status, analytics.ui]);
|
|
59
61
|
const titleActions = useMemo(() => [getOpenAction(url, analytics)], [url, analytics]);
|
|
60
62
|
const footerActions = useMemo(() => toFooterActions(cardActions), [cardActions]); //TODO: EDM-3224 deleted simulated and use real JsonLd
|
|
@@ -73,13 +75,20 @@ const HoverCardContent = ({
|
|
|
73
75
|
ui: flexibleUiOptions,
|
|
74
76
|
url: url
|
|
75
77
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
76
|
-
actions: titleActions
|
|
78
|
+
actions: titleActions,
|
|
79
|
+
overrideCss: titleBlockCss,
|
|
80
|
+
size: SmartLinkSize.Large,
|
|
81
|
+
position: SmartLinkPosition.Center
|
|
77
82
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
78
83
|
primary: primary,
|
|
79
84
|
secondary: secondary,
|
|
80
|
-
size: SmartLinkSize.
|
|
85
|
+
size: SmartLinkSize.Large,
|
|
86
|
+
overrideCss: metadataBlockCss,
|
|
87
|
+
maxLines: 1
|
|
81
88
|
}), body, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
82
|
-
actions: footerActions
|
|
89
|
+
actions: footerActions,
|
|
90
|
+
size: SmartLinkSize.Large,
|
|
91
|
+
overrideCss: footerBlockCss
|
|
83
92
|
}));
|
|
84
93
|
};
|
|
85
94
|
|
|
@@ -3,10 +3,37 @@ import { loadingPlaceholderClassName } from '../../index';
|
|
|
3
3
|
export const HoverCardContainer = css`
|
|
4
4
|
background: none;
|
|
5
5
|
border-width: 0;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
width: 24rem;
|
|
8
|
+
padding: 1rem;
|
|
8
9
|
|
|
9
10
|
.${loadingPlaceholderClassName} {
|
|
10
11
|
display: none;
|
|
11
12
|
}
|
|
13
|
+
`;
|
|
14
|
+
export const titleBlockCss = css`
|
|
15
|
+
gap: 0.5rem;
|
|
16
|
+
`;
|
|
17
|
+
export const metadataBlockCss = css`
|
|
18
|
+
gap: 0px;
|
|
19
|
+
|
|
20
|
+
/* primary element group */
|
|
21
|
+
[data-smart-element-group]:first-of-type {
|
|
22
|
+
flex-grow: 7;
|
|
23
|
+
/* horizontal spacing between elements in group */
|
|
24
|
+
> span {
|
|
25
|
+
margin-right: 0.5rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/* secondary element group */
|
|
29
|
+
[data-smart-element-group]:last-of-type {
|
|
30
|
+
flex-grow: 3;
|
|
31
|
+
/* horizontal spacing between elements in group */
|
|
32
|
+
> span {
|
|
33
|
+
margin-left: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const footerBlockCss = css`
|
|
38
|
+
padding-top: 0.25rem;
|
|
12
39
|
`;
|
|
@@ -5,8 +5,8 @@ export const getSimulatedMetadata = (extensionKey = '') => {
|
|
|
5
5
|
case 'confluence-object-provider':
|
|
6
6
|
return {
|
|
7
7
|
metadata: {
|
|
8
|
-
primary: [ElementName.AuthorGroup, ElementName.CreatedBy
|
|
9
|
-
secondary: []
|
|
8
|
+
primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
|
|
9
|
+
secondary: [ElementName.CommentCount, ElementName.ReactCount]
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -91,7 +91,7 @@ export const Wrapper = styled.a`
|
|
|
91
91
|
})};
|
|
92
92
|
background-color: ${props => props.withoutBackground ? '' : themed({
|
|
93
93
|
light: token('elevation.surface.raised', 'white'),
|
|
94
|
-
dark: token('elevation.surface.raised',
|
|
94
|
+
dark: token('elevation.surface.raised', BACKGROUND_COLOR_DARK)
|
|
95
95
|
})};
|
|
96
96
|
${props => props.withoutBackground ? '' : themed({
|
|
97
97
|
light: `box-shadow: ${token('elevation.shadow.raised', `0 1px 1px ${N50A}, 0 0 1px 1px ${N40A}`)};`,
|
|
@@ -80,7 +80,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
80
80
|
var location = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : defaultLocation;
|
|
81
81
|
var destinationProduct = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : extractedProduct;
|
|
82
82
|
var destinationSubproduct = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : extractedSubproduct;
|
|
83
|
-
|
|
83
|
+
var actionSubjectId = arguments.length > 9 ? arguments[9] : undefined;
|
|
84
|
+
return dispatchAnalytics(uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId));
|
|
84
85
|
},
|
|
85
86
|
|
|
86
87
|
/**
|
|
@@ -187,11 +187,11 @@ export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(di
|
|
|
187
187
|
})
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
-
export var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct) {
|
|
190
|
+
export var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId) {
|
|
191
191
|
return {
|
|
192
192
|
action: 'clicked',
|
|
193
193
|
actionSubject: 'smartLink',
|
|
194
|
-
actionSubjectId:
|
|
194
|
+
actionSubjectId: actionSubjectId,
|
|
195
195
|
eventType: 'ui',
|
|
196
196
|
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
197
197
|
id: id,
|
package/dist/esm/version.json
CHANGED
|
@@ -2,17 +2,19 @@ import React, { useCallback, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
3
3
|
import { getSimulatedMetadata, HOVER_CARD_ANALYTICS_DISPLAY } from '../utils';
|
|
4
4
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
5
|
+
import { ActionName, SmartLinkPosition, SmartLinkSize, SmartLinkTheme } from '../../../constants';
|
|
6
6
|
import FlexibleCard from '../../FlexibleCard';
|
|
7
7
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
8
8
|
import { isSpecialEvent } from '../../../utils';
|
|
9
9
|
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
10
|
import { getExtensionKey } from '../../../state/helpers';
|
|
11
|
+
import { titleBlockCss, metadataBlockCss, footerBlockCss } from '../styled';
|
|
11
12
|
var flexibleUiOptions = {
|
|
12
13
|
hideElevation: true,
|
|
13
|
-
size: SmartLinkSize.
|
|
14
|
+
size: SmartLinkSize.Medium,
|
|
14
15
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
15
|
-
theme: SmartLinkTheme.Black
|
|
16
|
+
theme: SmartLinkTheme.Black,
|
|
17
|
+
hidePadding: true
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
var getOpenAction = function getOpenAction(url, analytics) {
|
|
@@ -64,7 +66,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
64
66
|
}, [cardState.details]);
|
|
65
67
|
var onClick = useCallback(function (event) {
|
|
66
68
|
var isModifierKeyPressed = isSpecialEvent(event);
|
|
67
|
-
analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed);
|
|
69
|
+
analytics.ui.cardClickedEvent(undefined, HOVER_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
|
|
68
70
|
}, [cardState.status, analytics.ui]);
|
|
69
71
|
var titleActions = useMemo(function () {
|
|
70
72
|
return [getOpenAction(url, analytics)];
|
|
@@ -87,13 +89,20 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
87
89
|
ui: flexibleUiOptions,
|
|
88
90
|
url: url
|
|
89
91
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
90
|
-
actions: titleActions
|
|
92
|
+
actions: titleActions,
|
|
93
|
+
overrideCss: titleBlockCss,
|
|
94
|
+
size: SmartLinkSize.Large,
|
|
95
|
+
position: SmartLinkPosition.Center
|
|
91
96
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
92
97
|
primary: primary,
|
|
93
98
|
secondary: secondary,
|
|
94
|
-
size: SmartLinkSize.
|
|
99
|
+
size: SmartLinkSize.Large,
|
|
100
|
+
overrideCss: metadataBlockCss,
|
|
101
|
+
maxLines: 1
|
|
95
102
|
}), body, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
96
|
-
actions: footerActions
|
|
103
|
+
actions: footerActions,
|
|
104
|
+
size: SmartLinkSize.Large,
|
|
105
|
+
overrideCss: footerBlockCss
|
|
97
106
|
}));
|
|
98
107
|
};
|
|
99
108
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/core';
|
|
6
6
|
import { loadingPlaceholderClassName } from '../../index';
|
|
7
|
-
export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n
|
|
7
|
+
export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: 24rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), loadingPlaceholderClassName);
|
|
8
|
+
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 0.5rem;\n"])));
|
|
9
|
+
export var metadataBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:first-of-type {\n flex-grow: 7;\n /* horizontal spacing between elements in group */\n > span {\n margin-right: 0.5rem;\n }\n }\n /* secondary element group */\n [data-smart-element-group]:last-of-type {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: 0.5rem;\n }\n }\n"])));
|
|
10
|
+
export var footerBlockCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-top: 0.25rem;\n"])));
|
|
@@ -7,8 +7,8 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
7
7
|
case 'confluence-object-provider':
|
|
8
8
|
return {
|
|
9
9
|
metadata: {
|
|
10
|
-
primary: [ElementName.AuthorGroup, ElementName.CreatedBy
|
|
11
|
-
secondary: []
|
|
10
|
+
primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
|
|
11
|
+
secondary: [ElementName.CommentCount, ElementName.ReactCount]
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -63,7 +63,7 @@ export var Wrapper = styled.a(_templateObject || (_templateObject = _taggedTempl
|
|
|
63
63
|
}), function (props) {
|
|
64
64
|
return props.withoutBackground ? '' : themed({
|
|
65
65
|
light: token('elevation.surface.raised', 'white'),
|
|
66
|
-
dark: token('elevation.surface.raised',
|
|
66
|
+
dark: token('elevation.surface.raised', BACKGROUND_COLOR_DARK)
|
|
67
67
|
});
|
|
68
68
|
}, function (props) {
|
|
69
69
|
return props.withoutBackground ? '' : themed({
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/L
|
|
|
19
19
|
export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
|
|
20
20
|
export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock, } from './view/FlexibleCard/components/blocks';
|
|
21
21
|
export type { ActionItem, ElementItem, } from './view/FlexibleCard/components/blocks/types';
|
|
22
|
+
export type { AnalyticsAction, AnalyticsActionSubject, AnalyticsPayload, AnalyticsHandler, } from './utils/types';
|
|
@@ -45,7 +45,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
|
|
|
45
45
|
* @param destinationProduct The product the Smart Link is linked to.
|
|
46
46
|
* @returns
|
|
47
47
|
*/
|
|
48
|
-
cardClickedEvent: (id: string | undefined, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: DestinationProduct | string | undefined, destinationSubproduct?: DestinationSubproduct | string | undefined) => void;
|
|
48
|
+
cardClickedEvent: (id: string | undefined, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: DestinationProduct | string | undefined, destinationSubproduct?: DestinationSubproduct | string | undefined, actionSubjectId?: string | undefined) => void;
|
|
49
49
|
/**
|
|
50
50
|
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
51
51
|
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
@@ -12,7 +12,7 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
12
12
|
ui: {
|
|
13
13
|
authEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
14
14
|
authAlternateAccountEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
15
|
-
cardClickedEvent: (id: string | undefined, display: import("../../view/Card/types").CardInnerAppearance, status: import("@atlaskit/linking-common/types").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined) => void;
|
|
15
|
+
cardClickedEvent: (id: string | undefined, display: import("../../view/Card/types").CardInnerAppearance, status: import("@atlaskit/linking-common/types").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined, actionSubjectId?: string | undefined) => void;
|
|
16
16
|
actionClickedEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, invokeType: import("../../model/invoke-opts").InvokeType) => void;
|
|
17
17
|
hoverCardOpenLinkClickedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
|
|
18
18
|
closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
@@ -23,7 +23,7 @@ export declare const connectFailedEvent: (definitionId?: string | undefined, ext
|
|
|
23
23
|
export declare const trackAppAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
24
24
|
export declare const uiAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
25
25
|
export declare const uiAuthAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
26
|
-
export declare const uiCardClickedEvent: (id: string, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined) => AnalyticsPayload;
|
|
26
|
+
export declare const uiCardClickedEvent: (id: string, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined, actionSubjectId?: string | undefined) => AnalyticsPayload;
|
|
27
27
|
export declare const uiActionClickedEvent: (id: string, actionType: string, extensionKey?: string | undefined, display?: CardInnerAppearance | undefined) => AnalyticsPayload;
|
|
28
28
|
export declare const uiClosedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
29
29
|
export declare const screenAuthPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export declare const HoverCardContainer: import("@emotion/utils").SerializedStyles;
|
|
2
|
+
export declare const titleBlockCss: import("@emotion/utils").SerializedStyles;
|
|
3
|
+
export declare const metadataBlockCss: import("@emotion/utils").SerializedStyles;
|
|
4
|
+
export declare const footerBlockCss: import("@emotion/utils").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.26",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/linking-common": "^1.1.0",
|
|
37
37
|
"@atlaskit/logo": "^13.7.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.1.0",
|
|
39
|
-
"@atlaskit/media-common": "^2.
|
|
39
|
+
"@atlaskit/media-common": "^2.15.0",
|
|
40
40
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
41
41
|
"@atlaskit/outbound-auth-flow-client": "^3.3.0",
|
|
42
42
|
"@atlaskit/popup": "^1.3.0",
|