@atlaskit/smart-card 32.7.7 → 32.7.9
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 +16 -0
- package/analytics.spec.yaml +31 -5
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +7 -6
- package/dist/cjs/state/actions/index.js +13 -38
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +59 -306
- package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +2 -7
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +99 -6
- package/dist/cjs/utils/analytics/analytics.js +27 -301
- package/dist/cjs/utils/analytics/index.js +0 -66
- package/dist/cjs/view/CardWithUrl/component.js +7 -23
- package/dist/cjs/view/CardWithUrl/loader.js +14 -5
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +88 -32
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -2
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +21 -53
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +0 -1
- package/dist/cjs/view/HoverCard/index.js +15 -8
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/UnauthorisedViewContent.js +3 -9
- package/dist/es2019/extractors/action/extract-invoke-preview-action.js +8 -7
- package/dist/es2019/state/actions/index.js +13 -38
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -239
- package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +0 -3
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +97 -2
- package/dist/es2019/utils/analytics/analytics.js +2 -286
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +8 -24
- package/dist/es2019/view/CardWithUrl/loader.js +9 -1
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +88 -32
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +21 -53
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +0 -1
- package/dist/es2019/view/HoverCard/index.js +10 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/UnauthorisedViewContent.js +3 -9
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +8 -7
- package/dist/esm/state/actions/index.js +13 -38
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +60 -307
- package/dist/esm/utils/analytics/LinkAnalyticsContext.js +2 -7
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +95 -5
- package/dist/esm/utils/analytics/analytics.js +26 -300
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +8 -24
- package/dist/esm/view/CardWithUrl/loader.js +14 -5
- package/dist/esm/view/EmbedModal/components/analytics/index.js +88 -32
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +21 -53
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +0 -1
- package/dist/esm/view/HoverCard/index.js +14 -4
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/UnauthorisedViewContent.js +3 -9
- package/dist/types/common/analytics/generated/analytics.types.d.ts +16 -2
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +6 -102
- package/dist/types/state/hooks/useSmartLink.d.ts +0 -12
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +14 -0
- package/dist/types/utils/analytics/analytics.d.ts +1 -51
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +0 -60
- package/dist/types/utils/mocks.d.ts +0 -12
- package/dist/types/view/EmbedModal/components/analytics/types.d.ts +1 -0
- package/dist/types/view/HoverCard/components/HoverCardComponent.d.ts +1 -0
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +1 -1
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +16 -2
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +6 -102
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -12
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +14 -0
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -51
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -60
- package/dist/types-ts4.5/utils/mocks.d.ts +0 -12
- package/dist/types-ts4.5/view/EmbedModal/components/analytics/types.d.ts +1 -0
- package/dist/types-ts4.5/view/HoverCard/components/HoverCardComponent.d.ts +1 -0
- package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +1 -1
- package/package.json +2 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
2
2
|
import { ActionName, CardAction } from '../../index';
|
|
3
|
-
import {
|
|
3
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
4
4
|
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
5
5
|
import { openEmbedModal } from '../../view/EmbedModal/utils';
|
|
6
6
|
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
@@ -27,12 +27,16 @@ export const extractInvokePreviewAction = param => {
|
|
|
27
27
|
const src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
28
28
|
if (src) {
|
|
29
29
|
const url = extractLink(data);
|
|
30
|
+
const extensionKey = getExtensionKey(response);
|
|
30
31
|
return {
|
|
31
32
|
actionFn: async () => {
|
|
32
33
|
var _extractProvider;
|
|
33
34
|
return openEmbedModal({
|
|
34
35
|
fireEvent,
|
|
36
|
+
extensionKey,
|
|
37
|
+
id,
|
|
35
38
|
invokeDownloadAction: extractInvokeDownloadAction(param),
|
|
39
|
+
invokeViewAction: extractInvokeViewAction(param, true),
|
|
36
40
|
isSupportTheming: extractIsSupportTheming(meta),
|
|
37
41
|
isTrusted: extractIsTrusted(meta),
|
|
38
42
|
linkIcon: extractLinkIcon(response),
|
|
@@ -41,17 +45,14 @@ export const extractInvokePreviewAction = param => {
|
|
|
41
45
|
origin,
|
|
42
46
|
src,
|
|
43
47
|
title: extractTitle(data),
|
|
44
|
-
url
|
|
45
|
-
invokeViewAction: extractInvokeViewAction(param, true)
|
|
48
|
+
url
|
|
46
49
|
});
|
|
47
50
|
},
|
|
48
51
|
actionSubjectId: 'invokePreviewScreen',
|
|
49
52
|
actionType: ActionName.PreviewAction,
|
|
50
|
-
definitionId: getDefinitionId(response),
|
|
51
53
|
display,
|
|
52
|
-
extensionKey
|
|
53
|
-
id
|
|
54
|
-
resourceType: getResourceType(response)
|
|
54
|
+
extensionKey,
|
|
55
|
+
id
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
};
|
|
@@ -2,7 +2,6 @@ import { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
3
3
|
import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
|
|
4
4
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
7
6
|
import { SmartLinkStatus } from '../../constants';
|
|
8
7
|
import { startUfoExperience } from '../analytics';
|
|
@@ -88,32 +87,16 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
88
87
|
const services = getServices(details);
|
|
89
88
|
// When authentication is triggered, let GAS know!
|
|
90
89
|
if (status === 'unauthorized') {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
analytics.ui.authEvent({
|
|
98
|
-
display: appearance,
|
|
99
|
-
definitionId,
|
|
100
|
-
extensionKey
|
|
101
|
-
});
|
|
102
|
-
}
|
|
90
|
+
fireEvent('ui.button.clicked.connectAccount', {
|
|
91
|
+
display: appearance,
|
|
92
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
93
|
+
});
|
|
103
94
|
}
|
|
104
95
|
if (status === 'forbidden') {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
analytics.ui.authAlternateAccountEvent({
|
|
112
|
-
display: appearance,
|
|
113
|
-
definitionId,
|
|
114
|
-
extensionKey
|
|
115
|
-
});
|
|
116
|
-
}
|
|
96
|
+
fireEvent('ui.smartLink.clicked.tryAnotherAccount', {
|
|
97
|
+
display: appearance,
|
|
98
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
99
|
+
});
|
|
117
100
|
}
|
|
118
101
|
if (services.length > 0) {
|
|
119
102
|
fireEvent('screen.consentModal.viewed', {
|
|
@@ -142,23 +125,15 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
142
125
|
reason: (_err$type = err.type) !== null && _err$type !== void 0 ? _err$type : null
|
|
143
126
|
});
|
|
144
127
|
if (err.type === 'auth_window_closed') {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
} else {
|
|
151
|
-
analytics.ui.closedAuthEvent({
|
|
152
|
-
display: appearance,
|
|
153
|
-
definitionId,
|
|
154
|
-
extensionKey
|
|
155
|
-
});
|
|
156
|
-
}
|
|
128
|
+
fireEvent('ui.consentModal.closed', {
|
|
129
|
+
display: appearance,
|
|
130
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
131
|
+
});
|
|
157
132
|
}
|
|
158
133
|
reload();
|
|
159
134
|
});
|
|
160
135
|
}
|
|
161
|
-
}, [getSmartLinkState,
|
|
136
|
+
}, [getSmartLinkState, id, reload, fireEvent]);
|
|
162
137
|
const invoke = useCallback(async (opts, appearance) => {
|
|
163
138
|
const {
|
|
164
139
|
key,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
3
3
|
import { getUrl } from '@atlaskit/linking-common';
|
|
4
|
-
import { context, invokeFailedEvent, invokeSucceededEvent, uiActionClickedEvent,
|
|
5
|
-
import { uiServerActionClicked } from '../../utils/analytics/analytics';
|
|
4
|
+
import { context, invokeFailedEvent, invokeSucceededEvent, uiActionClickedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
|
|
6
5
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
7
6
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
8
7
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
@@ -57,62 +56,11 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
57
56
|
|
|
58
57
|
/** Contains all ui analytics events */
|
|
59
58
|
const ui = useMemo(() => ({
|
|
60
|
-
/**
|
|
61
|
-
* This fires an event that represents when a user clicks on the authentication
|
|
62
|
-
* call to action with no current authenticated account. (i.e. Connect to Preview).
|
|
63
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
64
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
65
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
66
|
-
* @returns
|
|
67
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
68
|
-
*/
|
|
69
|
-
authEvent: ({
|
|
70
|
-
display,
|
|
71
|
-
extensionKey,
|
|
72
|
-
definitionId,
|
|
73
|
-
resourceType,
|
|
74
|
-
destinationProduct,
|
|
75
|
-
destinationSubproduct,
|
|
76
|
-
location
|
|
77
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiAuthEvent({
|
|
78
|
-
display,
|
|
79
|
-
extensionKey,
|
|
80
|
-
definitionId,
|
|
81
|
-
resourceType,
|
|
82
|
-
destinationProduct,
|
|
83
|
-
destinationSubproduct,
|
|
84
|
-
location
|
|
85
|
-
}), commonAttributes)),
|
|
86
|
-
/**
|
|
87
|
-
* This fires an event that represents when a user clicks on the authentication
|
|
88
|
-
* call to action with a forbidden authenticated account. (i.e. Try another account).
|
|
89
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
90
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
91
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
92
|
-
* @returns
|
|
93
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
94
|
-
*/
|
|
95
|
-
authAlternateAccountEvent: ({
|
|
96
|
-
display,
|
|
97
|
-
extensionKey,
|
|
98
|
-
definitionId,
|
|
99
|
-
resourceType,
|
|
100
|
-
destinationProduct,
|
|
101
|
-
destinationSubproduct,
|
|
102
|
-
location
|
|
103
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiAuthAlternateAccountEvent({
|
|
104
|
-
display,
|
|
105
|
-
extensionKey,
|
|
106
|
-
definitionId,
|
|
107
|
-
resourceType,
|
|
108
|
-
destinationProduct,
|
|
109
|
-
destinationSubproduct,
|
|
110
|
-
location
|
|
111
|
-
}), commonAttributes)),
|
|
112
59
|
/**
|
|
113
60
|
* This fires an event that represents when a user
|
|
114
61
|
* click a button.
|
|
115
62
|
* @param data A partial analytics event payload
|
|
63
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
116
64
|
*/
|
|
117
65
|
buttonClickedEvent: data => dispatchAnalytics(applyCommonAttributes({
|
|
118
66
|
action: 'clicked',
|
|
@@ -124,42 +72,6 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
124
72
|
},
|
|
125
73
|
eventType: 'ui'
|
|
126
74
|
}, commonAttributes)),
|
|
127
|
-
/**
|
|
128
|
-
* This fires an event that represents when a user clicks on a Smart Link.
|
|
129
|
-
* @param id The unique ID for this Smart Link.
|
|
130
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
131
|
-
* @param status What status the Smart Link is currently in (e.g. resolved, unresolved)
|
|
132
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
133
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
134
|
-
* @param isModifierKeyPressed Whether a modifier key was pressed when clicking the Smart Link.
|
|
135
|
-
* @param location Where the Smart Link is currently rendered.
|
|
136
|
-
* @param destinationProduct The product the Smart Link is linked to.
|
|
137
|
-
* @returns
|
|
138
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
139
|
-
*/
|
|
140
|
-
cardClickedEvent: ({
|
|
141
|
-
id,
|
|
142
|
-
display,
|
|
143
|
-
status,
|
|
144
|
-
definitionId,
|
|
145
|
-
extensionKey,
|
|
146
|
-
isModifierKeyPressed,
|
|
147
|
-
location,
|
|
148
|
-
destinationProduct,
|
|
149
|
-
destinationSubproduct,
|
|
150
|
-
actionSubjectId
|
|
151
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiCardClickedEvent({
|
|
152
|
-
id,
|
|
153
|
-
display,
|
|
154
|
-
status,
|
|
155
|
-
definitionId,
|
|
156
|
-
extensionKey,
|
|
157
|
-
isModifierKeyPressed,
|
|
158
|
-
location,
|
|
159
|
-
destinationProduct,
|
|
160
|
-
destinationSubproduct,
|
|
161
|
-
actionSubjectId
|
|
162
|
-
}), commonAttributes)),
|
|
163
75
|
/**
|
|
164
76
|
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
165
77
|
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
@@ -193,63 +105,10 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
193
105
|
location
|
|
194
106
|
}), commonAttributes));
|
|
195
107
|
},
|
|
196
|
-
/**
|
|
197
|
-
* This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
|
|
198
|
-
* https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
|
|
199
|
-
* @param previewDisplay What format the preview is in.
|
|
200
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
201
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
202
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
203
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
204
|
-
*/
|
|
205
|
-
hoverCardOpenLinkClickedEvent: ({
|
|
206
|
-
previewDisplay,
|
|
207
|
-
definitionId,
|
|
208
|
-
extensionKey,
|
|
209
|
-
destinationProduct,
|
|
210
|
-
destinationSubproduct,
|
|
211
|
-
location,
|
|
212
|
-
previewInvokeMethod
|
|
213
|
-
}) => {
|
|
214
|
-
dispatchAnalytics(applyCommonAttributes(uiHoverCardOpenLinkClickedEvent({
|
|
215
|
-
id: defaultId,
|
|
216
|
-
previewDisplay,
|
|
217
|
-
definitionId,
|
|
218
|
-
extensionKey,
|
|
219
|
-
destinationProduct,
|
|
220
|
-
destinationSubproduct,
|
|
221
|
-
location,
|
|
222
|
-
previewInvokeMethod
|
|
223
|
-
}), commonAttributes));
|
|
224
|
-
},
|
|
225
|
-
/**
|
|
226
|
-
* This fires an event that represents when a user closed the authentication window without authenticating after opening it.
|
|
227
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
228
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
229
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
230
|
-
* @returns
|
|
231
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
232
|
-
*/
|
|
233
|
-
closedAuthEvent: ({
|
|
234
|
-
display,
|
|
235
|
-
extensionKey,
|
|
236
|
-
definitionId,
|
|
237
|
-
resourceType,
|
|
238
|
-
destinationProduct,
|
|
239
|
-
destinationSubproduct,
|
|
240
|
-
location
|
|
241
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiClosedAuthEvent({
|
|
242
|
-
display,
|
|
243
|
-
extensionKey,
|
|
244
|
-
definitionId,
|
|
245
|
-
resourceType,
|
|
246
|
-
destinationProduct,
|
|
247
|
-
destinationSubproduct,
|
|
248
|
-
location
|
|
249
|
-
}), commonAttributes)),
|
|
250
108
|
/**
|
|
251
109
|
* This fires an event that represents when a user close a modal.
|
|
252
110
|
* @param data A partial analytics event payload
|
|
111
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
253
112
|
*/
|
|
254
113
|
modalClosedEvent: data => dispatchAnalytics(applyCommonAttributes({
|
|
255
114
|
action: 'closed',
|
|
@@ -269,6 +128,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
269
128
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
270
129
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
271
130
|
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
131
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
272
132
|
*/
|
|
273
133
|
renderSuccessEvent: ({
|
|
274
134
|
display,
|
|
@@ -310,6 +170,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
310
170
|
* @param id The unique ID for this Smart Link.
|
|
311
171
|
* @param error: An error representing why the Smart Link render failed.
|
|
312
172
|
* @param errorInfo: Additional details about the error including the stack trace.
|
|
173
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
313
174
|
*/
|
|
314
175
|
renderFailedEvent: ({
|
|
315
176
|
display,
|
|
@@ -340,100 +201,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
340
201
|
destinationSubproduct,
|
|
341
202
|
location
|
|
342
203
|
}), commonAttributes));
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* This fires an event that represents a hover preview being opened.
|
|
346
|
-
* @param hoverDisplay Whether the hover preview was displayed as a card or embed.
|
|
347
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
348
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
349
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
350
|
-
* @returns
|
|
351
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
352
|
-
*/
|
|
353
|
-
hoverCardViewedEvent: ({
|
|
354
|
-
previewDisplay,
|
|
355
|
-
previewInvokeMethod,
|
|
356
|
-
id,
|
|
357
|
-
extensionKey,
|
|
358
|
-
definitionId,
|
|
359
|
-
resourceType,
|
|
360
|
-
destinationProduct,
|
|
361
|
-
destinationSubproduct,
|
|
362
|
-
location,
|
|
363
|
-
status
|
|
364
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiHoverCardViewedEvent({
|
|
365
|
-
id,
|
|
366
|
-
previewDisplay,
|
|
367
|
-
extensionKey,
|
|
368
|
-
definitionId,
|
|
369
|
-
resourceType,
|
|
370
|
-
destinationProduct,
|
|
371
|
-
destinationSubproduct,
|
|
372
|
-
location,
|
|
373
|
-
previewInvokeMethod,
|
|
374
|
-
status
|
|
375
|
-
}), commonAttributes)),
|
|
376
|
-
/**
|
|
377
|
-
* This fires an event that represents a hover preview being dismissed.
|
|
378
|
-
* @param hoverDisplay Whether the hover preview was displayed as a card or embed.
|
|
379
|
-
* @param hoverTime The duration that the user hovered over a Smart Link before the preview was dismissed.
|
|
380
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
381
|
-
* @param extensionKey The extensionKey of the Smart Link resolver invoked.
|
|
382
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
383
|
-
* @returns
|
|
384
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
385
|
-
*/
|
|
386
|
-
hoverCardDismissedEvent: ({
|
|
387
|
-
id,
|
|
388
|
-
previewDisplay,
|
|
389
|
-
hoverTime,
|
|
390
|
-
previewInvokeMethod,
|
|
391
|
-
extensionKey,
|
|
392
|
-
definitionId,
|
|
393
|
-
resourceType,
|
|
394
|
-
destinationProduct,
|
|
395
|
-
destinationSubproduct,
|
|
396
|
-
location,
|
|
397
|
-
status
|
|
398
|
-
}) => dispatchAnalytics(applyCommonAttributes(uiHoverCardDismissedEvent({
|
|
399
|
-
previewDisplay,
|
|
400
|
-
id,
|
|
401
|
-
hoverTime,
|
|
402
|
-
extensionKey,
|
|
403
|
-
definitionId,
|
|
404
|
-
resourceType,
|
|
405
|
-
destinationProduct,
|
|
406
|
-
destinationSubproduct,
|
|
407
|
-
location,
|
|
408
|
-
previewInvokeMethod,
|
|
409
|
-
status
|
|
410
|
-
}), commonAttributes)),
|
|
411
|
-
/**
|
|
412
|
-
* Fires an event that signifies that a "Learn More" link was clicked on an unauthenticated card
|
|
413
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
414
|
-
* @param location The location where a link is displayed (jiraWebLinks, confluencePages etc)
|
|
415
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
416
|
-
*/
|
|
417
|
-
learnMoreClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiLearnMoreLinkClickedEvent(), commonAttributes)),
|
|
418
|
-
/**
|
|
419
|
-
* Fires an event that represent a click was performed on a Status Lozenge
|
|
420
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
421
|
-
*/
|
|
422
|
-
smartLinkLozengeActionClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusLozengeButtonClicked(), commonAttributes)),
|
|
423
|
-
/**
|
|
424
|
-
* Fires an event that represent a click was performed on a Status Lozenge's dropdown item
|
|
425
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
426
|
-
*/
|
|
427
|
-
smartLinkLozengeActionListItemClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusListItemButtonClicked(), commonAttributes)),
|
|
428
|
-
/**
|
|
429
|
-
* Fires an event that represent a click was performed on a Status Lozenge open preview button
|
|
430
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
431
|
-
*/
|
|
432
|
-
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusOpenPreviewButtonClicked(), commonAttributes)),
|
|
433
|
-
/**
|
|
434
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
435
|
-
*/
|
|
436
|
-
smartLinkServerActionClickedEvent: props => dispatchAnalytics(applyCommonAttributes(uiServerActionClicked(props), commonAttributes))
|
|
204
|
+
}
|
|
437
205
|
}), [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
438
206
|
|
|
439
207
|
/** Contains all operational analytics events */
|
|
@@ -507,7 +275,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
507
275
|
const screen = useMemo(() => ({
|
|
508
276
|
/**
|
|
509
277
|
* This fires an event that represents when a user view a modal.
|
|
510
|
-
* @
|
|
278
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
511
279
|
*/
|
|
512
280
|
modalViewedEvent: data => dispatchAnalytics(applyCommonAttributes({
|
|
513
281
|
action: 'viewed',
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { context } from './analytics';
|
|
5
3
|
/**
|
|
6
4
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
7
5
|
*/
|
|
@@ -16,7 +14,6 @@ export const LinkAnalyticsContext = ({
|
|
|
16
14
|
data: {
|
|
17
15
|
source,
|
|
18
16
|
attributes: {
|
|
19
|
-
...(fg('platform-smart-card-migrate-embed-modal-analytics') ? context : {}),
|
|
20
17
|
displayCategory,
|
|
21
18
|
display,
|
|
22
19
|
id
|
|
@@ -1,14 +1,101 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
4
4
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
5
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
6
|
+
import { getUrl } from '@atlaskit/linking-common';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
8
|
import { useSmartCardState as useSmartLinkState } from '../../state/store';
|
|
9
|
+
import { context } from './analytics';
|
|
6
10
|
import { LinkAnalyticsContext } from './LinkAnalyticsContext';
|
|
11
|
+
const getExtendedResolvedAttributes = (linkDetails, details, linkStatus) => {
|
|
12
|
+
var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
|
|
13
|
+
return {
|
|
14
|
+
definitionId: (_details$meta$definit = details === null || details === void 0 ? void 0 : (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.definitionId) !== null && _details$meta$definit !== void 0 ? _details$meta$definit : null,
|
|
15
|
+
resourceType: (_details$meta$resourc = details === null || details === void 0 ? void 0 : (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.resourceType) !== null && _details$meta$resourc !== void 0 ? _details$meta$resourc : null,
|
|
16
|
+
...getResolvedAttributes(linkDetails, details, linkStatus)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const getSmartLinkAnalyticsContext = ({
|
|
20
|
+
display,
|
|
21
|
+
id,
|
|
22
|
+
response,
|
|
23
|
+
source,
|
|
24
|
+
status,
|
|
25
|
+
url
|
|
26
|
+
}) => {
|
|
27
|
+
const resolvedAttributes = getExtendedResolvedAttributes({
|
|
28
|
+
url
|
|
29
|
+
}, response, status);
|
|
30
|
+
return {
|
|
31
|
+
source,
|
|
32
|
+
attributes: {
|
|
33
|
+
...context,
|
|
34
|
+
display,
|
|
35
|
+
id,
|
|
36
|
+
...resolvedAttributes
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Provides an analytics context data to supply attributes to events based on a URL
|
|
42
|
+
* and the link state in the store
|
|
43
|
+
*/
|
|
44
|
+
export const useSmartLinkAnalyticsContext = ({
|
|
45
|
+
display,
|
|
46
|
+
id,
|
|
47
|
+
source,
|
|
48
|
+
url
|
|
49
|
+
}) => {
|
|
50
|
+
const {
|
|
51
|
+
store
|
|
52
|
+
} = useSmartLinkContext();
|
|
53
|
+
const state = store ? getUrl(store, url) : undefined;
|
|
54
|
+
return useMemo(() => {
|
|
55
|
+
return fg('platform-smart-card-migrate-embed-modal-analytics') ? getSmartLinkAnalyticsContext({
|
|
56
|
+
display,
|
|
57
|
+
id,
|
|
58
|
+
response: state === null || state === void 0 ? void 0 : state.details,
|
|
59
|
+
source,
|
|
60
|
+
status: state === null || state === void 0 ? void 0 : state.status,
|
|
61
|
+
url
|
|
62
|
+
}) : {};
|
|
63
|
+
}, [display, id, source, state === null || state === void 0 ? void 0 : state.details, state === null || state === void 0 ? void 0 : state.status, url]);
|
|
64
|
+
};
|
|
65
|
+
|
|
7
66
|
/**
|
|
8
67
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
9
68
|
* and the link state in the store
|
|
10
69
|
*/
|
|
11
|
-
|
|
70
|
+
const ExtendedSmartLinkAnalyticsContext = ({
|
|
71
|
+
children,
|
|
72
|
+
display,
|
|
73
|
+
id,
|
|
74
|
+
source,
|
|
75
|
+
url
|
|
76
|
+
}) => {
|
|
77
|
+
const {
|
|
78
|
+
details,
|
|
79
|
+
status
|
|
80
|
+
} = useSmartLinkState(url);
|
|
81
|
+
const data = getSmartLinkAnalyticsContext({
|
|
82
|
+
display,
|
|
83
|
+
id,
|
|
84
|
+
response: details,
|
|
85
|
+
source,
|
|
86
|
+
status,
|
|
87
|
+
url
|
|
88
|
+
});
|
|
89
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
90
|
+
data: data
|
|
91
|
+
}, children);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Provides an analytics context to supply attributes to events based on a URL
|
|
96
|
+
* and the link state in the store
|
|
97
|
+
*/
|
|
98
|
+
const LegacySmartLinkAnalyticsContext = props => {
|
|
12
99
|
const {
|
|
13
100
|
children,
|
|
14
101
|
url,
|
|
@@ -28,4 +115,12 @@ export const SmartLinkAnalyticsContext = props => {
|
|
|
28
115
|
attributes
|
|
29
116
|
}
|
|
30
117
|
}, children));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Provides an analytics context to supply attributes to events based on a URL
|
|
122
|
+
* and the link state in the store
|
|
123
|
+
*/
|
|
124
|
+
export const SmartLinkAnalyticsContext = props => {
|
|
125
|
+
return fg('platform-smart-card-migrate-embed-modal-analytics') ? /*#__PURE__*/React.createElement(ExtendedSmartLinkAnalyticsContext, props) : /*#__PURE__*/React.createElement(LegacySmartLinkAnalyticsContext, props);
|
|
31
126
|
};
|