@atlaskit/smart-card 21.3.0 → 22.1.1
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 +56 -0
- package/dist/cjs/extractors/block/index.js +6 -7
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +16 -19
- package/dist/cjs/state/actions/index.js +54 -10
- package/dist/cjs/state/analytics/types.js +5 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +429 -109
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -3
- package/dist/cjs/utils/analytics/analytics.js +241 -74
- package/dist/cjs/utils/analytics/index.js +32 -5
- package/dist/cjs/utils/mocks.js +28 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +2 -2
- package/dist/cjs/view/BlockCard/index.js +6 -5
- package/dist/cjs/view/CardWithUrl/component.js +27 -5
- package/dist/cjs/view/CardWithUrl/loader.js +6 -1
- package/dist/cjs/view/EmbedCard/index.js +3 -2
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +100 -0
- package/dist/cjs/view/EmbedModal/components/analytics/types.js +5 -0
- package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +5 -10
- package/dist/cjs/view/EmbedModal/index.js +54 -15
- package/dist/cjs/view/EmbedModal/types.js +9 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/cjs/view/HoverCard/index.js +6 -1
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/styled.js +2 -2
- package/dist/cjs/view/common/Modal.js +29 -4
- package/dist/cjs/view/common/ModalHeader.js +3 -2
- package/dist/es2019/extractors/block/index.js +6 -7
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +16 -10
- package/dist/es2019/state/actions/index.js +54 -10
- package/dist/es2019/state/analytics/types.js +1 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +424 -41
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -3
- package/dist/es2019/utils/analytics/analytics.js +254 -79
- package/dist/es2019/utils/analytics/index.js +32 -4
- package/dist/es2019/utils/mocks.js +26 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +3 -3
- package/dist/es2019/view/BlockCard/index.js +5 -4
- package/dist/es2019/view/CardWithUrl/component.js +27 -5
- package/dist/es2019/view/CardWithUrl/loader.js +6 -1
- package/dist/es2019/view/EmbedCard/index.js +3 -2
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +80 -0
- package/dist/es2019/view/EmbedModal/components/analytics/types.js +1 -0
- package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +5 -9
- package/dist/es2019/view/EmbedModal/index.js +46 -13
- package/dist/es2019/view/EmbedModal/types.js +6 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/es2019/view/HoverCard/index.js +6 -1
- package/dist/es2019/view/InlineCard/IconAndTitleLayout/styled.js +0 -2
- package/dist/es2019/view/common/Modal.js +27 -6
- package/dist/es2019/view/common/ModalHeader.js +3 -2
- package/dist/esm/extractors/block/index.js +6 -7
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +17 -19
- package/dist/esm/state/actions/index.js +54 -10
- package/dist/esm/state/analytics/types.js +1 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +428 -111
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -3
- package/dist/esm/utils/analytics/analytics.js +241 -74
- package/dist/esm/utils/analytics/index.js +31 -4
- package/dist/esm/utils/mocks.js +25 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
- package/dist/esm/view/BlockCard/index.js +5 -4
- package/dist/esm/view/CardWithUrl/component.js +27 -5
- package/dist/esm/view/CardWithUrl/loader.js +6 -1
- package/dist/esm/view/EmbedCard/index.js +3 -2
- package/dist/esm/view/EmbedModal/components/analytics/index.js +82 -0
- package/dist/esm/view/EmbedModal/components/analytics/types.js +1 -0
- package/dist/esm/view/EmbedModal/components/size-experiment/index.js +5 -10
- package/dist/esm/view/EmbedModal/index.js +52 -15
- package/dist/esm/view/EmbedModal/types.js +6 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/esm/view/HoverCard/index.js +6 -1
- package/dist/esm/view/InlineCard/IconAndTitleLayout/styled.js +2 -2
- package/dist/esm/view/common/Modal.js +28 -6
- package/dist/esm/view/common/ModalHeader.js +3 -2
- package/dist/types/extractors/block/types.d.ts +4 -2
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +7 -5
- package/dist/types/state/analytics/types.d.ts +9 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +41 -24
- package/dist/types/state/hooks/useSmartLink.d.ts +26 -18
- package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +6 -2
- package/dist/types/utils/analytics/analytics.d.ts +19 -21
- package/dist/types/utils/analytics/index.d.ts +2 -2
- package/dist/types/utils/analytics/types.d.ts +91 -0
- package/dist/types/utils/mocks.d.ts +48 -0
- package/dist/types/utils/types.d.ts +3 -1
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -0
- package/dist/types/view/BlockCard/index.d.ts +2 -2
- package/dist/types/view/BlockCard/types.d.ts +4 -4
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/EmbedCard/types.d.ts +2 -2
- package/dist/types/view/EmbedModal/components/analytics/index.d.ts +5 -0
- package/dist/types/view/EmbedModal/components/analytics/types.d.ts +6 -0
- package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +4 -3
- package/dist/types/view/EmbedModal/index.d.ts +3 -1
- package/dist/types/view/EmbedModal/types.d.ts +14 -4
- package/dist/types/view/common/Modal.d.ts +6 -8
- package/package.json +17 -17
- package/report.api.md +302 -107
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { uiRenderSuccessEvent, uiRenderFailedEvent } from '../../../utils/analytics';
|
|
2
1
|
import { extractDownloadUrl } from '../detail';
|
|
3
|
-
import {
|
|
2
|
+
import { extractPreview, extractProvider } from '@atlaskit/linking-common/extractors';
|
|
4
3
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
5
4
|
|
|
6
5
|
const getMetadataFromJsonLd = (jsonLd, platform) => {
|
|
@@ -39,7 +38,18 @@ const getInvokeOpts = (key, action, source) => ({
|
|
|
39
38
|
}
|
|
40
39
|
});
|
|
41
40
|
|
|
42
|
-
export const extractPreviewAction = (
|
|
41
|
+
export const extractPreviewAction = ({
|
|
42
|
+
extensionKey = 'empty-object-provider',
|
|
43
|
+
viewProps,
|
|
44
|
+
jsonLd,
|
|
45
|
+
handleInvoke,
|
|
46
|
+
testId,
|
|
47
|
+
platform,
|
|
48
|
+
origin,
|
|
49
|
+
source = 'block',
|
|
50
|
+
featureFlags,
|
|
51
|
+
analytics
|
|
52
|
+
}) => {
|
|
43
53
|
// Extract metadata from view props & raw JSON-LD.
|
|
44
54
|
const metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
45
55
|
const metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -51,14 +61,10 @@ export const extractPreviewAction = (extensionKey = 'empty-object-provider', vie
|
|
|
51
61
|
// Build action using instrumentation hooks.
|
|
52
62
|
const key = extensionKey;
|
|
53
63
|
const previewAction = PreviewAction({ ...metadata,
|
|
64
|
+
analytics,
|
|
65
|
+
origin,
|
|
54
66
|
featureFlags,
|
|
55
67
|
testId,
|
|
56
|
-
onOpen: () => {
|
|
57
|
-
handleAnalytics(uiRenderSuccessEvent('preview', 'resolved', key));
|
|
58
|
-
},
|
|
59
|
-
onOpenFailed: (error, errorInfo) => {
|
|
60
|
-
handleAnalytics(uiRenderFailedEvent('preview', error, errorInfo));
|
|
61
|
-
},
|
|
62
68
|
onDownloadActionClick: () => {
|
|
63
69
|
handleInvoke(getInvokeOpts(key, 'DownloadAction'));
|
|
64
70
|
},
|
|
@@ -68,7 +74,7 @@ export const extractPreviewAction = (extensionKey = 'empty-object-provider', vie
|
|
|
68
74
|
}); // Setup props to go through proper Redux 'invocation' flow
|
|
69
75
|
// for analytics, further state management if required in future.
|
|
70
76
|
|
|
71
|
-
const previewActionProps = getInvokeOpts(key, 'PreviewAction', source
|
|
77
|
+
const previewActionProps = getInvokeOpts(key, 'PreviewAction', source); // - Promise invoked by the action invocation handler; open preview.
|
|
72
78
|
|
|
73
79
|
previewActionProps.action.promise = previewAction.promise; // - Promise invoked on click of `Preview` on block card; trigger above promise.
|
|
74
80
|
|
|
@@ -155,24 +155,51 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
155
155
|
const services = getServices(details); // When authentication is triggered, let GAS know!
|
|
156
156
|
|
|
157
157
|
if (status === 'unauthorized') {
|
|
158
|
-
analytics.ui.authEvent(
|
|
158
|
+
analytics.ui.authEvent({
|
|
159
|
+
display: appearance,
|
|
160
|
+
definitionId,
|
|
161
|
+
extensionKey
|
|
162
|
+
});
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
if (status === 'forbidden') {
|
|
162
|
-
analytics.ui.authAlternateAccountEvent(
|
|
166
|
+
analytics.ui.authAlternateAccountEvent({
|
|
167
|
+
display: appearance,
|
|
168
|
+
definitionId,
|
|
169
|
+
extensionKey
|
|
170
|
+
});
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
if (services.length > 0) {
|
|
166
|
-
analytics.screen.authPopupEvent(
|
|
174
|
+
analytics.screen.authPopupEvent({
|
|
175
|
+
definitionId,
|
|
176
|
+
extensionKey
|
|
177
|
+
});
|
|
167
178
|
auth(services[0].url).then(() => {
|
|
168
|
-
analytics.track.appAccountConnected(
|
|
169
|
-
|
|
179
|
+
analytics.track.appAccountConnected({
|
|
180
|
+
definitionId,
|
|
181
|
+
extensionKey
|
|
182
|
+
});
|
|
183
|
+
analytics.operational.connectSucceededEvent({
|
|
184
|
+
id,
|
|
185
|
+
definitionId,
|
|
186
|
+
extensionKey
|
|
187
|
+
});
|
|
170
188
|
reload();
|
|
171
189
|
}, err => {
|
|
172
|
-
analytics.operational.connectFailedEvent(
|
|
190
|
+
analytics.operational.connectFailedEvent({
|
|
191
|
+
id,
|
|
192
|
+
definitionId,
|
|
193
|
+
extensionKey,
|
|
194
|
+
reason: err.type
|
|
195
|
+
});
|
|
173
196
|
|
|
174
197
|
if (err.type === 'auth_window_closed') {
|
|
175
|
-
analytics.ui.closedAuthEvent(
|
|
198
|
+
analytics.ui.closedAuthEvent({
|
|
199
|
+
display: appearance,
|
|
200
|
+
definitionId,
|
|
201
|
+
extensionKey
|
|
202
|
+
});
|
|
176
203
|
}
|
|
177
204
|
|
|
178
205
|
reload();
|
|
@@ -191,7 +218,13 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
191
218
|
|
|
192
219
|
try {
|
|
193
220
|
// Begin analytics instrumentation.
|
|
194
|
-
analytics.ui.actionClickedEvent(
|
|
221
|
+
analytics.ui.actionClickedEvent({
|
|
222
|
+
id,
|
|
223
|
+
extensionKey: key,
|
|
224
|
+
actionType: action.type,
|
|
225
|
+
display: source,
|
|
226
|
+
invokeType: opts.type
|
|
227
|
+
}); // Invoke action - either client-side or server-side.
|
|
195
228
|
|
|
196
229
|
let response;
|
|
197
230
|
|
|
@@ -202,11 +235,22 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
202
235
|
}
|
|
203
236
|
|
|
204
237
|
measure.mark(markName, 'resolved');
|
|
205
|
-
analytics.operational.invokeSucceededEvent(
|
|
238
|
+
analytics.operational.invokeSucceededEvent({
|
|
239
|
+
id,
|
|
240
|
+
extensionKey: key,
|
|
241
|
+
actionType: action.type,
|
|
242
|
+
display: source
|
|
243
|
+
});
|
|
206
244
|
return response;
|
|
207
245
|
} catch (err) {
|
|
208
246
|
measure.mark(markName, 'errored');
|
|
209
|
-
analytics.operational.invokeFailedEvent(
|
|
247
|
+
analytics.operational.invokeFailedEvent({
|
|
248
|
+
id,
|
|
249
|
+
extensionKey: key,
|
|
250
|
+
actionType: action.type,
|
|
251
|
+
display: source,
|
|
252
|
+
reason: err.message
|
|
253
|
+
});
|
|
210
254
|
throw err;
|
|
211
255
|
}
|
|
212
256
|
}, [id, analytics.ui, analytics.operational, connections.client]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|