@atlaskit/smart-card 21.3.0 → 22.0.0
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 +43 -0
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +10 -2
- 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 +386 -109
- package/dist/cjs/utils/analytics/analytics.js +239 -72
- package/dist/cjs/utils/analytics/index.js +32 -5
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +25 -3
- package/dist/cjs/view/CardWithUrl/loader.js +6 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +9 -2
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/cjs/view/HoverCard/index.js +6 -1
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +10 -2
- 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 +379 -39
- package/dist/es2019/utils/analytics/analytics.js +253 -78
- package/dist/es2019/utils/analytics/index.js +32 -4
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +25 -3
- package/dist/es2019/view/CardWithUrl/loader.js +6 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +9 -2
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/es2019/view/HoverCard/index.js +6 -1
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +10 -2
- 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 +383 -109
- package/dist/esm/utils/analytics/analytics.js +239 -72
- package/dist/esm/utils/analytics/index.js +31 -4
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +25 -3
- package/dist/esm/view/CardWithUrl/loader.js +6 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +9 -2
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +15 -4
- package/dist/esm/view/HoverCard/index.js +6 -1
- package/dist/types/state/analytics/types.d.ts +9 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +18 -23
- package/dist/types/state/hooks/useSmartLink.d.ts +17 -18
- 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/package.json +1 -1
- package/report.api.md +271 -108
|
@@ -1,9 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
1
8
|
import { useMemo } from 'react';
|
|
2
9
|
import { getUrl } from '@atlaskit/linking-common';
|
|
3
10
|
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, invokeSucceededEvent as _invokeSucceededEvent, invokeFailedEvent as _invokeFailedEvent, connectSucceededEvent as _connectSucceededEvent, connectFailedEvent as _connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
4
11
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
5
12
|
import { getDefinitionId, getExtensionKey, getResourceType, getSubproduct, getProduct } from '../helpers';
|
|
6
13
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
14
|
+
|
|
15
|
+
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
16
|
+
if (event && event.attributes) {
|
|
17
|
+
for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
|
|
18
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
19
|
+
key = _Object$entries$_i[0],
|
|
20
|
+
value = _Object$entries$_i[1];
|
|
21
|
+
|
|
22
|
+
if (event.attributes[key] === undefined) {
|
|
23
|
+
event.attributes[key] = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return event;
|
|
29
|
+
};
|
|
7
30
|
/**
|
|
8
31
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
9
32
|
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
@@ -14,6 +37,7 @@ import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
|
14
37
|
* @returns
|
|
15
38
|
*/
|
|
16
39
|
|
|
40
|
+
|
|
17
41
|
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchAnalytics, id, defaultLocation) {
|
|
18
42
|
var defaultId = id || 'NULL'; // We don't want to trigger a re-render by using useSmartCardState
|
|
19
43
|
|
|
@@ -27,6 +51,17 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
27
51
|
var extractedResourceType = getResourceType(details);
|
|
28
52
|
var extractedSubproduct = getSubproduct(details);
|
|
29
53
|
var extractedProduct = getProduct(details);
|
|
54
|
+
var commonAttributes = useMemo(function () {
|
|
55
|
+
return {
|
|
56
|
+
id: defaultId,
|
|
57
|
+
definitionId: extractedDefinitionId,
|
|
58
|
+
extensionKey: extractedExtensionKey,
|
|
59
|
+
resourceType: extractedResourceType,
|
|
60
|
+
destinationSubproduct: extractedSubproduct,
|
|
61
|
+
destinationProduct: extractedProduct,
|
|
62
|
+
location: defaultLocation
|
|
63
|
+
};
|
|
64
|
+
}, [defaultId, extractedDefinitionId, extractedExtensionKey, extractedResourceType, extractedSubproduct, extractedProduct, defaultLocation]);
|
|
30
65
|
/** Contains all ui analytics events */
|
|
31
66
|
|
|
32
67
|
var ui = useMemo(function () {
|
|
@@ -39,10 +74,23 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
39
74
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
40
75
|
* @returns
|
|
41
76
|
*/
|
|
42
|
-
authEvent: function authEvent(
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
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));
|
|
46
94
|
},
|
|
47
95
|
|
|
48
96
|
/**
|
|
@@ -53,10 +101,23 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
53
101
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
54
102
|
* @returns
|
|
55
103
|
*/
|
|
56
|
-
authAlternateAccountEvent: function authAlternateAccountEvent(
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
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));
|
|
60
121
|
},
|
|
61
122
|
|
|
62
123
|
/**
|
|
@@ -71,18 +132,29 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
71
132
|
* @param destinationProduct The product the Smart Link is linked to.
|
|
72
133
|
* @returns
|
|
73
134
|
*/
|
|
74
|
-
cardClickedEvent: function cardClickedEvent() {
|
|
75
|
-
var id =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return dispatchAnalytics(uiCardClickedEvent(
|
|
135
|
+
cardClickedEvent: function cardClickedEvent(_ref3) {
|
|
136
|
+
var id = _ref3.id,
|
|
137
|
+
display = _ref3.display,
|
|
138
|
+
status = _ref3.status,
|
|
139
|
+
definitionId = _ref3.definitionId,
|
|
140
|
+
extensionKey = _ref3.extensionKey,
|
|
141
|
+
isModifierKeyPressed = _ref3.isModifierKeyPressed,
|
|
142
|
+
location = _ref3.location,
|
|
143
|
+
destinationProduct = _ref3.destinationProduct,
|
|
144
|
+
destinationSubproduct = _ref3.destinationSubproduct,
|
|
145
|
+
actionSubjectId = _ref3.actionSubjectId;
|
|
146
|
+
return dispatchAnalytics(applyCommonAttributes(uiCardClickedEvent({
|
|
147
|
+
id: id,
|
|
148
|
+
display: display,
|
|
149
|
+
status: status,
|
|
150
|
+
definitionId: definitionId,
|
|
151
|
+
extensionKey: extensionKey,
|
|
152
|
+
isModifierKeyPressed: isModifierKeyPressed,
|
|
153
|
+
location: location,
|
|
154
|
+
destinationProduct: destinationProduct,
|
|
155
|
+
destinationSubproduct: destinationSubproduct,
|
|
156
|
+
actionSubjectId: actionSubjectId
|
|
157
|
+
}), commonAttributes));
|
|
86
158
|
},
|
|
87
159
|
|
|
88
160
|
/**
|
|
@@ -95,19 +167,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
95
167
|
* @param invokeType Whether the action invoked made a call to a server.
|
|
96
168
|
* @returns
|
|
97
169
|
*/
|
|
98
|
-
actionClickedEvent: function actionClickedEvent() {
|
|
99
|
-
var id =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
170
|
+
actionClickedEvent: function actionClickedEvent(_ref4) {
|
|
171
|
+
var id = _ref4.id,
|
|
172
|
+
actionType = _ref4.actionType,
|
|
173
|
+
display = _ref4.display,
|
|
174
|
+
invokeType = _ref4.invokeType,
|
|
175
|
+
extensionKey = _ref4.extensionKey,
|
|
176
|
+
definitionId = _ref4.definitionId,
|
|
177
|
+
resourceType = _ref4.resourceType,
|
|
178
|
+
destinationProduct = _ref4.destinationProduct,
|
|
179
|
+
destinationSubproduct = _ref4.destinationSubproduct,
|
|
180
|
+
location = _ref4.location;
|
|
104
181
|
startUfoExperience('smart-link-action-invocation', id, {
|
|
105
182
|
actionType: actionType,
|
|
106
183
|
display: display,
|
|
107
184
|
extensionKey: extensionKey,
|
|
108
185
|
invokeType: invokeType
|
|
109
186
|
});
|
|
110
|
-
dispatchAnalytics(uiActionClickedEvent(
|
|
187
|
+
dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
|
|
188
|
+
id: id,
|
|
189
|
+
actionType: actionType,
|
|
190
|
+
display: display,
|
|
191
|
+
extensionKey: extensionKey,
|
|
192
|
+
definitionId: definitionId,
|
|
193
|
+
resourceType: resourceType,
|
|
194
|
+
destinationProduct: destinationProduct,
|
|
195
|
+
destinationSubproduct: destinationSubproduct,
|
|
196
|
+
location: location
|
|
197
|
+
}), commonAttributes));
|
|
111
198
|
},
|
|
112
199
|
|
|
113
200
|
/**
|
|
@@ -118,11 +205,24 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
118
205
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
119
206
|
* @param previewInvokeMethod How the preview was triggered.
|
|
120
207
|
*/
|
|
121
|
-
hoverCardOpenLinkClickedEvent: function hoverCardOpenLinkClickedEvent(
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
208
|
+
hoverCardOpenLinkClickedEvent: function hoverCardOpenLinkClickedEvent(_ref5) {
|
|
209
|
+
var previewDisplay = _ref5.previewDisplay,
|
|
210
|
+
definitionId = _ref5.definitionId,
|
|
211
|
+
extensionKey = _ref5.extensionKey,
|
|
212
|
+
destinationProduct = _ref5.destinationProduct,
|
|
213
|
+
destinationSubproduct = _ref5.destinationSubproduct,
|
|
214
|
+
location = _ref5.location,
|
|
215
|
+
previewInvokeMethod = _ref5.previewInvokeMethod;
|
|
216
|
+
dispatchAnalytics(applyCommonAttributes(uiHoverCardOpenLinkClickedEvent({
|
|
217
|
+
id: defaultId,
|
|
218
|
+
previewDisplay: previewDisplay,
|
|
219
|
+
definitionId: definitionId,
|
|
220
|
+
extensionKey: extensionKey,
|
|
221
|
+
destinationProduct: destinationProduct,
|
|
222
|
+
destinationSubproduct: destinationSubproduct,
|
|
223
|
+
location: location,
|
|
224
|
+
previewInvokeMethod: previewInvokeMethod
|
|
225
|
+
}), commonAttributes));
|
|
126
226
|
},
|
|
127
227
|
|
|
128
228
|
/**
|
|
@@ -132,10 +232,23 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
132
232
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
133
233
|
* @returns
|
|
134
234
|
*/
|
|
135
|
-
closedAuthEvent: function closedAuthEvent(
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
|
|
235
|
+
closedAuthEvent: function closedAuthEvent(_ref6) {
|
|
236
|
+
var display = _ref6.display,
|
|
237
|
+
extensionKey = _ref6.extensionKey,
|
|
238
|
+
definitionId = _ref6.definitionId,
|
|
239
|
+
resourceType = _ref6.resourceType,
|
|
240
|
+
destinationProduct = _ref6.destinationProduct,
|
|
241
|
+
destinationSubproduct = _ref6.destinationSubproduct,
|
|
242
|
+
location = _ref6.location;
|
|
243
|
+
return dispatchAnalytics(applyCommonAttributes(uiClosedAuthEvent({
|
|
244
|
+
display: display,
|
|
245
|
+
extensionKey: extensionKey,
|
|
246
|
+
definitionId: definitionId,
|
|
247
|
+
resourceType: resourceType,
|
|
248
|
+
destinationProduct: destinationProduct,
|
|
249
|
+
destinationSubproduct: destinationSubproduct,
|
|
250
|
+
location: location
|
|
251
|
+
}), commonAttributes));
|
|
139
252
|
},
|
|
140
253
|
|
|
141
254
|
/**
|
|
@@ -146,19 +259,35 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
146
259
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
147
260
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
148
261
|
*/
|
|
149
|
-
renderSuccessEvent: function renderSuccessEvent(
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
262
|
+
renderSuccessEvent: function renderSuccessEvent(_ref7) {
|
|
263
|
+
var display = _ref7.display,
|
|
264
|
+
status = _ref7.status,
|
|
265
|
+
id = _ref7.id,
|
|
266
|
+
extensionKey = _ref7.extensionKey,
|
|
267
|
+
definitionId = _ref7.definitionId,
|
|
268
|
+
resourceType = _ref7.resourceType,
|
|
269
|
+
destinationProduct = _ref7.destinationProduct,
|
|
270
|
+
destinationSubproduct = _ref7.destinationSubproduct,
|
|
271
|
+
location = _ref7.location;
|
|
272
|
+
var experienceId = id ? id : defaultId;
|
|
273
|
+
succeedUfoExperience('smart-link-rendered', experienceId, {
|
|
154
274
|
extensionKey: extensionKey,
|
|
155
275
|
display: display
|
|
156
276
|
}); // UFO will disregard this if authentication experience has not yet been started
|
|
157
277
|
|
|
158
|
-
succeedUfoExperience('smart-link-authenticated',
|
|
278
|
+
succeedUfoExperience('smart-link-authenticated', experienceId, {
|
|
159
279
|
display: display
|
|
160
280
|
});
|
|
161
|
-
dispatchAnalytics(uiRenderSuccessEvent(
|
|
281
|
+
dispatchAnalytics(applyCommonAttributes(uiRenderSuccessEvent({
|
|
282
|
+
display: display,
|
|
283
|
+
status: status,
|
|
284
|
+
extensionKey: extensionKey,
|
|
285
|
+
definitionId: definitionId,
|
|
286
|
+
resourceType: resourceType,
|
|
287
|
+
destinationProduct: destinationProduct,
|
|
288
|
+
destinationSubproduct: destinationSubproduct,
|
|
289
|
+
location: location
|
|
290
|
+
}), commonAttributes));
|
|
162
291
|
},
|
|
163
292
|
|
|
164
293
|
/**
|
|
@@ -168,16 +297,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
168
297
|
* @param error: An error representing why the Smart Link render failed.
|
|
169
298
|
* @param errorInfo: Additional details about the error including the stack trace.
|
|
170
299
|
*/
|
|
171
|
-
renderFailedEvent: function renderFailedEvent(
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
300
|
+
renderFailedEvent: function renderFailedEvent(_ref8) {
|
|
301
|
+
var display = _ref8.display,
|
|
302
|
+
id = _ref8.id,
|
|
303
|
+
error = _ref8.error,
|
|
304
|
+
errorInfo = _ref8.errorInfo,
|
|
305
|
+
extensionKey = _ref8.extensionKey,
|
|
306
|
+
definitionId = _ref8.definitionId,
|
|
307
|
+
resourceType = _ref8.resourceType,
|
|
308
|
+
destinationProduct = _ref8.destinationProduct,
|
|
309
|
+
destinationSubproduct = _ref8.destinationSubproduct,
|
|
310
|
+
location = _ref8.location;
|
|
311
|
+
var experienceId = id ? id : defaultId; // Start and fail the smart-link-rendered experience. If it has already
|
|
176
312
|
// been started nothing happens.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
failUfoExperience('smart-link-
|
|
180
|
-
|
|
313
|
+
|
|
314
|
+
startUfoExperience('smart-link-rendered', experienceId);
|
|
315
|
+
failUfoExperience('smart-link-rendered', experienceId);
|
|
316
|
+
failUfoExperience('smart-link-authenticated', experienceId);
|
|
317
|
+
dispatchAnalytics(applyCommonAttributes(uiRenderFailedEvent({
|
|
318
|
+
display: display,
|
|
319
|
+
error: error,
|
|
320
|
+
errorInfo: errorInfo,
|
|
321
|
+
extensionKey: extensionKey,
|
|
322
|
+
definitionId: definitionId,
|
|
323
|
+
resourceType: resourceType,
|
|
324
|
+
destinationProduct: destinationProduct,
|
|
325
|
+
destinationSubproduct: destinationSubproduct,
|
|
326
|
+
location: location
|
|
327
|
+
}), commonAttributes));
|
|
181
328
|
},
|
|
182
329
|
|
|
183
330
|
/**
|
|
@@ -188,11 +335,27 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
188
335
|
* @param previewInvokeMethod How the preview was triggered.
|
|
189
336
|
* @returns
|
|
190
337
|
*/
|
|
191
|
-
hoverCardViewedEvent: function hoverCardViewedEvent(
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
338
|
+
hoverCardViewedEvent: function hoverCardViewedEvent(_ref9) {
|
|
339
|
+
var previewDisplay = _ref9.previewDisplay,
|
|
340
|
+
previewInvokeMethod = _ref9.previewInvokeMethod,
|
|
341
|
+
id = _ref9.id,
|
|
342
|
+
extensionKey = _ref9.extensionKey,
|
|
343
|
+
definitionId = _ref9.definitionId,
|
|
344
|
+
resourceType = _ref9.resourceType,
|
|
345
|
+
destinationProduct = _ref9.destinationProduct,
|
|
346
|
+
destinationSubproduct = _ref9.destinationSubproduct,
|
|
347
|
+
location = _ref9.location;
|
|
348
|
+
return dispatchAnalytics(applyCommonAttributes(uiHoverCardViewedEvent({
|
|
349
|
+
id: id,
|
|
350
|
+
previewDisplay: previewDisplay,
|
|
351
|
+
extensionKey: extensionKey,
|
|
352
|
+
definitionId: definitionId,
|
|
353
|
+
resourceType: resourceType,
|
|
354
|
+
destinationProduct: destinationProduct,
|
|
355
|
+
destinationSubproduct: destinationSubproduct,
|
|
356
|
+
location: location,
|
|
357
|
+
previewInvokeMethod: previewInvokeMethod
|
|
358
|
+
}), commonAttributes));
|
|
196
359
|
},
|
|
197
360
|
|
|
198
361
|
/**
|
|
@@ -204,14 +367,32 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
204
367
|
* @param previewInvokeMethod How the preview was triggered.
|
|
205
368
|
* @returns
|
|
206
369
|
*/
|
|
207
|
-
hoverCardDismissedEvent: function hoverCardDismissedEvent(
|
|
208
|
-
var id =
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
370
|
+
hoverCardDismissedEvent: function hoverCardDismissedEvent(_ref10) {
|
|
371
|
+
var id = _ref10.id,
|
|
372
|
+
previewDisplay = _ref10.previewDisplay,
|
|
373
|
+
hoverTime = _ref10.hoverTime,
|
|
374
|
+
previewInvokeMethod = _ref10.previewInvokeMethod,
|
|
375
|
+
extensionKey = _ref10.extensionKey,
|
|
376
|
+
definitionId = _ref10.definitionId,
|
|
377
|
+
resourceType = _ref10.resourceType,
|
|
378
|
+
destinationProduct = _ref10.destinationProduct,
|
|
379
|
+
destinationSubproduct = _ref10.destinationSubproduct,
|
|
380
|
+
location = _ref10.location;
|
|
381
|
+
return dispatchAnalytics(applyCommonAttributes(uiHoverCardDismissedEvent({
|
|
382
|
+
previewDisplay: previewDisplay,
|
|
383
|
+
id: id,
|
|
384
|
+
hoverTime: hoverTime,
|
|
385
|
+
extensionKey: extensionKey,
|
|
386
|
+
definitionId: definitionId,
|
|
387
|
+
resourceType: resourceType,
|
|
388
|
+
destinationProduct: destinationProduct,
|
|
389
|
+
destinationSubproduct: destinationSubproduct,
|
|
390
|
+
location: location,
|
|
391
|
+
previewInvokeMethod: previewInvokeMethod
|
|
392
|
+
}), commonAttributes));
|
|
212
393
|
}
|
|
213
394
|
};
|
|
214
|
-
}, [
|
|
395
|
+
}, [defaultId, commonAttributes, dispatchAnalytics]);
|
|
215
396
|
/** Contains all operational analytics events */
|
|
216
397
|
|
|
217
398
|
var operational = useMemo(function () {
|
|
@@ -223,13 +404,28 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
223
404
|
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
224
405
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
225
406
|
*/
|
|
226
|
-
invokeSucceededEvent: function invokeSucceededEvent() {
|
|
227
|
-
var id =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
407
|
+
invokeSucceededEvent: function invokeSucceededEvent(_ref11) {
|
|
408
|
+
var id = _ref11.id,
|
|
409
|
+
actionType = _ref11.actionType,
|
|
410
|
+
display = _ref11.display,
|
|
411
|
+
extensionKey = _ref11.extensionKey,
|
|
412
|
+
definitionId = _ref11.definitionId,
|
|
413
|
+
resourceType = _ref11.resourceType,
|
|
414
|
+
destinationProduct = _ref11.destinationProduct,
|
|
415
|
+
destinationSubproduct = _ref11.destinationSubproduct,
|
|
416
|
+
location = _ref11.location;
|
|
231
417
|
succeedUfoExperience('smart-link-action-invocation', id);
|
|
232
|
-
dispatchAnalytics(_invokeSucceededEvent(
|
|
418
|
+
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
419
|
+
id: id,
|
|
420
|
+
actionType: actionType,
|
|
421
|
+
display: display,
|
|
422
|
+
extensionKey: extensionKey,
|
|
423
|
+
definitionId: definitionId,
|
|
424
|
+
resourceType: resourceType,
|
|
425
|
+
destinationProduct: destinationProduct,
|
|
426
|
+
destinationSubproduct: destinationSubproduct,
|
|
427
|
+
location: location
|
|
428
|
+
}), commonAttributes));
|
|
233
429
|
},
|
|
234
430
|
|
|
235
431
|
/**
|
|
@@ -240,14 +436,30 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
240
436
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
241
437
|
* @param reason The reason the invocation failed.
|
|
242
438
|
*/
|
|
243
|
-
invokeFailedEvent: function invokeFailedEvent() {
|
|
244
|
-
var id =
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
439
|
+
invokeFailedEvent: function invokeFailedEvent(_ref12) {
|
|
440
|
+
var id = _ref12.id,
|
|
441
|
+
actionType = _ref12.actionType,
|
|
442
|
+
display = _ref12.display,
|
|
443
|
+
reason = _ref12.reason,
|
|
444
|
+
extensionKey = _ref12.extensionKey,
|
|
445
|
+
definitionId = _ref12.definitionId,
|
|
446
|
+
resourceType = _ref12.resourceType,
|
|
447
|
+
destinationProduct = _ref12.destinationProduct,
|
|
448
|
+
destinationSubproduct = _ref12.destinationSubproduct,
|
|
449
|
+
location = _ref12.location;
|
|
249
450
|
failUfoExperience('smart-link-action-invocation', id);
|
|
250
|
-
dispatchAnalytics(_invokeFailedEvent(
|
|
451
|
+
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
452
|
+
id: id,
|
|
453
|
+
actionType: actionType,
|
|
454
|
+
display: display,
|
|
455
|
+
reason: reason,
|
|
456
|
+
extensionKey: extensionKey,
|
|
457
|
+
definitionId: definitionId,
|
|
458
|
+
resourceType: resourceType,
|
|
459
|
+
destinationProduct: destinationProduct,
|
|
460
|
+
destinationSubproduct: destinationSubproduct,
|
|
461
|
+
location: location
|
|
462
|
+
}), commonAttributes));
|
|
251
463
|
},
|
|
252
464
|
|
|
253
465
|
/**
|
|
@@ -256,15 +468,28 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
256
468
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
257
469
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
258
470
|
*/
|
|
259
|
-
connectSucceededEvent: function connectSucceededEvent() {
|
|
260
|
-
var id =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
471
|
+
connectSucceededEvent: function connectSucceededEvent(_ref13) {
|
|
472
|
+
var id = _ref13.id,
|
|
473
|
+
extensionKey = _ref13.extensionKey,
|
|
474
|
+
definitionId = _ref13.definitionId,
|
|
475
|
+
resourceType = _ref13.resourceType,
|
|
476
|
+
destinationProduct = _ref13.destinationProduct,
|
|
477
|
+
destinationSubproduct = _ref13.destinationSubproduct,
|
|
478
|
+
location = _ref13.location;
|
|
479
|
+
var experienceId = id ? id : defaultId;
|
|
480
|
+
startUfoExperience('smart-link-authenticated', experienceId, {
|
|
264
481
|
extensionKey: extensionKey,
|
|
265
482
|
status: 'success'
|
|
266
483
|
});
|
|
267
|
-
dispatchAnalytics(_connectSucceededEvent(
|
|
484
|
+
dispatchAnalytics(applyCommonAttributes(_connectSucceededEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
485
|
+
id: experienceId,
|
|
486
|
+
extensionKey: extensionKey,
|
|
487
|
+
definitionId: definitionId,
|
|
488
|
+
resourceType: resourceType,
|
|
489
|
+
destinationProduct: destinationProduct,
|
|
490
|
+
destinationSubproduct: destinationSubproduct,
|
|
491
|
+
location: location
|
|
492
|
+
})), commonAttributes));
|
|
268
493
|
},
|
|
269
494
|
|
|
270
495
|
/**
|
|
@@ -274,16 +499,30 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
274
499
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
275
500
|
* @param reason The reason why the Smart Link connect account failed.
|
|
276
501
|
*/
|
|
277
|
-
connectFailedEvent: function connectFailedEvent() {
|
|
278
|
-
var id =
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
502
|
+
connectFailedEvent: function connectFailedEvent(_ref14) {
|
|
503
|
+
var id = _ref14.id,
|
|
504
|
+
reason = _ref14.reason,
|
|
505
|
+
extensionKey = _ref14.extensionKey,
|
|
506
|
+
definitionId = _ref14.definitionId,
|
|
507
|
+
resourceType = _ref14.resourceType,
|
|
508
|
+
destinationProduct = _ref14.destinationProduct,
|
|
509
|
+
destinationSubproduct = _ref14.destinationSubproduct,
|
|
510
|
+
location = _ref14.location;
|
|
511
|
+
var experienceId = id ? id : defaultId;
|
|
512
|
+
startUfoExperience('smart-link-authenticated', experienceId, {
|
|
283
513
|
extensionKey: extensionKey,
|
|
284
514
|
status: reason
|
|
285
515
|
});
|
|
286
|
-
dispatchAnalytics(_connectFailedEvent(
|
|
516
|
+
dispatchAnalytics(applyCommonAttributes(_connectFailedEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
517
|
+
id: experienceId,
|
|
518
|
+
reason: reason,
|
|
519
|
+
extensionKey: extensionKey,
|
|
520
|
+
definitionId: definitionId,
|
|
521
|
+
resourceType: resourceType,
|
|
522
|
+
destinationProduct: destinationProduct,
|
|
523
|
+
destinationSubproduct: destinationSubproduct,
|
|
524
|
+
location: location
|
|
525
|
+
})), commonAttributes));
|
|
287
526
|
},
|
|
288
527
|
|
|
289
528
|
/**
|
|
@@ -295,21 +534,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
295
534
|
* @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
|
|
296
535
|
* @param error An error representing why the Smart Link request failed.
|
|
297
536
|
*/
|
|
298
|
-
instrument: function instrument() {
|
|
299
|
-
var id =
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
537
|
+
instrument: function instrument(_ref15) {
|
|
538
|
+
var id = _ref15.id,
|
|
539
|
+
status = _ref15.status,
|
|
540
|
+
extensionKey = _ref15.extensionKey,
|
|
541
|
+
definitionId = _ref15.definitionId,
|
|
542
|
+
resourceType = _ref15.resourceType,
|
|
543
|
+
destinationProduct = _ref15.destinationProduct,
|
|
544
|
+
destinationSubproduct = _ref15.destinationSubproduct,
|
|
545
|
+
location = _ref15.location,
|
|
546
|
+
error = _ref15.error;
|
|
547
|
+
var event = instrumentEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
548
|
+
id: id,
|
|
549
|
+
status: status,
|
|
550
|
+
extensionKey: extensionKey,
|
|
551
|
+
definitionId: definitionId,
|
|
552
|
+
resourceType: resourceType,
|
|
553
|
+
destinationProduct: destinationProduct,
|
|
554
|
+
destinationSubproduct: destinationSubproduct,
|
|
555
|
+
location: location,
|
|
556
|
+
error: error
|
|
557
|
+
}));
|
|
306
558
|
|
|
307
559
|
if (event) {
|
|
308
|
-
dispatchAnalytics(event);
|
|
560
|
+
dispatchAnalytics(applyCommonAttributes(event, commonAttributes));
|
|
309
561
|
}
|
|
310
562
|
}
|
|
311
563
|
};
|
|
312
|
-
}, [defaultId,
|
|
564
|
+
}, [defaultId, commonAttributes, dispatchAnalytics]);
|
|
313
565
|
/** Contains all track analytics events */
|
|
314
566
|
|
|
315
567
|
var track = useMemo(function () {
|
|
@@ -320,13 +572,24 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
320
572
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
321
573
|
* @returns
|
|
322
574
|
*/
|
|
323
|
-
appAccountConnected: function appAccountConnected() {
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
575
|
+
appAccountConnected: function appAccountConnected(_ref16) {
|
|
576
|
+
var extensionKey = _ref16.extensionKey,
|
|
577
|
+
definitionId = _ref16.definitionId,
|
|
578
|
+
resourceType = _ref16.resourceType,
|
|
579
|
+
destinationProduct = _ref16.destinationProduct,
|
|
580
|
+
destinationSubproduct = _ref16.destinationSubproduct,
|
|
581
|
+
location = _ref16.location;
|
|
582
|
+
return dispatchAnalytics(applyCommonAttributes(trackAppAccountConnected(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
583
|
+
extensionKey: extensionKey,
|
|
584
|
+
definitionId: definitionId,
|
|
585
|
+
resourceType: resourceType,
|
|
586
|
+
destinationProduct: destinationProduct,
|
|
587
|
+
destinationSubproduct: destinationSubproduct,
|
|
588
|
+
location: location
|
|
589
|
+
})), commonAttributes));
|
|
327
590
|
}
|
|
328
591
|
};
|
|
329
|
-
}, [
|
|
592
|
+
}, [commonAttributes, dispatchAnalytics]);
|
|
330
593
|
/** Contains all screen analytics events */
|
|
331
594
|
|
|
332
595
|
var screen = useMemo(function () {
|
|
@@ -337,13 +600,24 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
|
|
|
337
600
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
338
601
|
* @returns
|
|
339
602
|
*/
|
|
340
|
-
authPopupEvent: function authPopupEvent() {
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
603
|
+
authPopupEvent: function authPopupEvent(_ref17) {
|
|
604
|
+
var extensionKey = _ref17.extensionKey,
|
|
605
|
+
definitionId = _ref17.definitionId,
|
|
606
|
+
resourceType = _ref17.resourceType,
|
|
607
|
+
destinationProduct = _ref17.destinationProduct,
|
|
608
|
+
destinationSubproduct = _ref17.destinationSubproduct,
|
|
609
|
+
location = _ref17.location;
|
|
610
|
+
return dispatchAnalytics(applyCommonAttributes(screenAuthPopupEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
611
|
+
extensionKey: extensionKey,
|
|
612
|
+
definitionId: definitionId,
|
|
613
|
+
resourceType: resourceType,
|
|
614
|
+
destinationProduct: destinationProduct,
|
|
615
|
+
destinationSubproduct: destinationSubproduct,
|
|
616
|
+
location: location
|
|
617
|
+
})), commonAttributes));
|
|
344
618
|
}
|
|
345
619
|
};
|
|
346
|
-
}, [
|
|
620
|
+
}, [commonAttributes, dispatchAnalytics]);
|
|
347
621
|
return useMemo(function () {
|
|
348
622
|
return {
|
|
349
623
|
ui: ui,
|