@atlaskit/smart-card 23.6.3 → 23.6.4
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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/index.js +5 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +40 -5
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/index.js +4 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +33 -5
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/index.js +5 -2
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +40 -6
- package/dist/types/view/BlockCard/views/flexible/FlexibleResolvedView.d.ts +1 -1
- package/dist/types/view/BlockCard/views/flexible/types.d.ts +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e402b41fc94`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e402b41fc94) - [ux] This change removes the icons on flexible block card actions, and also adds analytics for each of the flexible block card actions to maintain parity with the older block card.
|
|
8
|
+
|
|
3
9
|
## 23.6.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -114,7 +114,8 @@ var flexibleBlockCardElevationStyle = (0, _react.css)(_templateObject || (_templ
|
|
|
114
114
|
var BlockCard = function BlockCard(_ref) {
|
|
115
115
|
var _details$meta, _forbiddenViewProps$c;
|
|
116
116
|
|
|
117
|
-
var
|
|
117
|
+
var id = _ref.id,
|
|
118
|
+
url = _ref.url,
|
|
118
119
|
cardState = _ref.cardState,
|
|
119
120
|
authFlow = _ref.authFlow,
|
|
120
121
|
handleAuthorize = _ref.handleAuthorize,
|
|
@@ -146,12 +147,14 @@ var BlockCard = function BlockCard(_ref) {
|
|
|
146
147
|
hideElevation: true
|
|
147
148
|
};
|
|
148
149
|
var flexibleProps = {
|
|
150
|
+
id: id,
|
|
149
151
|
cardState: cardState,
|
|
150
152
|
url: url,
|
|
151
153
|
testId: testId,
|
|
152
154
|
onError: onError,
|
|
153
155
|
renderers: renderers,
|
|
154
|
-
ui: ui
|
|
156
|
+
ui: ui,
|
|
157
|
+
analytics: analytics
|
|
155
158
|
};
|
|
156
159
|
|
|
157
160
|
switch (status) {
|
|
@@ -21,6 +21,8 @@ var _blocks = require("../../../FlexibleCard/components/blocks");
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("../../../../constants");
|
|
23
23
|
|
|
24
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
25
|
+
|
|
24
26
|
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); }
|
|
25
27
|
|
|
26
28
|
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; }
|
|
@@ -31,13 +33,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
33
|
* @see FlexibleCardProps
|
|
32
34
|
*/
|
|
33
35
|
var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
34
|
-
var
|
|
36
|
+
var id = _ref.id,
|
|
37
|
+
cardState = _ref.cardState,
|
|
35
38
|
onClick = _ref.onClick,
|
|
36
39
|
onError = _ref.onError,
|
|
37
40
|
_ref$testId = _ref.testId,
|
|
38
41
|
testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
|
|
39
42
|
ui = _ref.ui,
|
|
40
|
-
url = _ref.url
|
|
43
|
+
url = _ref.url,
|
|
44
|
+
analytics = _ref.analytics;
|
|
41
45
|
|
|
42
46
|
var _useState = (0, _react.useState)(false),
|
|
43
47
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -47,6 +51,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
47
51
|
(0, _react.useEffect)(function () {
|
|
48
52
|
setIsPreviewBlockErrored(false);
|
|
49
53
|
}, [url, cardState]);
|
|
54
|
+
|
|
55
|
+
var _useState3 = (0, _react.useState)(function () {
|
|
56
|
+
return id ? id : (0, _uuid.default)();
|
|
57
|
+
}),
|
|
58
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 1),
|
|
59
|
+
analyticsId = _useState4[0];
|
|
60
|
+
|
|
50
61
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
51
62
|
appearance: "block",
|
|
52
63
|
cardState: cardState,
|
|
@@ -95,11 +106,35 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
95
106
|
}
|
|
96
107
|
}) : null, /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
97
108
|
actions: [{
|
|
98
|
-
name: _constants.ActionName.PreviewAction
|
|
109
|
+
name: _constants.ActionName.PreviewAction,
|
|
110
|
+
hideIcon: true,
|
|
111
|
+
onClick: function onClick() {
|
|
112
|
+
analytics.operational.invokeSucceededEvent({
|
|
113
|
+
id: analyticsId,
|
|
114
|
+
actionType: 'preview',
|
|
115
|
+
display: 'block'
|
|
116
|
+
});
|
|
117
|
+
}
|
|
99
118
|
}, {
|
|
100
|
-
name: _constants.ActionName.ViewAction
|
|
119
|
+
name: _constants.ActionName.ViewAction,
|
|
120
|
+
hideIcon: true,
|
|
121
|
+
onClick: function onClick() {
|
|
122
|
+
analytics.operational.invokeSucceededEvent({
|
|
123
|
+
id: analyticsId,
|
|
124
|
+
actionType: 'view',
|
|
125
|
+
display: 'block'
|
|
126
|
+
});
|
|
127
|
+
}
|
|
101
128
|
}, {
|
|
102
|
-
name: _constants.ActionName.DownloadAction
|
|
129
|
+
name: _constants.ActionName.DownloadAction,
|
|
130
|
+
hideIcon: true,
|
|
131
|
+
onClick: function onClick() {
|
|
132
|
+
analytics.operational.invokeSucceededEvent({
|
|
133
|
+
id: analyticsId,
|
|
134
|
+
actionType: 'download',
|
|
135
|
+
display: 'block'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
103
138
|
}]
|
|
104
139
|
}));
|
|
105
140
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -29,6 +29,7 @@ const flexibleBlockCardElevationStyle = css`
|
|
|
29
29
|
margin: 2px;
|
|
30
30
|
`;
|
|
31
31
|
export const BlockCard = ({
|
|
32
|
+
id,
|
|
32
33
|
url,
|
|
33
34
|
cardState,
|
|
34
35
|
authFlow,
|
|
@@ -66,12 +67,14 @@ export const BlockCard = ({
|
|
|
66
67
|
hideElevation: true
|
|
67
68
|
};
|
|
68
69
|
const flexibleProps = {
|
|
70
|
+
id,
|
|
69
71
|
cardState,
|
|
70
72
|
url,
|
|
71
73
|
testId,
|
|
72
74
|
onError,
|
|
73
75
|
renderers,
|
|
74
|
-
ui
|
|
76
|
+
ui,
|
|
77
|
+
analytics
|
|
75
78
|
};
|
|
76
79
|
|
|
77
80
|
switch (status) {
|
|
@@ -3,24 +3,28 @@ import FlexibleCard from '../../../FlexibleCard';
|
|
|
3
3
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
4
4
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
5
5
|
import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
|
|
6
|
-
|
|
6
|
+
import uuid from 'uuid';
|
|
7
7
|
/**
|
|
8
8
|
* This view represents a Block card that has an 'Resolved' status.
|
|
9
9
|
* @see SmartLinkStatus
|
|
10
10
|
* @see FlexibleCardProps
|
|
11
11
|
*/
|
|
12
|
+
|
|
12
13
|
const FlexibleResolvedView = ({
|
|
14
|
+
id,
|
|
13
15
|
cardState,
|
|
14
16
|
onClick,
|
|
15
17
|
onError,
|
|
16
18
|
testId = 'smart-block-resolved-view',
|
|
17
19
|
ui,
|
|
18
|
-
url
|
|
20
|
+
url,
|
|
21
|
+
analytics
|
|
19
22
|
}) => {
|
|
20
23
|
const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
|
|
21
24
|
useEffect(() => {
|
|
22
25
|
setIsPreviewBlockErrored(false);
|
|
23
26
|
}, [url, cardState]);
|
|
27
|
+
const [analyticsId] = useState(() => id ? id : uuid());
|
|
24
28
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
25
29
|
appearance: "block",
|
|
26
30
|
cardState: cardState,
|
|
@@ -69,11 +73,35 @@ const FlexibleResolvedView = ({
|
|
|
69
73
|
}
|
|
70
74
|
}) : null, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
71
75
|
actions: [{
|
|
72
|
-
name: ActionName.PreviewAction
|
|
76
|
+
name: ActionName.PreviewAction,
|
|
77
|
+
hideIcon: true,
|
|
78
|
+
onClick: () => {
|
|
79
|
+
analytics.operational.invokeSucceededEvent({
|
|
80
|
+
id: analyticsId,
|
|
81
|
+
actionType: 'preview',
|
|
82
|
+
display: 'block'
|
|
83
|
+
});
|
|
84
|
+
}
|
|
73
85
|
}, {
|
|
74
|
-
name: ActionName.ViewAction
|
|
86
|
+
name: ActionName.ViewAction,
|
|
87
|
+
hideIcon: true,
|
|
88
|
+
onClick: () => {
|
|
89
|
+
analytics.operational.invokeSucceededEvent({
|
|
90
|
+
id: analyticsId,
|
|
91
|
+
actionType: 'view',
|
|
92
|
+
display: 'block'
|
|
93
|
+
});
|
|
94
|
+
}
|
|
75
95
|
}, {
|
|
76
|
-
name: ActionName.DownloadAction
|
|
96
|
+
name: ActionName.DownloadAction,
|
|
97
|
+
hideIcon: true,
|
|
98
|
+
onClick: () => {
|
|
99
|
+
analytics.operational.invokeSucceededEvent({
|
|
100
|
+
id: analyticsId,
|
|
101
|
+
actionType: 'download',
|
|
102
|
+
display: 'block'
|
|
103
|
+
});
|
|
104
|
+
}
|
|
77
105
|
}]
|
|
78
106
|
}));
|
|
79
107
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -30,7 +30,8 @@ var flexibleBlockCardElevationStyle = css(_templateObject || (_templateObject =
|
|
|
30
30
|
export var BlockCard = function BlockCard(_ref) {
|
|
31
31
|
var _details$meta, _forbiddenViewProps$c;
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var id = _ref.id,
|
|
34
|
+
url = _ref.url,
|
|
34
35
|
cardState = _ref.cardState,
|
|
35
36
|
authFlow = _ref.authFlow,
|
|
36
37
|
handleAuthorize = _ref.handleAuthorize,
|
|
@@ -62,12 +63,14 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
62
63
|
hideElevation: true
|
|
63
64
|
};
|
|
64
65
|
var flexibleProps = {
|
|
66
|
+
id: id,
|
|
65
67
|
cardState: cardState,
|
|
66
68
|
url: url,
|
|
67
69
|
testId: testId,
|
|
68
70
|
onError: onError,
|
|
69
71
|
renderers: renderers,
|
|
70
|
-
ui: ui
|
|
72
|
+
ui: ui,
|
|
73
|
+
analytics: analytics
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
switch (status) {
|
|
@@ -4,20 +4,23 @@ import FlexibleCard from '../../../FlexibleCard';
|
|
|
4
4
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
5
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
|
|
7
|
-
|
|
7
|
+
import uuid from 'uuid';
|
|
8
8
|
/**
|
|
9
9
|
* This view represents a Block card that has an 'Resolved' status.
|
|
10
10
|
* @see SmartLinkStatus
|
|
11
11
|
* @see FlexibleCardProps
|
|
12
12
|
*/
|
|
13
|
+
|
|
13
14
|
var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
14
|
-
var
|
|
15
|
+
var id = _ref.id,
|
|
16
|
+
cardState = _ref.cardState,
|
|
15
17
|
onClick = _ref.onClick,
|
|
16
18
|
onError = _ref.onError,
|
|
17
19
|
_ref$testId = _ref.testId,
|
|
18
20
|
testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
|
|
19
21
|
ui = _ref.ui,
|
|
20
|
-
url = _ref.url
|
|
22
|
+
url = _ref.url,
|
|
23
|
+
analytics = _ref.analytics;
|
|
21
24
|
|
|
22
25
|
var _useState = useState(false),
|
|
23
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -27,6 +30,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
27
30
|
useEffect(function () {
|
|
28
31
|
setIsPreviewBlockErrored(false);
|
|
29
32
|
}, [url, cardState]);
|
|
33
|
+
|
|
34
|
+
var _useState3 = useState(function () {
|
|
35
|
+
return id ? id : uuid();
|
|
36
|
+
}),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
38
|
+
analyticsId = _useState4[0];
|
|
39
|
+
|
|
30
40
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
31
41
|
appearance: "block",
|
|
32
42
|
cardState: cardState,
|
|
@@ -75,11 +85,35 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
75
85
|
}
|
|
76
86
|
}) : null, /*#__PURE__*/React.createElement(FooterBlock, {
|
|
77
87
|
actions: [{
|
|
78
|
-
name: ActionName.PreviewAction
|
|
88
|
+
name: ActionName.PreviewAction,
|
|
89
|
+
hideIcon: true,
|
|
90
|
+
onClick: function onClick() {
|
|
91
|
+
analytics.operational.invokeSucceededEvent({
|
|
92
|
+
id: analyticsId,
|
|
93
|
+
actionType: 'preview',
|
|
94
|
+
display: 'block'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
79
97
|
}, {
|
|
80
|
-
name: ActionName.ViewAction
|
|
98
|
+
name: ActionName.ViewAction,
|
|
99
|
+
hideIcon: true,
|
|
100
|
+
onClick: function onClick() {
|
|
101
|
+
analytics.operational.invokeSucceededEvent({
|
|
102
|
+
id: analyticsId,
|
|
103
|
+
actionType: 'view',
|
|
104
|
+
display: 'block'
|
|
105
|
+
});
|
|
106
|
+
}
|
|
81
107
|
}, {
|
|
82
|
-
name: ActionName.DownloadAction
|
|
108
|
+
name: ActionName.DownloadAction,
|
|
109
|
+
hideIcon: true,
|
|
110
|
+
onClick: function onClick() {
|
|
111
|
+
analytics.operational.invokeSucceededEvent({
|
|
112
|
+
id: analyticsId,
|
|
113
|
+
actionType: 'download',
|
|
114
|
+
display: 'block'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
83
117
|
}]
|
|
84
118
|
}));
|
|
85
119
|
};
|
|
@@ -5,5 +5,5 @@ import { FlexibleBlockCardProps } from './types';
|
|
|
5
5
|
* @see SmartLinkStatus
|
|
6
6
|
* @see FlexibleCardProps
|
|
7
7
|
*/
|
|
8
|
-
declare const FlexibleResolvedView: ({ cardState, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
|
|
8
|
+
declare const FlexibleResolvedView: ({ id, cardState, onClick, onError, testId, ui, url, analytics, }: FlexibleBlockCardProps) => JSX.Element;
|
|
9
9
|
export default FlexibleResolvedView;
|
|
@@ -4,6 +4,7 @@ import { OnErrorCallback } from '../../../types';
|
|
|
4
4
|
import { FlexibleUiOptions } from '../../../FlexibleCard/types';
|
|
5
5
|
import { OnResolveCallback } from '../../../Card/types';
|
|
6
6
|
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
7
|
+
import { AnalyticsFacade } from '../../../../state/analytics';
|
|
7
8
|
export declare type FlexibleBlockCardProps = {
|
|
8
9
|
/**
|
|
9
10
|
* Determines the status and data of the Smart Link.
|
|
@@ -49,6 +50,14 @@ export declare type FlexibleBlockCardProps = {
|
|
|
49
50
|
* @see FlexibleUiOptions
|
|
50
51
|
*/
|
|
51
52
|
ui?: FlexibleUiOptions;
|
|
53
|
+
/**
|
|
54
|
+
* A unique id for this Smart Link instance, used for analytics.
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
/**
|
|
58
|
+
* An AnalyticsFacade object used for calling analytics.
|
|
59
|
+
*/
|
|
60
|
+
analytics: AnalyticsFacade;
|
|
52
61
|
/**
|
|
53
62
|
* Determines the URL of the Smart Link.
|
|
54
63
|
*/
|