@atlaskit/smart-card 26.27.0 → 26.27.2
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 +12 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +6 -2
- package/dist/cjs/state/helpers.js +11 -2
- package/dist/cjs/utils/analytics/analytics.js +5 -3
- package/dist/cjs/utils/mocks.js +53 -71
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +4 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +3 -3
- package/dist/cjs/view/RedesignedInlineCard/utils/withFrameStyleControl.js +2 -2
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -2
- package/dist/es2019/state/helpers.js +5 -0
- package/dist/es2019/utils/analytics/analytics.js +5 -3
- package/dist/es2019/utils/mocks.js +51 -71
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +5 -3
- package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +3 -3
- package/dist/es2019/view/RedesignedInlineCard/utils/withFrameStyleControl.js +2 -2
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +6 -2
- package/dist/esm/state/helpers.js +7 -0
- package/dist/esm/utils/analytics/analytics.js +5 -3
- package/dist/esm/utils/mocks.js +53 -71
- package/dist/esm/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +5 -3
- package/dist/esm/view/EmbedCard/components/styled.js +2 -2
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +3 -3
- package/dist/esm/view/RedesignedInlineCard/utils/withFrameStyleControl.js +2 -2
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types/state/helpers.d.ts +3 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +1 -0
- package/dist/types/utils/mocks.d.ts +42 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types-ts4.5/state/helpers.d.ts +3 -0
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +1 -0
- package/dist/types-ts4.5/utils/mocks.d.ts +42 -1
- package/package.json +5 -5
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +2 -1
|
@@ -35,6 +35,30 @@ export const mockByUrl = url => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
+
const errorResponseData = {
|
|
39
|
+
'@context': {
|
|
40
|
+
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
41
|
+
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
42
|
+
schema: 'http://schema.org/'
|
|
43
|
+
},
|
|
44
|
+
'@type': 'Object',
|
|
45
|
+
name: 'I love cheese',
|
|
46
|
+
url: 'https://some.url'
|
|
47
|
+
};
|
|
48
|
+
const successfulResponseData = {
|
|
49
|
+
...errorResponseData,
|
|
50
|
+
summary: 'Here is your serving of cheese: 🧀',
|
|
51
|
+
'schema:potentialAction': {
|
|
52
|
+
'@id': 'download',
|
|
53
|
+
'@type': 'DownloadAction',
|
|
54
|
+
identifier: 'object-provider',
|
|
55
|
+
name: 'Download'
|
|
56
|
+
},
|
|
57
|
+
'atlassian:downloadUrl': 'https://some-download.url',
|
|
58
|
+
preview: {
|
|
59
|
+
href: 'https://www.ilovecheese.com'
|
|
60
|
+
}
|
|
61
|
+
};
|
|
38
62
|
export const mocks = {
|
|
39
63
|
success: {
|
|
40
64
|
meta: {
|
|
@@ -44,27 +68,7 @@ export const mocks = {
|
|
|
44
68
|
definitionId: 'd1',
|
|
45
69
|
key: 'object-provider'
|
|
46
70
|
},
|
|
47
|
-
data:
|
|
48
|
-
'@context': {
|
|
49
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
50
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
51
|
-
schema: 'http://schema.org/'
|
|
52
|
-
},
|
|
53
|
-
'@type': 'Object',
|
|
54
|
-
name: 'I love cheese',
|
|
55
|
-
summary: 'Here is your serving of cheese: 🧀',
|
|
56
|
-
'schema:potentialAction': {
|
|
57
|
-
'@id': 'download',
|
|
58
|
-
'@type': 'DownloadAction',
|
|
59
|
-
identifier: 'object-provider',
|
|
60
|
-
name: 'Download'
|
|
61
|
-
},
|
|
62
|
-
'atlassian:downloadUrl': 'https://some-download.url',
|
|
63
|
-
preview: {
|
|
64
|
-
href: 'https://www.ilovecheese.com'
|
|
65
|
-
},
|
|
66
|
-
url: 'https://some.url'
|
|
67
|
-
}
|
|
71
|
+
data: successfulResponseData
|
|
68
72
|
},
|
|
69
73
|
notFound: {
|
|
70
74
|
meta: {
|
|
@@ -74,16 +78,7 @@ export const mocks = {
|
|
|
74
78
|
definitionId: 'd1',
|
|
75
79
|
key: 'object-provider'
|
|
76
80
|
},
|
|
77
|
-
data:
|
|
78
|
-
'@context': {
|
|
79
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
80
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
81
|
-
schema: 'http://schema.org/'
|
|
82
|
-
},
|
|
83
|
-
'@type': 'Object',
|
|
84
|
-
name: 'I love cheese',
|
|
85
|
-
url: 'https://some.url'
|
|
86
|
-
}
|
|
81
|
+
data: errorResponseData
|
|
87
82
|
},
|
|
88
83
|
forbidden: {
|
|
89
84
|
meta: {
|
|
@@ -97,16 +92,7 @@ export const mocks = {
|
|
|
97
92
|
definitionId: 'd1',
|
|
98
93
|
key: 'object-provider'
|
|
99
94
|
},
|
|
100
|
-
data:
|
|
101
|
-
'@context': {
|
|
102
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
103
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
104
|
-
schema: 'http://schema.org/'
|
|
105
|
-
},
|
|
106
|
-
'@type': 'Object',
|
|
107
|
-
name: 'I love cheese',
|
|
108
|
-
url: 'https://some.url'
|
|
109
|
-
}
|
|
95
|
+
data: errorResponseData
|
|
110
96
|
},
|
|
111
97
|
forbiddenWithNoAuth: {
|
|
112
98
|
meta: {
|
|
@@ -116,16 +102,7 @@ export const mocks = {
|
|
|
116
102
|
definitionId: 'd1',
|
|
117
103
|
key: 'object-provider'
|
|
118
104
|
},
|
|
119
|
-
data:
|
|
120
|
-
'@context': {
|
|
121
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
122
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
123
|
-
schema: 'http://schema.org/'
|
|
124
|
-
},
|
|
125
|
-
'@type': 'Object',
|
|
126
|
-
name: 'I love cheese',
|
|
127
|
-
url: 'https://some.url'
|
|
128
|
-
}
|
|
105
|
+
data: errorResponseData
|
|
129
106
|
},
|
|
130
107
|
unauthorized: {
|
|
131
108
|
meta: {
|
|
@@ -139,16 +116,7 @@ export const mocks = {
|
|
|
139
116
|
definitionId: 'd1',
|
|
140
117
|
key: 'object-provider'
|
|
141
118
|
},
|
|
142
|
-
data:
|
|
143
|
-
'@context': {
|
|
144
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
145
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
146
|
-
schema: 'http://schema.org/'
|
|
147
|
-
},
|
|
148
|
-
'@type': 'Object',
|
|
149
|
-
name: 'I love cheese',
|
|
150
|
-
url: 'https://some.url'
|
|
151
|
-
}
|
|
119
|
+
data: errorResponseData
|
|
152
120
|
},
|
|
153
121
|
unauthorizedWithNoAuth: {
|
|
154
122
|
meta: {
|
|
@@ -158,16 +126,7 @@ export const mocks = {
|
|
|
158
126
|
definitionId: 'd1',
|
|
159
127
|
key: 'object-provider'
|
|
160
128
|
},
|
|
161
|
-
data:
|
|
162
|
-
'@context': {
|
|
163
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
164
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
165
|
-
schema: 'http://schema.org/'
|
|
166
|
-
},
|
|
167
|
-
'@type': 'Object',
|
|
168
|
-
name: 'I love cheese',
|
|
169
|
-
url: 'https://some.url'
|
|
170
|
-
}
|
|
129
|
+
data: errorResponseData
|
|
171
130
|
},
|
|
172
131
|
actionSuccess: {
|
|
173
132
|
meta: {
|
|
@@ -191,6 +150,27 @@ export const mocks = {
|
|
|
191
150
|
product: 'spaghetti-product'
|
|
192
151
|
}
|
|
193
152
|
}
|
|
153
|
+
},
|
|
154
|
+
withDatasource: {
|
|
155
|
+
meta: {
|
|
156
|
+
visibility: 'public',
|
|
157
|
+
access: 'granted',
|
|
158
|
+
auth: [],
|
|
159
|
+
definitionId: 'd1',
|
|
160
|
+
key: 'object-provider'
|
|
161
|
+
},
|
|
162
|
+
data: successfulResponseData,
|
|
163
|
+
datasources: [{
|
|
164
|
+
key: 'datasource-jira-issues',
|
|
165
|
+
parameters: {
|
|
166
|
+
jql: '(text ~ "test*" OR summary ~ "test*") order by created DESC',
|
|
167
|
+
cloudId: '16f8b71e'
|
|
168
|
+
},
|
|
169
|
+
id: '1234-test-id-321',
|
|
170
|
+
ari: 'ari:cloud:linking-platform::datasource/1234-test-id-321',
|
|
171
|
+
description: 'For extracting a list of Jira issues using JQL',
|
|
172
|
+
name: 'Jira issues'
|
|
173
|
+
}]
|
|
194
174
|
}
|
|
195
175
|
};
|
|
196
176
|
export const fakeResponse = () => Promise.resolve(mocks.success);
|
|
@@ -41,7 +41,7 @@ const flexibleBlockCardElevationStyle = css`
|
|
|
41
41
|
const refreshedFlexibleBlockCardStyle = css`
|
|
42
42
|
& > div {
|
|
43
43
|
border-radius: ${"var(--ds-border-radius-200, 8px)"};
|
|
44
|
-
border: 1px solid ${`var(--ds-border
|
|
44
|
+
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
45
45
|
}
|
|
46
46
|
`;
|
|
47
47
|
export const flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
@@ -3,7 +3,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
4
|
import { isSpecialEvent } from '../../utils';
|
|
5
5
|
import * as measure from '../../utils/performance';
|
|
6
|
-
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
|
|
6
|
+
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct, getCanBeDatasource } from '../../state/helpers';
|
|
7
7
|
import { useSmartLink } from '../../state';
|
|
8
8
|
import { BlockCard } from '../BlockCard';
|
|
9
9
|
import { InlineCard } from '../InlineCard';
|
|
@@ -60,6 +60,7 @@ function Component({
|
|
|
60
60
|
const product = getProduct(state.details);
|
|
61
61
|
const subproduct = getSubproduct(state.details);
|
|
62
62
|
const services = getServices(state.details);
|
|
63
|
+
const canBeDatasource = getCanBeDatasource(state.details);
|
|
63
64
|
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
64
65
|
const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
|
|
65
66
|
const showServerActions = showServerActionsProp && platform !== 'mobile';
|
|
@@ -131,10 +132,11 @@ function Component({
|
|
|
131
132
|
status: state.status,
|
|
132
133
|
id,
|
|
133
134
|
definitionId,
|
|
134
|
-
extensionKey
|
|
135
|
+
extensionKey,
|
|
136
|
+
canBeDatasource
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
|
-
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
|
|
139
|
+
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
|
|
138
140
|
const onIframeDwell = useCallback((dwellTime, dwellPercentVisible) => {
|
|
139
141
|
analytics.ui.iframeDwelledEvent({
|
|
140
142
|
id,
|
|
@@ -122,7 +122,7 @@ const visibleStyles = `
|
|
|
122
122
|
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? `` : `background-color: ${`var(--ds-background-neutral-subtle, ${colors.N30})`};`}
|
|
123
123
|
|
|
124
124
|
&:after {
|
|
125
|
-
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? `border: 1px solid ${`var(--ds-border
|
|
125
|
+
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? `border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
126
126
|
background-color: ${themed({
|
|
127
127
|
light: "var(--ds-surface-raised, white)",
|
|
128
128
|
dark: `var(--ds-surface-raised, ${BACKGROUND_COLOR_DARK})`
|
|
@@ -198,7 +198,7 @@ export const TextWrapper = styled.div`
|
|
|
198
198
|
// manage scrolling behaviour.
|
|
199
199
|
export const Content = styled.div`
|
|
200
200
|
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? `${contentBorderRadius};
|
|
201
|
-
border: 1px solid ${`var(--ds-border
|
|
201
|
+
border: 1px solid ${`var(--ds-border, ${N40})`};` : borderRadius}
|
|
202
202
|
background-color: ${"var(--ds-surface-raised, white)"};
|
|
203
203
|
position: absolute;
|
|
204
204
|
z-index: 1;
|
|
@@ -10,6 +10,7 @@ import { extractMetadata, elementNamesToItems } from '../../../../../extractors/
|
|
|
10
10
|
import { messages } from '../../../../../messages';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { getCanBeDatasource } from '../../../../../state/helpers';
|
|
13
14
|
export const toFooterActions = (cardActions, onActionClick) => {
|
|
14
15
|
const followAction = {
|
|
15
16
|
hideIcon: true,
|
|
@@ -56,14 +57,16 @@ const HoverCardResolvedView = ({
|
|
|
56
57
|
extensionKey
|
|
57
58
|
}) => {
|
|
58
59
|
var _cardState$details;
|
|
60
|
+
const canBeDatasource = getCanBeDatasource(cardState.details);
|
|
59
61
|
useEffect(() => {
|
|
60
62
|
// Since this hover view is only rendered on resolved status,
|
|
61
63
|
// there is no need to check for statuses.
|
|
62
64
|
analytics.ui.renderSuccessEvent({
|
|
63
65
|
display: CardDisplay.HoverCardPreview,
|
|
64
|
-
status: cardState.status
|
|
66
|
+
status: cardState.status,
|
|
67
|
+
canBeDatasource
|
|
65
68
|
});
|
|
66
|
-
}, [analytics.ui, cardState.status]);
|
|
69
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
67
70
|
const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
|
|
68
71
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
69
72
|
const {
|
|
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
const PACKAGE_DATA = {
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "26.27.
|
|
11
|
+
packageVersion: "26.27.2",
|
|
12
12
|
componentName: 'linkUrl'
|
|
13
13
|
};
|
|
14
14
|
const Link = withLinkClickedEvent('a');
|
|
@@ -11,7 +11,7 @@ const selected = `
|
|
|
11
11
|
text-decoration: none;
|
|
12
12
|
}
|
|
13
13
|
&:hover {
|
|
14
|
-
border: 1px solid ${`var(--ds-border
|
|
14
|
+
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
17
|
const isInteractive = ({
|
|
@@ -81,8 +81,8 @@ const baseWrapperStyle = props => `
|
|
|
81
81
|
${isSelected(props)};
|
|
82
82
|
|
|
83
83
|
${props.withoutBackground ? '' : themed({
|
|
84
|
-
light: `border: 1px solid ${`var(--ds-border
|
|
85
|
-
dark: `border: 1px solid ${`var(--ds-border
|
|
84
|
+
light: `border: 1px solid ${`var(--ds-border, ${N40})`};`,
|
|
85
|
+
dark: `border: 1px solid ${`var(--ds-border, ${N500})`};`
|
|
86
86
|
})(props)}
|
|
87
87
|
&:hover {
|
|
88
88
|
${themed({
|
|
@@ -12,8 +12,8 @@ import { N500, N40 } from '@atlaskit/theme/colors';
|
|
|
12
12
|
export default ((Button, frameRef) => props => {
|
|
13
13
|
const setBorderStyle = () => {
|
|
14
14
|
const borderColor = themed({
|
|
15
|
-
light: `${`var(--ds-border
|
|
16
|
-
dark: `${`var(--ds-border
|
|
15
|
+
light: `${`var(--ds-border, ${N40})`}`,
|
|
16
|
+
dark: `${`var(--ds-border, ${N500})`}`
|
|
17
17
|
})();
|
|
18
18
|
const frameNode = frameRef.current;
|
|
19
19
|
if (frameNode) {
|
|
@@ -346,6 +346,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
346
346
|
* @param id The unique ID for this Smart Link.
|
|
347
347
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
348
348
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
349
|
+
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
349
350
|
*/
|
|
350
351
|
renderSuccessEvent: function renderSuccessEvent(_ref9) {
|
|
351
352
|
var display = _ref9.display,
|
|
@@ -356,7 +357,9 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
356
357
|
resourceType = _ref9.resourceType,
|
|
357
358
|
destinationProduct = _ref9.destinationProduct,
|
|
358
359
|
destinationSubproduct = _ref9.destinationSubproduct,
|
|
359
|
-
location = _ref9.location
|
|
360
|
+
location = _ref9.location,
|
|
361
|
+
_ref9$canBeDatasource = _ref9.canBeDatasource,
|
|
362
|
+
canBeDatasource = _ref9$canBeDatasource === void 0 ? false : _ref9$canBeDatasource;
|
|
360
363
|
var experienceId = id ? id : defaultId;
|
|
361
364
|
succeedUfoExperience('smart-link-rendered', experienceId, {
|
|
362
365
|
extensionKey: extensionKey,
|
|
@@ -375,7 +378,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
375
378
|
resourceType: resourceType,
|
|
376
379
|
destinationProduct: destinationProduct,
|
|
377
380
|
destinationSubproduct: destinationSubproduct,
|
|
378
|
-
location: location
|
|
381
|
+
location: location,
|
|
382
|
+
canBeDatasource: canBeDatasource
|
|
379
383
|
}), commonAttributes));
|
|
380
384
|
},
|
|
381
385
|
/**
|
|
@@ -55,4 +55,11 @@ export var getStatusDetails = function getStatusDetails(details) {
|
|
|
55
55
|
};
|
|
56
56
|
export var isFinalState = function isFinalState(status) {
|
|
57
57
|
return ['unauthorized', 'forbidden', 'errored', 'resolved', 'not_found'].indexOf(status) > -1;
|
|
58
|
+
};
|
|
59
|
+
export var getDatasources = function getDatasources(details) {
|
|
60
|
+
return details === null || details === void 0 ? void 0 : details.datasources;
|
|
61
|
+
};
|
|
62
|
+
export var getCanBeDatasource = function getCanBeDatasource(details) {
|
|
63
|
+
var datasources = getDatasources(details);
|
|
64
|
+
return !!datasources && datasources.length > 0;
|
|
58
65
|
};
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.27.
|
|
18
|
+
packageVersion: "26.27.2"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -487,7 +487,8 @@ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
|
|
|
487
487
|
definitionId = _ref20.definitionId,
|
|
488
488
|
destinationProduct = _ref20.destinationProduct,
|
|
489
489
|
destinationSubproduct = _ref20.destinationSubproduct,
|
|
490
|
-
location = _ref20.location
|
|
490
|
+
location = _ref20.location,
|
|
491
|
+
canBeDatasource = _ref20.canBeDatasource;
|
|
491
492
|
return {
|
|
492
493
|
action: 'renderSuccess',
|
|
493
494
|
actionSubject: 'smartLink',
|
|
@@ -499,7 +500,8 @@ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
|
|
|
499
500
|
destinationProduct: destinationProduct,
|
|
500
501
|
destinationSubproduct: destinationSubproduct,
|
|
501
502
|
location: location,
|
|
502
|
-
display: display
|
|
503
|
+
display: display,
|
|
504
|
+
canBeDatasource: canBeDatasource
|
|
503
505
|
})
|
|
504
506
|
};
|
|
505
507
|
};
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -4,9 +4,12 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
13
|
import { CardClient } from '@atlaskit/link-provider';
|
|
11
14
|
export var mockContext = {
|
|
12
15
|
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
@@ -44,6 +47,29 @@ export var mockByUrl = function mockByUrl(url) {
|
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
};
|
|
50
|
+
var errorResponseData = {
|
|
51
|
+
'@context': {
|
|
52
|
+
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
53
|
+
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
54
|
+
schema: 'http://schema.org/'
|
|
55
|
+
},
|
|
56
|
+
'@type': 'Object',
|
|
57
|
+
name: 'I love cheese',
|
|
58
|
+
url: 'https://some.url'
|
|
59
|
+
};
|
|
60
|
+
var successfulResponseData = _objectSpread(_objectSpread({}, errorResponseData), {}, {
|
|
61
|
+
summary: 'Here is your serving of cheese: 🧀',
|
|
62
|
+
'schema:potentialAction': {
|
|
63
|
+
'@id': 'download',
|
|
64
|
+
'@type': 'DownloadAction',
|
|
65
|
+
identifier: 'object-provider',
|
|
66
|
+
name: 'Download'
|
|
67
|
+
},
|
|
68
|
+
'atlassian:downloadUrl': 'https://some-download.url',
|
|
69
|
+
preview: {
|
|
70
|
+
href: 'https://www.ilovecheese.com'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
47
73
|
export var mocks = {
|
|
48
74
|
success: {
|
|
49
75
|
meta: {
|
|
@@ -53,27 +79,7 @@ export var mocks = {
|
|
|
53
79
|
definitionId: 'd1',
|
|
54
80
|
key: 'object-provider'
|
|
55
81
|
},
|
|
56
|
-
data:
|
|
57
|
-
'@context': {
|
|
58
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
59
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
60
|
-
schema: 'http://schema.org/'
|
|
61
|
-
},
|
|
62
|
-
'@type': 'Object',
|
|
63
|
-
name: 'I love cheese',
|
|
64
|
-
summary: 'Here is your serving of cheese: 🧀',
|
|
65
|
-
'schema:potentialAction': {
|
|
66
|
-
'@id': 'download',
|
|
67
|
-
'@type': 'DownloadAction',
|
|
68
|
-
identifier: 'object-provider',
|
|
69
|
-
name: 'Download'
|
|
70
|
-
},
|
|
71
|
-
'atlassian:downloadUrl': 'https://some-download.url',
|
|
72
|
-
preview: {
|
|
73
|
-
href: 'https://www.ilovecheese.com'
|
|
74
|
-
},
|
|
75
|
-
url: 'https://some.url'
|
|
76
|
-
}
|
|
82
|
+
data: successfulResponseData
|
|
77
83
|
},
|
|
78
84
|
notFound: {
|
|
79
85
|
meta: {
|
|
@@ -83,16 +89,7 @@ export var mocks = {
|
|
|
83
89
|
definitionId: 'd1',
|
|
84
90
|
key: 'object-provider'
|
|
85
91
|
},
|
|
86
|
-
data:
|
|
87
|
-
'@context': {
|
|
88
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
89
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
90
|
-
schema: 'http://schema.org/'
|
|
91
|
-
},
|
|
92
|
-
'@type': 'Object',
|
|
93
|
-
name: 'I love cheese',
|
|
94
|
-
url: 'https://some.url'
|
|
95
|
-
}
|
|
92
|
+
data: errorResponseData
|
|
96
93
|
},
|
|
97
94
|
forbidden: {
|
|
98
95
|
meta: {
|
|
@@ -106,16 +103,7 @@ export var mocks = {
|
|
|
106
103
|
definitionId: 'd1',
|
|
107
104
|
key: 'object-provider'
|
|
108
105
|
},
|
|
109
|
-
data:
|
|
110
|
-
'@context': {
|
|
111
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
112
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
113
|
-
schema: 'http://schema.org/'
|
|
114
|
-
},
|
|
115
|
-
'@type': 'Object',
|
|
116
|
-
name: 'I love cheese',
|
|
117
|
-
url: 'https://some.url'
|
|
118
|
-
}
|
|
106
|
+
data: errorResponseData
|
|
119
107
|
},
|
|
120
108
|
forbiddenWithNoAuth: {
|
|
121
109
|
meta: {
|
|
@@ -125,16 +113,7 @@ export var mocks = {
|
|
|
125
113
|
definitionId: 'd1',
|
|
126
114
|
key: 'object-provider'
|
|
127
115
|
},
|
|
128
|
-
data:
|
|
129
|
-
'@context': {
|
|
130
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
131
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
132
|
-
schema: 'http://schema.org/'
|
|
133
|
-
},
|
|
134
|
-
'@type': 'Object',
|
|
135
|
-
name: 'I love cheese',
|
|
136
|
-
url: 'https://some.url'
|
|
137
|
-
}
|
|
116
|
+
data: errorResponseData
|
|
138
117
|
},
|
|
139
118
|
unauthorized: {
|
|
140
119
|
meta: {
|
|
@@ -148,16 +127,7 @@ export var mocks = {
|
|
|
148
127
|
definitionId: 'd1',
|
|
149
128
|
key: 'object-provider'
|
|
150
129
|
},
|
|
151
|
-
data:
|
|
152
|
-
'@context': {
|
|
153
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
154
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
155
|
-
schema: 'http://schema.org/'
|
|
156
|
-
},
|
|
157
|
-
'@type': 'Object',
|
|
158
|
-
name: 'I love cheese',
|
|
159
|
-
url: 'https://some.url'
|
|
160
|
-
}
|
|
130
|
+
data: errorResponseData
|
|
161
131
|
},
|
|
162
132
|
unauthorizedWithNoAuth: {
|
|
163
133
|
meta: {
|
|
@@ -167,16 +137,7 @@ export var mocks = {
|
|
|
167
137
|
definitionId: 'd1',
|
|
168
138
|
key: 'object-provider'
|
|
169
139
|
},
|
|
170
|
-
data:
|
|
171
|
-
'@context': {
|
|
172
|
-
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
173
|
-
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
|
174
|
-
schema: 'http://schema.org/'
|
|
175
|
-
},
|
|
176
|
-
'@type': 'Object',
|
|
177
|
-
name: 'I love cheese',
|
|
178
|
-
url: 'https://some.url'
|
|
179
|
-
}
|
|
140
|
+
data: errorResponseData
|
|
180
141
|
},
|
|
181
142
|
actionSuccess: {
|
|
182
143
|
meta: {
|
|
@@ -200,6 +161,27 @@ export var mocks = {
|
|
|
200
161
|
product: 'spaghetti-product'
|
|
201
162
|
}
|
|
202
163
|
}
|
|
164
|
+
},
|
|
165
|
+
withDatasource: {
|
|
166
|
+
meta: {
|
|
167
|
+
visibility: 'public',
|
|
168
|
+
access: 'granted',
|
|
169
|
+
auth: [],
|
|
170
|
+
definitionId: 'd1',
|
|
171
|
+
key: 'object-provider'
|
|
172
|
+
},
|
|
173
|
+
data: successfulResponseData,
|
|
174
|
+
datasources: [{
|
|
175
|
+
key: 'datasource-jira-issues',
|
|
176
|
+
parameters: {
|
|
177
|
+
jql: '(text ~ "test*" OR summary ~ "test*") order by created DESC',
|
|
178
|
+
cloudId: '16f8b71e'
|
|
179
|
+
},
|
|
180
|
+
id: '1234-test-id-321',
|
|
181
|
+
ari: 'ari:cloud:linking-platform::datasource/1234-test-id-321',
|
|
182
|
+
description: 'For extracting a list of Jira issues using JQL',
|
|
183
|
+
name: 'Jira issues'
|
|
184
|
+
}]
|
|
203
185
|
}
|
|
204
186
|
};
|
|
205
187
|
export var fakeResponse = function fakeResponse() {
|
|
@@ -10,5 +10,5 @@ export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedT
|
|
|
10
10
|
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
11
11
|
export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
|
|
12
12
|
var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
|
|
13
|
-
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border
|
|
13
|
+
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(N40, ")"));
|
|
14
14
|
export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
@@ -3,7 +3,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
4
|
import { isSpecialEvent } from '../../utils';
|
|
5
5
|
import * as measure from '../../utils/performance';
|
|
6
|
-
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
|
|
6
|
+
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct, getCanBeDatasource } from '../../state/helpers';
|
|
7
7
|
import { useSmartLink } from '../../state';
|
|
8
8
|
import { BlockCard } from '../BlockCard';
|
|
9
9
|
import { InlineCard } from '../InlineCard';
|
|
@@ -57,6 +57,7 @@ function Component(_ref) {
|
|
|
57
57
|
var product = getProduct(state.details);
|
|
58
58
|
var subproduct = getSubproduct(state.details);
|
|
59
59
|
var services = getServices(state.details);
|
|
60
|
+
var canBeDatasource = getCanBeDatasource(state.details);
|
|
60
61
|
var isFlexibleUi = useMemo(function () {
|
|
61
62
|
return isFlexibleUiCard(children);
|
|
62
63
|
}, [children]);
|
|
@@ -134,10 +135,11 @@ function Component(_ref) {
|
|
|
134
135
|
status: state.status,
|
|
135
136
|
id: id,
|
|
136
137
|
definitionId: definitionId,
|
|
137
|
-
extensionKey: extensionKey
|
|
138
|
+
extensionKey: extensionKey,
|
|
139
|
+
canBeDatasource: canBeDatasource
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
|
-
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
|
|
142
|
+
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
|
|
141
143
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
142
144
|
analytics.ui.iframeDwelledEvent({
|
|
143
145
|
id: id,
|
|
@@ -55,7 +55,7 @@ var height = function height(_ref5) {
|
|
|
55
55
|
var wrapperStyles = function wrapperStyles(props) {
|
|
56
56
|
return "\n ".concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? wrapperBorderRadius : borderRadius, "\n ").concat(minWidth(props), "\n ").concat(maxWidth(props), "\n ").concat(getInteractiveStyles(props), "\n ").concat(visible(props), "\n display: inline-flex;\n flex-direction: column;\n box-sizing: border-box;\n font-family: ").concat(fontFamily(), ";\n width: 100%;\n user-select: none;\n line-height: initial;\n transition: background 0.3s;\n position: relative;\n ").concat(height(props), ";\n ").concat(selected(props), "\n\n &:after {\n content: '';\n transition: background 0.3s, box-shadow 0.3s;\n position: absolute;\n width: calc(100% + ", "var(--ds-space-200, 16px)", ");\n height: calc(100% + ", "var(--ds-space-100, 8px)", ");\n left: ", "var(--ds-space-negative-100, -8px)", ";\n ").concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? wrapperBorderRadius : "background: transparent;\n ".concat(borderRadius), "\n }\n");
|
|
57
57
|
};
|
|
58
|
-
var visibleStyles = "\n ".concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "" : "background-color: ".concat("var(--ds-background-neutral-subtle, ".concat(colors.N30, ")"), ";"), "\n\n &:after {\n ").concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "border: 1px solid ".concat("var(--ds-border
|
|
58
|
+
var visibleStyles = "\n ".concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "" : "background-color: ".concat("var(--ds-background-neutral-subtle, ".concat(colors.N30, ")"), ";"), "\n\n &:after {\n ").concat(getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "border: 1px solid ".concat("var(--ds-border, ".concat(N40, ")"), ";\n background-color: ", themed({
|
|
59
59
|
light: "var(--ds-surface-raised, white)",
|
|
60
60
|
dark: "var(--ds-surface-raised, ".concat(BACKGROUND_COLOR_DARK, ")")
|
|
61
61
|
})(), ";") : "background: ".concat("var(--ds-background-neutral, ".concat(colors.N30, ")"), " !important;"), "\n }\n .embed-header {\n opacity: 1;\n }");
|
|
@@ -92,7 +92,7 @@ export var TextWrapper = styled.div(_templateObject5 || (_templateObject5 = _tag
|
|
|
92
92
|
// NB: `overflow` is kept as `hidden` since
|
|
93
93
|
// the internal contents of the `iframe` should
|
|
94
94
|
// manage scrolling behaviour.
|
|
95
|
-
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n\n ", "\n\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "".concat(contentBorderRadius, ";\n border: 1px solid ", "var(--ds-border
|
|
95
|
+
export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n\n ", "\n\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "".concat(contentBorderRadius, ";\n border: 1px solid ", "var(--ds-border, ".concat(N40, ")"), ";") : borderRadius, "var(--ds-surface-raised, white)", function (_ref9) {
|
|
96
96
|
var isInteractive = _ref9.isInteractive;
|
|
97
97
|
if (isInteractive && !getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design')) {
|
|
98
98
|
return "\n .".concat(className, ":hover & {\n box-shadow: ", "var(--ds-shadow-overlay, 0 4px 8px -2px rgba(23, 43, 77, 0.32), 0 0 1px rgba(23, 43, 77, 0.25))", ";\n }\n ");
|
|
@@ -11,6 +11,7 @@ import { extractMetadata, elementNamesToItems } from '../../../../../extractors/
|
|
|
11
11
|
import { messages } from '../../../../../messages';
|
|
12
12
|
import { FormattedMessage } from 'react-intl-next';
|
|
13
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { getCanBeDatasource } from '../../../../../state/helpers';
|
|
14
15
|
export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
|
|
15
16
|
var followAction = {
|
|
16
17
|
hideIcon: true,
|
|
@@ -58,14 +59,16 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
58
59
|
cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
|
|
59
60
|
onActionClick = _ref.onActionClick,
|
|
60
61
|
extensionKey = _ref.extensionKey;
|
|
62
|
+
var canBeDatasource = getCanBeDatasource(cardState.details);
|
|
61
63
|
useEffect(function () {
|
|
62
64
|
// Since this hover view is only rendered on resolved status,
|
|
63
65
|
// there is no need to check for statuses.
|
|
64
66
|
analytics.ui.renderSuccessEvent({
|
|
65
67
|
display: CardDisplay.HoverCardPreview,
|
|
66
|
-
status: cardState.status
|
|
68
|
+
status: cardState.status,
|
|
69
|
+
canBeDatasource: canBeDatasource
|
|
67
70
|
});
|
|
68
|
-
}, [analytics.ui, cardState.status]);
|
|
71
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
69
72
|
var footerActions = useMemo(function () {
|
|
70
73
|
return toFooterActions(cardActions, onActionClick);
|
|
71
74
|
}, [cardActions, onActionClick]);
|