@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
|
@@ -5,8 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
7
|
import { getUrl } from '@atlaskit/linking-common';
|
|
8
|
-
import { context, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, uiActionClickedEvent,
|
|
9
|
-
import { uiServerActionClicked } from '../../utils/analytics/analytics';
|
|
8
|
+
import { context, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, uiActionClickedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
|
|
10
9
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
11
10
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
12
11
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
@@ -65,64 +64,11 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
65
64
|
/** Contains all ui analytics events */
|
|
66
65
|
var ui = useMemo(function () {
|
|
67
66
|
return {
|
|
68
|
-
/**
|
|
69
|
-
* This fires an event that represents when a user clicks on the authentication
|
|
70
|
-
* call to action with no current authenticated account. (i.e. Connect to Preview).
|
|
71
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
72
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
73
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
74
|
-
* @returns
|
|
75
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
76
|
-
*/
|
|
77
|
-
authEvent: function authEvent(_ref) {
|
|
78
|
-
var display = _ref.display,
|
|
79
|
-
extensionKey = _ref.extensionKey,
|
|
80
|
-
definitionId = _ref.definitionId,
|
|
81
|
-
resourceType = _ref.resourceType,
|
|
82
|
-
destinationProduct = _ref.destinationProduct,
|
|
83
|
-
destinationSubproduct = _ref.destinationSubproduct,
|
|
84
|
-
location = _ref.location;
|
|
85
|
-
return dispatchAnalytics(applyCommonAttributes(uiAuthEvent({
|
|
86
|
-
display: display,
|
|
87
|
-
extensionKey: extensionKey,
|
|
88
|
-
definitionId: definitionId,
|
|
89
|
-
resourceType: resourceType,
|
|
90
|
-
destinationProduct: destinationProduct,
|
|
91
|
-
destinationSubproduct: destinationSubproduct,
|
|
92
|
-
location: location
|
|
93
|
-
}), commonAttributes));
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* This fires an event that represents when a user clicks on the authentication
|
|
97
|
-
* call to action with a forbidden authenticated account. (i.e. Try another account).
|
|
98
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
99
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
100
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
101
|
-
* @returns
|
|
102
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
103
|
-
*/
|
|
104
|
-
authAlternateAccountEvent: function authAlternateAccountEvent(_ref2) {
|
|
105
|
-
var display = _ref2.display,
|
|
106
|
-
extensionKey = _ref2.extensionKey,
|
|
107
|
-
definitionId = _ref2.definitionId,
|
|
108
|
-
resourceType = _ref2.resourceType,
|
|
109
|
-
destinationProduct = _ref2.destinationProduct,
|
|
110
|
-
destinationSubproduct = _ref2.destinationSubproduct,
|
|
111
|
-
location = _ref2.location;
|
|
112
|
-
return dispatchAnalytics(applyCommonAttributes(uiAuthAlternateAccountEvent({
|
|
113
|
-
display: display,
|
|
114
|
-
extensionKey: extensionKey,
|
|
115
|
-
definitionId: definitionId,
|
|
116
|
-
resourceType: resourceType,
|
|
117
|
-
destinationProduct: destinationProduct,
|
|
118
|
-
destinationSubproduct: destinationSubproduct,
|
|
119
|
-
location: location
|
|
120
|
-
}), commonAttributes));
|
|
121
|
-
},
|
|
122
67
|
/**
|
|
123
68
|
* This fires an event that represents when a user
|
|
124
69
|
* click a button.
|
|
125
70
|
* @param data A partial analytics event payload
|
|
71
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
126
72
|
*/
|
|
127
73
|
buttonClickedEvent: function buttonClickedEvent(data) {
|
|
128
74
|
return dispatchAnalytics(applyCommonAttributes({
|
|
@@ -133,43 +79,6 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
133
79
|
eventType: 'ui'
|
|
134
80
|
}, commonAttributes));
|
|
135
81
|
},
|
|
136
|
-
/**
|
|
137
|
-
* This fires an event that represents when a user clicks on a Smart Link.
|
|
138
|
-
* @param id The unique ID for this Smart Link.
|
|
139
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
140
|
-
* @param status What status the Smart Link is currently in (e.g. resolved, unresolved)
|
|
141
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
142
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
143
|
-
* @param isModifierKeyPressed Whether a modifier key was pressed when clicking the Smart Link.
|
|
144
|
-
* @param location Where the Smart Link is currently rendered.
|
|
145
|
-
* @param destinationProduct The product the Smart Link is linked to.
|
|
146
|
-
* @returns
|
|
147
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
148
|
-
*/
|
|
149
|
-
cardClickedEvent: function cardClickedEvent(_ref3) {
|
|
150
|
-
var id = _ref3.id,
|
|
151
|
-
display = _ref3.display,
|
|
152
|
-
status = _ref3.status,
|
|
153
|
-
definitionId = _ref3.definitionId,
|
|
154
|
-
extensionKey = _ref3.extensionKey,
|
|
155
|
-
isModifierKeyPressed = _ref3.isModifierKeyPressed,
|
|
156
|
-
location = _ref3.location,
|
|
157
|
-
destinationProduct = _ref3.destinationProduct,
|
|
158
|
-
destinationSubproduct = _ref3.destinationSubproduct,
|
|
159
|
-
actionSubjectId = _ref3.actionSubjectId;
|
|
160
|
-
return dispatchAnalytics(applyCommonAttributes(uiCardClickedEvent({
|
|
161
|
-
id: id,
|
|
162
|
-
display: display,
|
|
163
|
-
status: status,
|
|
164
|
-
definitionId: definitionId,
|
|
165
|
-
extensionKey: extensionKey,
|
|
166
|
-
isModifierKeyPressed: isModifierKeyPressed,
|
|
167
|
-
location: location,
|
|
168
|
-
destinationProduct: destinationProduct,
|
|
169
|
-
destinationSubproduct: destinationSubproduct,
|
|
170
|
-
actionSubjectId: actionSubjectId
|
|
171
|
-
}), commonAttributes));
|
|
172
|
-
},
|
|
173
82
|
/**
|
|
174
83
|
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
175
84
|
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
@@ -179,16 +88,16 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
179
88
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
180
89
|
* @returns
|
|
181
90
|
*/
|
|
182
|
-
actionClickedEvent: function actionClickedEvent(
|
|
183
|
-
var id =
|
|
184
|
-
actionType =
|
|
185
|
-
display =
|
|
186
|
-
overrideExtensionKey =
|
|
187
|
-
definitionId =
|
|
188
|
-
resourceType =
|
|
189
|
-
destinationProduct =
|
|
190
|
-
destinationSubproduct =
|
|
191
|
-
location =
|
|
91
|
+
actionClickedEvent: function actionClickedEvent(_ref) {
|
|
92
|
+
var id = _ref.id,
|
|
93
|
+
actionType = _ref.actionType,
|
|
94
|
+
display = _ref.display,
|
|
95
|
+
overrideExtensionKey = _ref.extensionKey,
|
|
96
|
+
definitionId = _ref.definitionId,
|
|
97
|
+
resourceType = _ref.resourceType,
|
|
98
|
+
destinationProduct = _ref.destinationProduct,
|
|
99
|
+
destinationSubproduct = _ref.destinationSubproduct,
|
|
100
|
+
location = _ref.location;
|
|
192
101
|
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
193
102
|
dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
|
|
194
103
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
@@ -202,63 +111,10 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
202
111
|
location: location
|
|
203
112
|
}), commonAttributes));
|
|
204
113
|
},
|
|
205
|
-
/**
|
|
206
|
-
* This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
|
|
207
|
-
* https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
|
|
208
|
-
* @param previewDisplay What format the preview is in.
|
|
209
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
210
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
211
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
212
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
213
|
-
*/
|
|
214
|
-
hoverCardOpenLinkClickedEvent: function hoverCardOpenLinkClickedEvent(_ref5) {
|
|
215
|
-
var previewDisplay = _ref5.previewDisplay,
|
|
216
|
-
definitionId = _ref5.definitionId,
|
|
217
|
-
extensionKey = _ref5.extensionKey,
|
|
218
|
-
destinationProduct = _ref5.destinationProduct,
|
|
219
|
-
destinationSubproduct = _ref5.destinationSubproduct,
|
|
220
|
-
location = _ref5.location,
|
|
221
|
-
previewInvokeMethod = _ref5.previewInvokeMethod;
|
|
222
|
-
dispatchAnalytics(applyCommonAttributes(uiHoverCardOpenLinkClickedEvent({
|
|
223
|
-
id: defaultId,
|
|
224
|
-
previewDisplay: previewDisplay,
|
|
225
|
-
definitionId: definitionId,
|
|
226
|
-
extensionKey: extensionKey,
|
|
227
|
-
destinationProduct: destinationProduct,
|
|
228
|
-
destinationSubproduct: destinationSubproduct,
|
|
229
|
-
location: location,
|
|
230
|
-
previewInvokeMethod: previewInvokeMethod
|
|
231
|
-
}), commonAttributes));
|
|
232
|
-
},
|
|
233
|
-
/**
|
|
234
|
-
* This fires an event that represents when a user closed the authentication window without authenticating after opening it.
|
|
235
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
236
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
237
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
238
|
-
* @returns
|
|
239
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
240
|
-
*/
|
|
241
|
-
closedAuthEvent: function closedAuthEvent(_ref6) {
|
|
242
|
-
var display = _ref6.display,
|
|
243
|
-
extensionKey = _ref6.extensionKey,
|
|
244
|
-
definitionId = _ref6.definitionId,
|
|
245
|
-
resourceType = _ref6.resourceType,
|
|
246
|
-
destinationProduct = _ref6.destinationProduct,
|
|
247
|
-
destinationSubproduct = _ref6.destinationSubproduct,
|
|
248
|
-
location = _ref6.location;
|
|
249
|
-
return dispatchAnalytics(applyCommonAttributes(uiClosedAuthEvent({
|
|
250
|
-
display: display,
|
|
251
|
-
extensionKey: extensionKey,
|
|
252
|
-
definitionId: definitionId,
|
|
253
|
-
resourceType: resourceType,
|
|
254
|
-
destinationProduct: destinationProduct,
|
|
255
|
-
destinationSubproduct: destinationSubproduct,
|
|
256
|
-
location: location
|
|
257
|
-
}), commonAttributes));
|
|
258
|
-
},
|
|
259
114
|
/**
|
|
260
115
|
* This fires an event that represents when a user close a modal.
|
|
261
116
|
* @param data A partial analytics event payload
|
|
117
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
262
118
|
*/
|
|
263
119
|
modalClosedEvent: function modalClosedEvent(data) {
|
|
264
120
|
return dispatchAnalytics(applyCommonAttributes({
|
|
@@ -277,19 +133,20 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
277
133
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
278
134
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
279
135
|
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
136
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
280
137
|
*/
|
|
281
|
-
renderSuccessEvent: function renderSuccessEvent(
|
|
282
|
-
var display =
|
|
283
|
-
status =
|
|
284
|
-
id =
|
|
285
|
-
extensionKey =
|
|
286
|
-
definitionId =
|
|
287
|
-
resourceType =
|
|
288
|
-
destinationProduct =
|
|
289
|
-
destinationSubproduct =
|
|
290
|
-
location =
|
|
291
|
-
|
|
292
|
-
canBeDatasource =
|
|
138
|
+
renderSuccessEvent: function renderSuccessEvent(_ref2) {
|
|
139
|
+
var display = _ref2.display,
|
|
140
|
+
status = _ref2.status,
|
|
141
|
+
id = _ref2.id,
|
|
142
|
+
extensionKey = _ref2.extensionKey,
|
|
143
|
+
definitionId = _ref2.definitionId,
|
|
144
|
+
resourceType = _ref2.resourceType,
|
|
145
|
+
destinationProduct = _ref2.destinationProduct,
|
|
146
|
+
destinationSubproduct = _ref2.destinationSubproduct,
|
|
147
|
+
location = _ref2.location,
|
|
148
|
+
_ref2$canBeDatasource = _ref2.canBeDatasource,
|
|
149
|
+
canBeDatasource = _ref2$canBeDatasource === void 0 ? false : _ref2$canBeDatasource;
|
|
293
150
|
var experienceId = id ? id : defaultId;
|
|
294
151
|
succeedUfoExperience('smart-link-rendered', experienceId, {
|
|
295
152
|
extensionKey: extensionKey,
|
|
@@ -318,18 +175,19 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
318
175
|
* @param id The unique ID for this Smart Link.
|
|
319
176
|
* @param error: An error representing why the Smart Link render failed.
|
|
320
177
|
* @param errorInfo: Additional details about the error including the stack trace.
|
|
178
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
321
179
|
*/
|
|
322
|
-
renderFailedEvent: function renderFailedEvent(
|
|
323
|
-
var display =
|
|
324
|
-
id =
|
|
325
|
-
error =
|
|
326
|
-
errorInfo =
|
|
327
|
-
extensionKey =
|
|
328
|
-
definitionId =
|
|
329
|
-
resourceType =
|
|
330
|
-
destinationProduct =
|
|
331
|
-
destinationSubproduct =
|
|
332
|
-
location =
|
|
180
|
+
renderFailedEvent: function renderFailedEvent(_ref3) {
|
|
181
|
+
var display = _ref3.display,
|
|
182
|
+
id = _ref3.id,
|
|
183
|
+
error = _ref3.error,
|
|
184
|
+
errorInfo = _ref3.errorInfo,
|
|
185
|
+
extensionKey = _ref3.extensionKey,
|
|
186
|
+
definitionId = _ref3.definitionId,
|
|
187
|
+
resourceType = _ref3.resourceType,
|
|
188
|
+
destinationProduct = _ref3.destinationProduct,
|
|
189
|
+
destinationSubproduct = _ref3.destinationSubproduct,
|
|
190
|
+
location = _ref3.location;
|
|
333
191
|
var experienceId = id ? id : defaultId;
|
|
334
192
|
// Start and fail the smart-link-rendered experience. If it has already
|
|
335
193
|
// been started nothing happens.
|
|
@@ -347,111 +205,6 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
347
205
|
destinationSubproduct: destinationSubproduct,
|
|
348
206
|
location: location
|
|
349
207
|
}), commonAttributes));
|
|
350
|
-
},
|
|
351
|
-
/**
|
|
352
|
-
* This fires an event that represents a hover preview being opened.
|
|
353
|
-
* @param hoverDisplay Whether the hover preview was displayed as a card or embed.
|
|
354
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
355
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
356
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
357
|
-
* @returns
|
|
358
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
359
|
-
*/
|
|
360
|
-
hoverCardViewedEvent: function hoverCardViewedEvent(_ref9) {
|
|
361
|
-
var previewDisplay = _ref9.previewDisplay,
|
|
362
|
-
previewInvokeMethod = _ref9.previewInvokeMethod,
|
|
363
|
-
id = _ref9.id,
|
|
364
|
-
extensionKey = _ref9.extensionKey,
|
|
365
|
-
definitionId = _ref9.definitionId,
|
|
366
|
-
resourceType = _ref9.resourceType,
|
|
367
|
-
destinationProduct = _ref9.destinationProduct,
|
|
368
|
-
destinationSubproduct = _ref9.destinationSubproduct,
|
|
369
|
-
location = _ref9.location,
|
|
370
|
-
status = _ref9.status;
|
|
371
|
-
return dispatchAnalytics(applyCommonAttributes(uiHoverCardViewedEvent({
|
|
372
|
-
id: id,
|
|
373
|
-
previewDisplay: previewDisplay,
|
|
374
|
-
extensionKey: extensionKey,
|
|
375
|
-
definitionId: definitionId,
|
|
376
|
-
resourceType: resourceType,
|
|
377
|
-
destinationProduct: destinationProduct,
|
|
378
|
-
destinationSubproduct: destinationSubproduct,
|
|
379
|
-
location: location,
|
|
380
|
-
previewInvokeMethod: previewInvokeMethod,
|
|
381
|
-
status: status
|
|
382
|
-
}), commonAttributes));
|
|
383
|
-
},
|
|
384
|
-
/**
|
|
385
|
-
* This fires an event that represents a hover preview being dismissed.
|
|
386
|
-
* @param hoverDisplay Whether the hover preview was displayed as a card or embed.
|
|
387
|
-
* @param hoverTime The duration that the user hovered over a Smart Link before the preview was dismissed.
|
|
388
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
389
|
-
* @param extensionKey The extensionKey of the Smart Link resolver invoked.
|
|
390
|
-
* @param previewInvokeMethod How the preview was triggered.
|
|
391
|
-
* @returns
|
|
392
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
393
|
-
*/
|
|
394
|
-
hoverCardDismissedEvent: function hoverCardDismissedEvent(_ref10) {
|
|
395
|
-
var id = _ref10.id,
|
|
396
|
-
previewDisplay = _ref10.previewDisplay,
|
|
397
|
-
hoverTime = _ref10.hoverTime,
|
|
398
|
-
previewInvokeMethod = _ref10.previewInvokeMethod,
|
|
399
|
-
extensionKey = _ref10.extensionKey,
|
|
400
|
-
definitionId = _ref10.definitionId,
|
|
401
|
-
resourceType = _ref10.resourceType,
|
|
402
|
-
destinationProduct = _ref10.destinationProduct,
|
|
403
|
-
destinationSubproduct = _ref10.destinationSubproduct,
|
|
404
|
-
location = _ref10.location,
|
|
405
|
-
status = _ref10.status;
|
|
406
|
-
return dispatchAnalytics(applyCommonAttributes(uiHoverCardDismissedEvent({
|
|
407
|
-
previewDisplay: previewDisplay,
|
|
408
|
-
id: id,
|
|
409
|
-
hoverTime: hoverTime,
|
|
410
|
-
extensionKey: extensionKey,
|
|
411
|
-
definitionId: definitionId,
|
|
412
|
-
resourceType: resourceType,
|
|
413
|
-
destinationProduct: destinationProduct,
|
|
414
|
-
destinationSubproduct: destinationSubproduct,
|
|
415
|
-
location: location,
|
|
416
|
-
previewInvokeMethod: previewInvokeMethod,
|
|
417
|
-
status: status
|
|
418
|
-
}), commonAttributes));
|
|
419
|
-
},
|
|
420
|
-
/**
|
|
421
|
-
* Fires an event that signifies that a "Learn More" link was clicked on an unauthenticated card
|
|
422
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
423
|
-
* @param location The location where a link is displayed (jiraWebLinks, confluencePages etc)
|
|
424
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
425
|
-
*/
|
|
426
|
-
learnMoreClickedEvent: function learnMoreClickedEvent() {
|
|
427
|
-
return dispatchAnalytics(applyCommonAttributes(uiLearnMoreLinkClickedEvent(), commonAttributes));
|
|
428
|
-
},
|
|
429
|
-
/**
|
|
430
|
-
* Fires an event that represent a click was performed on a Status Lozenge
|
|
431
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
432
|
-
*/
|
|
433
|
-
smartLinkLozengeActionClickedEvent: function smartLinkLozengeActionClickedEvent() {
|
|
434
|
-
return dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusLozengeButtonClicked(), commonAttributes));
|
|
435
|
-
},
|
|
436
|
-
/**
|
|
437
|
-
* Fires an event that represent a click was performed on a Status Lozenge's dropdown item
|
|
438
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
439
|
-
*/
|
|
440
|
-
smartLinkLozengeActionListItemClickedEvent: function smartLinkLozengeActionListItemClickedEvent() {
|
|
441
|
-
return dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusListItemButtonClicked(), commonAttributes));
|
|
442
|
-
},
|
|
443
|
-
/**
|
|
444
|
-
* Fires an event that represent a click was performed on a Status Lozenge open preview button
|
|
445
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
446
|
-
*/
|
|
447
|
-
smartLinkLozengeActionErrorOpenPreviewClickedEvent: function smartLinkLozengeActionErrorOpenPreviewClickedEvent() {
|
|
448
|
-
return dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusOpenPreviewButtonClicked(), commonAttributes));
|
|
449
|
-
},
|
|
450
|
-
/**
|
|
451
|
-
* @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
|
|
452
|
-
*/
|
|
453
|
-
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent(props) {
|
|
454
|
-
return dispatchAnalytics(applyCommonAttributes(uiServerActionClicked(props), commonAttributes));
|
|
455
208
|
}
|
|
456
209
|
};
|
|
457
210
|
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
@@ -466,16 +219,16 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
466
219
|
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
467
220
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
468
221
|
*/
|
|
469
|
-
invokeSucceededEvent: function invokeSucceededEvent(
|
|
470
|
-
var id =
|
|
471
|
-
actionType =
|
|
472
|
-
display =
|
|
473
|
-
extensionKey =
|
|
474
|
-
definitionId =
|
|
475
|
-
resourceType =
|
|
476
|
-
destinationProduct =
|
|
477
|
-
destinationSubproduct =
|
|
478
|
-
location =
|
|
222
|
+
invokeSucceededEvent: function invokeSucceededEvent(_ref4) {
|
|
223
|
+
var id = _ref4.id,
|
|
224
|
+
actionType = _ref4.actionType,
|
|
225
|
+
display = _ref4.display,
|
|
226
|
+
extensionKey = _ref4.extensionKey,
|
|
227
|
+
definitionId = _ref4.definitionId,
|
|
228
|
+
resourceType = _ref4.resourceType,
|
|
229
|
+
destinationProduct = _ref4.destinationProduct,
|
|
230
|
+
destinationSubproduct = _ref4.destinationSubproduct,
|
|
231
|
+
location = _ref4.location;
|
|
479
232
|
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
480
233
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
481
234
|
actionType: actionType,
|
|
@@ -496,17 +249,17 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
496
249
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
497
250
|
* @param reason The reason the invocation failed.
|
|
498
251
|
*/
|
|
499
|
-
invokeFailedEvent: function invokeFailedEvent(
|
|
500
|
-
var id =
|
|
501
|
-
actionType =
|
|
502
|
-
display =
|
|
503
|
-
reason =
|
|
504
|
-
extensionKey =
|
|
505
|
-
definitionId =
|
|
506
|
-
resourceType =
|
|
507
|
-
destinationProduct =
|
|
508
|
-
destinationSubproduct =
|
|
509
|
-
location =
|
|
252
|
+
invokeFailedEvent: function invokeFailedEvent(_ref5) {
|
|
253
|
+
var id = _ref5.id,
|
|
254
|
+
actionType = _ref5.actionType,
|
|
255
|
+
display = _ref5.display,
|
|
256
|
+
reason = _ref5.reason,
|
|
257
|
+
extensionKey = _ref5.extensionKey,
|
|
258
|
+
definitionId = _ref5.definitionId,
|
|
259
|
+
resourceType = _ref5.resourceType,
|
|
260
|
+
destinationProduct = _ref5.destinationProduct,
|
|
261
|
+
destinationSubproduct = _ref5.destinationSubproduct,
|
|
262
|
+
location = _ref5.location;
|
|
510
263
|
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
511
264
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
512
265
|
actionType: actionType,
|
|
@@ -528,7 +281,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
528
281
|
return {
|
|
529
282
|
/**
|
|
530
283
|
* This fires an event that represents when a user view a modal.
|
|
531
|
-
* @
|
|
284
|
+
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
532
285
|
*/
|
|
533
286
|
modalViewedEvent: function modalViewedEvent(data) {
|
|
534
287
|
return dispatchAnalytics(applyCommonAttributes({
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
1
|
import React from 'react';
|
|
5
2
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { context } from './analytics';
|
|
8
3
|
/**
|
|
9
4
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
10
5
|
*/
|
|
@@ -17,11 +12,11 @@ export var LinkAnalyticsContext = function LinkAnalyticsContext(_ref) {
|
|
|
17
12
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
18
13
|
data: {
|
|
19
14
|
source: source,
|
|
20
|
-
attributes:
|
|
15
|
+
attributes: {
|
|
21
16
|
displayCategory: displayCategory,
|
|
22
17
|
display: display,
|
|
23
18
|
id: id
|
|
24
|
-
}
|
|
19
|
+
}
|
|
25
20
|
}
|
|
26
21
|
}, children);
|
|
27
22
|
};
|
|
@@ -1,20 +1,102 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
3
6
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
4
7
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
8
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
9
|
+
import { getUrl } from '@atlaskit/linking-common';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
11
|
import { useSmartCardState as useSmartLinkState } from '../../state/store';
|
|
12
|
+
import { context } from './analytics';
|
|
6
13
|
import { LinkAnalyticsContext } from './LinkAnalyticsContext';
|
|
14
|
+
var getExtendedResolvedAttributes = function getExtendedResolvedAttributes(linkDetails, details, linkStatus) {
|
|
15
|
+
var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
|
|
16
|
+
return _objectSpread({
|
|
17
|
+
definitionId: (_details$meta$definit = details === null || details === 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,
|
|
18
|
+
resourceType: (_details$meta$resourc = details === null || details === 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
|
|
19
|
+
}, getResolvedAttributes(linkDetails, details, linkStatus));
|
|
20
|
+
};
|
|
21
|
+
var getSmartLinkAnalyticsContext = function getSmartLinkAnalyticsContext(_ref) {
|
|
22
|
+
var display = _ref.display,
|
|
23
|
+
id = _ref.id,
|
|
24
|
+
response = _ref.response,
|
|
25
|
+
source = _ref.source,
|
|
26
|
+
status = _ref.status,
|
|
27
|
+
url = _ref.url;
|
|
28
|
+
var resolvedAttributes = getExtendedResolvedAttributes({
|
|
29
|
+
url: url
|
|
30
|
+
}, response, status);
|
|
31
|
+
return {
|
|
32
|
+
source: source,
|
|
33
|
+
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
34
|
+
display: display,
|
|
35
|
+
id: id
|
|
36
|
+
}, resolvedAttributes)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Provides an analytics context data to supply attributes to events based on a URL
|
|
41
|
+
* and the link state in the store
|
|
42
|
+
*/
|
|
43
|
+
export var useSmartLinkAnalyticsContext = function useSmartLinkAnalyticsContext(_ref2) {
|
|
44
|
+
var display = _ref2.display,
|
|
45
|
+
id = _ref2.id,
|
|
46
|
+
source = _ref2.source,
|
|
47
|
+
url = _ref2.url;
|
|
48
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
49
|
+
store = _useSmartLinkContext.store;
|
|
50
|
+
var state = store ? getUrl(store, url) : undefined;
|
|
51
|
+
return useMemo(function () {
|
|
52
|
+
return fg('platform-smart-card-migrate-embed-modal-analytics') ? getSmartLinkAnalyticsContext({
|
|
53
|
+
display: display,
|
|
54
|
+
id: id,
|
|
55
|
+
response: state === null || state === void 0 ? void 0 : state.details,
|
|
56
|
+
source: source,
|
|
57
|
+
status: state === null || state === void 0 ? void 0 : state.status,
|
|
58
|
+
url: url
|
|
59
|
+
}) : {};
|
|
60
|
+
}, [display, id, source, state === null || state === void 0 ? void 0 : state.details, state === null || state === void 0 ? void 0 : state.status, url]);
|
|
61
|
+
};
|
|
62
|
+
|
|
7
63
|
/**
|
|
8
64
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
9
65
|
* and the link state in the store
|
|
10
66
|
*/
|
|
11
|
-
|
|
12
|
-
var children =
|
|
13
|
-
|
|
14
|
-
|
|
67
|
+
var ExtendedSmartLinkAnalyticsContext = function ExtendedSmartLinkAnalyticsContext(_ref3) {
|
|
68
|
+
var children = _ref3.children,
|
|
69
|
+
display = _ref3.display,
|
|
70
|
+
id = _ref3.id,
|
|
71
|
+
source = _ref3.source,
|
|
72
|
+
url = _ref3.url;
|
|
15
73
|
var _useSmartLinkState = useSmartLinkState(url),
|
|
16
74
|
details = _useSmartLinkState.details,
|
|
17
75
|
status = _useSmartLinkState.status;
|
|
76
|
+
var data = getSmartLinkAnalyticsContext({
|
|
77
|
+
display: display,
|
|
78
|
+
id: id,
|
|
79
|
+
response: details,
|
|
80
|
+
source: source,
|
|
81
|
+
status: status,
|
|
82
|
+
url: url
|
|
83
|
+
});
|
|
84
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
85
|
+
data: data
|
|
86
|
+
}, children);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Provides an analytics context to supply attributes to events based on a URL
|
|
91
|
+
* and the link state in the store
|
|
92
|
+
*/
|
|
93
|
+
var LegacySmartLinkAnalyticsContext = function LegacySmartLinkAnalyticsContext(props) {
|
|
94
|
+
var children = props.children,
|
|
95
|
+
url = props.url,
|
|
96
|
+
display = props.display;
|
|
97
|
+
var _useSmartLinkState2 = useSmartLinkState(url),
|
|
98
|
+
details = _useSmartLinkState2.details,
|
|
99
|
+
status = _useSmartLinkState2.status;
|
|
18
100
|
var attributes = getResolvedAttributes({
|
|
19
101
|
url: url
|
|
20
102
|
}, details, status);
|
|
@@ -25,4 +107,12 @@ export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(props)
|
|
|
25
107
|
attributes: attributes
|
|
26
108
|
}
|
|
27
109
|
}, children));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Provides an analytics context to supply attributes to events based on a URL
|
|
114
|
+
* and the link state in the store
|
|
115
|
+
*/
|
|
116
|
+
export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(props) {
|
|
117
|
+
return fg('platform-smart-card-migrate-embed-modal-analytics') ? /*#__PURE__*/React.createElement(ExtendedSmartLinkAnalyticsContext, props) : /*#__PURE__*/React.createElement(LegacySmartLinkAnalyticsContext, props);
|
|
28
118
|
};
|