@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.
Files changed (45) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +10 -2
  3. package/dist/cjs/state/actions/index.js +54 -10
  4. package/dist/cjs/state/analytics/types.js +5 -0
  5. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +386 -109
  6. package/dist/cjs/utils/analytics/analytics.js +239 -72
  7. package/dist/cjs/utils/analytics/index.js +32 -5
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/cjs/view/CardWithUrl/component.js +25 -3
  10. package/dist/cjs/view/CardWithUrl/loader.js +6 -1
  11. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +9 -2
  12. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +15 -4
  13. package/dist/cjs/view/HoverCard/index.js +6 -1
  14. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +10 -2
  15. package/dist/es2019/state/actions/index.js +54 -10
  16. package/dist/es2019/state/analytics/types.js +1 -0
  17. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +379 -39
  18. package/dist/es2019/utils/analytics/analytics.js +253 -78
  19. package/dist/es2019/utils/analytics/index.js +32 -4
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/es2019/view/CardWithUrl/component.js +25 -3
  22. package/dist/es2019/view/CardWithUrl/loader.js +6 -1
  23. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +9 -2
  24. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +15 -4
  25. package/dist/es2019/view/HoverCard/index.js +6 -1
  26. package/dist/esm/extractors/common/actions/extractPreviewAction.js +10 -2
  27. package/dist/esm/state/actions/index.js +54 -10
  28. package/dist/esm/state/analytics/types.js +1 -0
  29. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +383 -109
  30. package/dist/esm/utils/analytics/analytics.js +239 -72
  31. package/dist/esm/utils/analytics/index.js +31 -4
  32. package/dist/esm/version.json +1 -1
  33. package/dist/esm/view/CardWithUrl/component.js +25 -3
  34. package/dist/esm/view/CardWithUrl/loader.js +6 -1
  35. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +9 -2
  36. package/dist/esm/view/HoverCard/components/HoverCardContent.js +15 -4
  37. package/dist/esm/view/HoverCard/index.js +6 -1
  38. package/dist/types/state/analytics/types.d.ts +9 -0
  39. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +18 -23
  40. package/dist/types/state/hooks/useSmartLink.d.ts +17 -18
  41. package/dist/types/utils/analytics/analytics.d.ts +19 -21
  42. package/dist/types/utils/analytics/index.d.ts +2 -2
  43. package/dist/types/utils/analytics/types.d.ts +91 -0
  44. package/package.json +1 -1
  45. package/report.api.md +271 -108
@@ -69,31 +69,32 @@ var fireSmartLinkEvent = function fireSmartLinkEvent(payload, createAnalyticsEve
69
69
 
70
70
  exports.fireSmartLinkEvent = fireSmartLinkEvent;
71
71
 
72
- var resolvedEvent = function resolvedEvent(id, definitionId, extensionKey, resourceType) {
72
+ var resolvedEvent = function resolvedEvent(props) {
73
73
  return {
74
74
  action: 'resolved',
75
75
  actionSubject: 'smartLink',
76
76
  eventType: 'operational',
77
- attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
78
- id: id
79
- }, context), definitionId ? {
80
- definitionId: definitionId
81
- } : {}), extensionKey ? {
82
- extensionKey: extensionKey
83
- } : {}), resourceType ? {
84
- resourceType: resourceType
85
- } : {})
77
+ attributes: _objectSpread(_objectSpread({}, props), context)
86
78
  };
87
79
  };
88
80
 
89
81
  exports.resolvedEvent = resolvedEvent;
90
82
 
91
- var unresolvedEvent = function unresolvedEvent(id, status, definitionId, extensionKey, resourceType, error) {
83
+ var unresolvedEvent = function unresolvedEvent(_ref) {
84
+ var id = _ref.id,
85
+ definitionId = _ref.definitionId,
86
+ extensionKey = _ref.extensionKey,
87
+ resourceType = _ref.resourceType,
88
+ destinationSubproduct = _ref.destinationSubproduct,
89
+ destinationProduct = _ref.destinationProduct,
90
+ error = _ref.error,
91
+ status = _ref.status,
92
+ location = _ref.location;
92
93
  return {
93
94
  action: 'unresolved',
94
95
  actionSubject: 'smartLink',
95
96
  eventType: 'operational',
96
- attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
97
+ attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
97
98
  id: id
98
99
  }, context), definitionId ? {
99
100
  definitionId: definitionId
@@ -101,12 +102,18 @@ var unresolvedEvent = function unresolvedEvent(id, status, definitionId, extensi
101
102
  extensionKey: extensionKey
102
103
  } : {}), resourceType ? {
103
104
  resourceType: resourceType
105
+ } : {}), destinationSubproduct ? {
106
+ destinationSubproduct: destinationSubproduct
107
+ } : {}), destinationProduct ? {
108
+ destinationProduct: destinationProduct
109
+ } : {}), location ? {
110
+ location: location
104
111
  } : {}), {}, {
105
112
  reason: status,
106
113
  error: error ? {
107
- message: error.message,
108
- kind: error.kind,
109
- type: error.type
114
+ message: error === null || error === void 0 ? void 0 : error.message,
115
+ kind: error === null || error === void 0 ? void 0 : error.kind,
116
+ type: error === null || error === void 0 ? void 0 : error.type
110
117
  } : undefined
111
118
  })
112
119
  };
@@ -114,7 +121,15 @@ var unresolvedEvent = function unresolvedEvent(id, status, definitionId, extensi
114
121
 
115
122
  exports.unresolvedEvent = unresolvedEvent;
116
123
 
117
- var invokeSucceededEvent = function invokeSucceededEvent(id, actionType, display, extensionKey) {
124
+ var invokeSucceededEvent = function invokeSucceededEvent(_ref2) {
125
+ var id = _ref2.id,
126
+ actionType = _ref2.actionType,
127
+ display = _ref2.display,
128
+ extensionKey = _ref2.extensionKey,
129
+ definitionId = _ref2.definitionId,
130
+ destinationProduct = _ref2.destinationProduct,
131
+ destinationSubproduct = _ref2.destinationSubproduct,
132
+ location = _ref2.location;
118
133
  var measure = (0, _performance.getMeasure)(id, 'resolved') || {
119
134
  duration: undefined
120
135
  };
@@ -126,7 +141,11 @@ var invokeSucceededEvent = function invokeSucceededEvent(id, actionType, display
126
141
  id: id,
127
142
  actionType: actionType,
128
143
  display: display,
129
- extensionKey: extensionKey || '',
144
+ definitionId: definitionId,
145
+ destinationProduct: destinationProduct,
146
+ destinationSubproduct: destinationSubproduct,
147
+ location: location,
148
+ extensionKey: extensionKey,
130
149
  duration: measure.duration
131
150
  })
132
151
  };
@@ -134,7 +153,16 @@ var invokeSucceededEvent = function invokeSucceededEvent(id, actionType, display
134
153
 
135
154
  exports.invokeSucceededEvent = invokeSucceededEvent;
136
155
 
137
- var invokeFailedEvent = function invokeFailedEvent(id, actionType, display, reason, extensionKey) {
156
+ var invokeFailedEvent = function invokeFailedEvent(_ref3) {
157
+ var id = _ref3.id,
158
+ actionType = _ref3.actionType,
159
+ display = _ref3.display,
160
+ reason = _ref3.reason,
161
+ extensionKey = _ref3.extensionKey,
162
+ definitionId = _ref3.definitionId,
163
+ destinationProduct = _ref3.destinationProduct,
164
+ destinationSubproduct = _ref3.destinationSubproduct,
165
+ location = _ref3.location;
138
166
  var measure = (0, _performance.getMeasure)(id, 'errored') || {
139
167
  duration: undefined
140
168
  };
@@ -146,7 +174,11 @@ var invokeFailedEvent = function invokeFailedEvent(id, actionType, display, reas
146
174
  id: id,
147
175
  actionType: actionType,
148
176
  display: display,
149
- extensionKey: extensionKey || '',
177
+ extensionKey: extensionKey,
178
+ definitionId: definitionId,
179
+ destinationProduct: destinationProduct,
180
+ destinationSubproduct: destinationSubproduct,
181
+ location: location,
150
182
  duration: measure.duration,
151
183
  reason: reason
152
184
  })
@@ -155,63 +187,93 @@ var invokeFailedEvent = function invokeFailedEvent(id, actionType, display, reas
155
187
 
156
188
  exports.invokeFailedEvent = invokeFailedEvent;
157
189
 
158
- var connectSucceededEvent = function connectSucceededEvent(definitionId, extensionKey) {
190
+ var connectSucceededEvent = function connectSucceededEvent(_ref4) {
191
+ var definitionId = _ref4.definitionId,
192
+ extensionKey = _ref4.extensionKey,
193
+ destinationProduct = _ref4.destinationProduct,
194
+ destinationSubproduct = _ref4.destinationSubproduct,
195
+ location = _ref4.location;
159
196
  return {
160
197
  action: 'connectSucceeded',
161
198
  actionSubject: 'smartLink',
162
199
  eventType: 'operational',
163
- attributes: _objectSpread(_objectSpread(_objectSpread({}, context), definitionId ? {
164
- definitionId: definitionId
165
- } : {}), extensionKey ? {
166
- extensionKey: extensionKey
167
- } : {})
200
+ attributes: _objectSpread(_objectSpread({}, context), {}, {
201
+ definitionId: definitionId,
202
+ extensionKey: extensionKey,
203
+ destinationProduct: destinationProduct,
204
+ destinationSubproduct: destinationSubproduct,
205
+ location: location
206
+ })
168
207
  };
169
208
  };
170
209
 
171
210
  exports.connectSucceededEvent = connectSucceededEvent;
172
211
 
173
- var connectFailedEvent = function connectFailedEvent(definitionId, extensionKey, reason) {
212
+ var connectFailedEvent = function connectFailedEvent(_ref5) {
213
+ var definitionId = _ref5.definitionId,
214
+ extensionKey = _ref5.extensionKey,
215
+ destinationProduct = _ref5.destinationProduct,
216
+ destinationSubproduct = _ref5.destinationSubproduct,
217
+ location = _ref5.location,
218
+ reason = _ref5.reason;
174
219
  return {
175
220
  action: 'connectFailed',
176
221
  actionSubject: 'smartLink',
177
222
  actionSubjectId: reason,
178
223
  eventType: 'operational',
179
- attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context), reason ? {
180
- reason: reason
181
- } : {}), definitionId ? {
182
- definitionId: definitionId
183
- } : {}), extensionKey ? {
184
- extensionKey: extensionKey
185
- } : {})
224
+ attributes: _objectSpread(_objectSpread({}, context), {}, {
225
+ reason: reason,
226
+ extensionKey: extensionKey,
227
+ definitionId: definitionId,
228
+ destinationProduct: destinationProduct,
229
+ destinationSubproduct: destinationSubproduct,
230
+ location: location
231
+ })
186
232
  };
187
233
  };
188
234
 
189
235
  exports.connectFailedEvent = connectFailedEvent;
190
236
 
191
- var trackAppAccountConnected = function trackAppAccountConnected(definitionId, extensionKey) {
237
+ var trackAppAccountConnected = function trackAppAccountConnected(_ref6) {
238
+ var definitionId = _ref6.definitionId,
239
+ extensionKey = _ref6.extensionKey,
240
+ destinationProduct = _ref6.destinationProduct,
241
+ destinationSubproduct = _ref6.destinationSubproduct,
242
+ location = _ref6.location;
192
243
  return {
193
244
  action: 'connected',
194
245
  actionSubject: 'applicationAccount',
195
246
  eventType: 'track',
196
- attributes: _objectSpread(_objectSpread(_objectSpread({}, context), definitionId ? {
197
- definitionId: definitionId
198
- } : {}), extensionKey ? {
199
- extensionKey: extensionKey
200
- } : {})
247
+ attributes: _objectSpread(_objectSpread({}, context), {}, {
248
+ definitionId: definitionId,
249
+ extensionKey: extensionKey,
250
+ destinationProduct: destinationProduct,
251
+ destinationSubproduct: destinationSubproduct,
252
+ location: location
253
+ })
201
254
  };
202
255
  };
203
256
 
204
257
  exports.trackAppAccountConnected = trackAppAccountConnected;
205
258
 
206
- var uiAuthEvent = function uiAuthEvent(display, definitionId, extensionKey) {
259
+ var uiAuthEvent = function uiAuthEvent(_ref7) {
260
+ var definitionId = _ref7.definitionId,
261
+ extensionKey = _ref7.extensionKey,
262
+ destinationProduct = _ref7.destinationProduct,
263
+ destinationSubproduct = _ref7.destinationSubproduct,
264
+ location = _ref7.location,
265
+ display = _ref7.display;
207
266
  return {
208
267
  action: 'clicked',
209
268
  actionSubject: 'button',
210
269
  actionSubjectId: 'connectAccount',
211
270
  eventType: 'ui',
212
271
  attributes: _objectSpread(_objectSpread({}, context), {}, {
213
- definitionId: definitionId || '',
214
- extensionKey: extensionKey || '',
272
+ definitionId: definitionId,
273
+ extensionKey: extensionKey,
274
+ destinationProduct: destinationProduct,
275
+ destinationSubproduct: destinationSubproduct,
276
+ location: location,
215
277
  display: display
216
278
  })
217
279
  };
@@ -219,15 +281,24 @@ var uiAuthEvent = function uiAuthEvent(display, definitionId, extensionKey) {
219
281
 
220
282
  exports.uiAuthEvent = uiAuthEvent;
221
283
 
222
- var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(display, definitionId, extensionKey) {
284
+ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref8) {
285
+ var definitionId = _ref8.definitionId,
286
+ extensionKey = _ref8.extensionKey,
287
+ destinationProduct = _ref8.destinationProduct,
288
+ destinationSubproduct = _ref8.destinationSubproduct,
289
+ location = _ref8.location,
290
+ display = _ref8.display;
223
291
  return {
224
292
  action: 'clicked',
225
293
  actionSubject: 'smartLink',
226
294
  actionSubjectId: 'tryAnotherAccount',
227
295
  eventType: 'ui',
228
296
  attributes: _objectSpread(_objectSpread({}, context), {}, {
229
- definitionId: definitionId || '',
230
- extensionKey: extensionKey || '',
297
+ definitionId: definitionId,
298
+ extensionKey: extensionKey,
299
+ destinationProduct: destinationProduct,
300
+ destinationSubproduct: destinationSubproduct,
301
+ location: location,
231
302
  display: display
232
303
  })
233
304
  };
@@ -235,7 +306,17 @@ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(display,
235
306
 
236
307
  exports.uiAuthAlternateAccountEvent = uiAuthAlternateAccountEvent;
237
308
 
238
- var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId) {
309
+ var uiCardClickedEvent = function uiCardClickedEvent(_ref9) {
310
+ var id = _ref9.id,
311
+ display = _ref9.display,
312
+ status = _ref9.status,
313
+ definitionId = _ref9.definitionId,
314
+ extensionKey = _ref9.extensionKey,
315
+ isModifierKeyPressed = _ref9.isModifierKeyPressed,
316
+ location = _ref9.location,
317
+ destinationProduct = _ref9.destinationProduct,
318
+ destinationSubproduct = _ref9.destinationSubproduct,
319
+ actionSubjectId = _ref9.actionSubjectId;
239
320
  return {
240
321
  action: 'clicked',
241
322
  actionSubject: 'smartLink',
@@ -244,8 +325,8 @@ var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, defini
244
325
  attributes: _objectSpread(_objectSpread({}, context), {}, {
245
326
  id: id,
246
327
  status: status,
247
- definitionId: definitionId || '',
248
- extensionKey: extensionKey || '',
328
+ definitionId: definitionId,
329
+ extensionKey: extensionKey,
249
330
  display: display,
250
331
  isModifierKeyPressed: isModifierKeyPressed,
251
332
  location: location,
@@ -257,7 +338,15 @@ var uiCardClickedEvent = function uiCardClickedEvent(id, display, status, defini
257
338
 
258
339
  exports.uiCardClickedEvent = uiCardClickedEvent;
259
340
 
260
- var uiActionClickedEvent = function uiActionClickedEvent(id, actionType, extensionKey, display) {
341
+ var uiActionClickedEvent = function uiActionClickedEvent(_ref10) {
342
+ var id = _ref10.id,
343
+ actionType = _ref10.actionType,
344
+ extensionKey = _ref10.extensionKey,
345
+ display = _ref10.display,
346
+ definitionId = _ref10.definitionId,
347
+ destinationProduct = _ref10.destinationProduct,
348
+ destinationSubproduct = _ref10.destinationSubproduct,
349
+ location = _ref10.location;
261
350
  return {
262
351
  action: 'clicked',
263
352
  actionSubject: 'button',
@@ -266,22 +355,35 @@ var uiActionClickedEvent = function uiActionClickedEvent(id, actionType, extensi
266
355
  attributes: _objectSpread(_objectSpread({}, context), {}, {
267
356
  id: id,
268
357
  display: display,
269
- extensionKey: extensionKey || '',
270
- actionType: actionType
358
+ actionType: actionType,
359
+ extensionKey: extensionKey,
360
+ definitionId: definitionId,
361
+ destinationProduct: destinationProduct,
362
+ destinationSubproduct: destinationSubproduct,
363
+ location: location
271
364
  })
272
365
  };
273
366
  };
274
367
 
275
368
  exports.uiActionClickedEvent = uiActionClickedEvent;
276
369
 
277
- var uiClosedAuthEvent = function uiClosedAuthEvent(display, definitionId, extensionKey) {
370
+ var uiClosedAuthEvent = function uiClosedAuthEvent(_ref11) {
371
+ var display = _ref11.display,
372
+ extensionKey = _ref11.extensionKey,
373
+ definitionId = _ref11.definitionId,
374
+ destinationProduct = _ref11.destinationProduct,
375
+ destinationSubproduct = _ref11.destinationSubproduct,
376
+ location = _ref11.location;
278
377
  return {
279
378
  action: 'closed',
280
379
  actionSubject: 'consentModal',
281
380
  eventType: 'ui',
282
381
  attributes: _objectSpread(_objectSpread({}, context), {}, {
283
- definitionId: definitionId || '',
284
- extensionKey: extensionKey || '',
382
+ extensionKey: extensionKey,
383
+ definitionId: definitionId,
384
+ destinationProduct: destinationProduct,
385
+ destinationSubproduct: destinationSubproduct,
386
+ location: location,
285
387
  display: display
286
388
  })
287
389
  };
@@ -289,28 +391,46 @@ var uiClosedAuthEvent = function uiClosedAuthEvent(display, definitionId, extens
289
391
 
290
392
  exports.uiClosedAuthEvent = uiClosedAuthEvent;
291
393
 
292
- var screenAuthPopupEvent = function screenAuthPopupEvent(definitionId, extensionKey) {
394
+ var screenAuthPopupEvent = function screenAuthPopupEvent(_ref12) {
395
+ var extensionKey = _ref12.extensionKey,
396
+ definitionId = _ref12.definitionId,
397
+ destinationProduct = _ref12.destinationProduct,
398
+ destinationSubproduct = _ref12.destinationSubproduct,
399
+ location = _ref12.location;
293
400
  return {
294
401
  actionSubject: 'consentModal',
295
402
  eventType: 'screen',
296
403
  attributes: _objectSpread(_objectSpread({}, context), {}, {
297
- definitionId: definitionId || '',
298
- extensionKey: extensionKey || ''
404
+ extensionKey: extensionKey,
405
+ definitionId: definitionId,
406
+ destinationProduct: destinationProduct,
407
+ destinationSubproduct: destinationSubproduct,
408
+ location: location
299
409
  })
300
410
  };
301
411
  };
302
412
 
303
413
  exports.screenAuthPopupEvent = screenAuthPopupEvent;
304
414
 
305
- var uiRenderSuccessEvent = function uiRenderSuccessEvent(display, status, definitionId, extensionKey) {
415
+ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref13) {
416
+ var display = _ref13.display,
417
+ status = _ref13.status,
418
+ extensionKey = _ref13.extensionKey,
419
+ definitionId = _ref13.definitionId,
420
+ destinationProduct = _ref13.destinationProduct,
421
+ destinationSubproduct = _ref13.destinationSubproduct,
422
+ location = _ref13.location;
306
423
  return {
307
424
  action: 'renderSuccess',
308
425
  actionSubject: 'smartLink',
309
426
  eventType: 'ui',
310
427
  attributes: _objectSpread(_objectSpread({}, context), {}, {
311
428
  status: status,
312
- definitionId: definitionId || '',
313
- extensionKey: extensionKey || '',
429
+ extensionKey: extensionKey,
430
+ definitionId: definitionId,
431
+ destinationProduct: destinationProduct,
432
+ destinationSubproduct: destinationSubproduct,
433
+ location: location,
314
434
  display: display
315
435
  })
316
436
  };
@@ -318,7 +438,15 @@ var uiRenderSuccessEvent = function uiRenderSuccessEvent(display, status, defini
318
438
 
319
439
  exports.uiRenderSuccessEvent = uiRenderSuccessEvent;
320
440
 
321
- var uiRenderFailedEvent = function uiRenderFailedEvent(display, error, errorInfo) {
441
+ var uiRenderFailedEvent = function uiRenderFailedEvent(_ref14) {
442
+ var display = _ref14.display,
443
+ error = _ref14.error,
444
+ errorInfo = _ref14.errorInfo,
445
+ extensionKey = _ref14.extensionKey,
446
+ definitionId = _ref14.definitionId,
447
+ destinationProduct = _ref14.destinationProduct,
448
+ destinationSubproduct = _ref14.destinationSubproduct,
449
+ location = _ref14.location;
322
450
  return {
323
451
  actionSubject: 'smartLink',
324
452
  action: 'renderFailed',
@@ -326,23 +454,39 @@ var uiRenderFailedEvent = function uiRenderFailedEvent(display, error, errorInfo
326
454
  attributes: {
327
455
  error: error,
328
456
  errorInfo: errorInfo,
329
- display: display
457
+ display: display,
458
+ extensionKey: extensionKey,
459
+ definitionId: definitionId,
460
+ destinationProduct: destinationProduct,
461
+ destinationSubproduct: destinationSubproduct,
462
+ location: location
330
463
  }
331
464
  };
332
465
  };
333
466
 
334
467
  exports.uiRenderFailedEvent = uiRenderFailedEvent;
335
468
 
336
- var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(id, previewDisplay, definitionId, extensionKey, previewInvokeMethod) {
469
+ var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref15) {
470
+ var id = _ref15.id,
471
+ previewDisplay = _ref15.previewDisplay,
472
+ extensionKey = _ref15.extensionKey,
473
+ definitionId = _ref15.definitionId,
474
+ destinationProduct = _ref15.destinationProduct,
475
+ destinationSubproduct = _ref15.destinationSubproduct,
476
+ location = _ref15.location,
477
+ previewInvokeMethod = _ref15.previewInvokeMethod;
337
478
  return {
338
479
  action: 'viewed',
339
480
  actionSubject: 'hoverCard',
340
481
  eventType: 'ui',
341
482
  attributes: _objectSpread(_objectSpread({}, context), {}, {
342
483
  id: id,
343
- definitionId: definitionId || '',
344
- extensionKey: extensionKey || '',
345
484
  previewDisplay: previewDisplay,
485
+ extensionKey: extensionKey,
486
+ definitionId: definitionId,
487
+ destinationProduct: destinationProduct,
488
+ destinationSubproduct: destinationSubproduct,
489
+ location: location,
346
490
  previewInvokeMethod: previewInvokeMethod
347
491
  })
348
492
  };
@@ -350,17 +494,29 @@ var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(id, previewDisplay,
350
494
 
351
495
  exports.uiHoverCardViewedEvent = uiHoverCardViewedEvent;
352
496
 
353
- var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(id, previewDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod) {
497
+ var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref16) {
498
+ var id = _ref16.id,
499
+ previewDisplay = _ref16.previewDisplay,
500
+ hoverTime = _ref16.hoverTime,
501
+ extensionKey = _ref16.extensionKey,
502
+ definitionId = _ref16.definitionId,
503
+ destinationProduct = _ref16.destinationProduct,
504
+ destinationSubproduct = _ref16.destinationSubproduct,
505
+ location = _ref16.location,
506
+ previewInvokeMethod = _ref16.previewInvokeMethod;
354
507
  return {
355
508
  action: 'dismissed',
356
509
  actionSubject: 'hoverCard',
357
510
  eventType: 'ui',
358
511
  attributes: _objectSpread(_objectSpread({}, context), {}, {
359
512
  id: id,
360
- definitionId: definitionId || '',
361
- extensionKey: extensionKey || '',
362
- hoverTime: hoverTime,
363
513
  previewDisplay: previewDisplay,
514
+ hoverTime: hoverTime,
515
+ extensionKey: extensionKey,
516
+ definitionId: definitionId,
517
+ destinationProduct: destinationProduct,
518
+ destinationSubproduct: destinationSubproduct,
519
+ location: location,
364
520
  previewInvokeMethod: previewInvokeMethod
365
521
  })
366
522
  };
@@ -368,7 +524,15 @@ var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(id, previewDi
368
524
 
369
525
  exports.uiHoverCardDismissedEvent = uiHoverCardDismissedEvent;
370
526
 
371
- var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(id, previewDisplay, definitionId, extensionKey, previewInvokeMethod) {
527
+ var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref17) {
528
+ var id = _ref17.id,
529
+ previewDisplay = _ref17.previewDisplay,
530
+ extensionKey = _ref17.extensionKey,
531
+ definitionId = _ref17.definitionId,
532
+ destinationProduct = _ref17.destinationProduct,
533
+ destinationSubproduct = _ref17.destinationSubproduct,
534
+ location = _ref17.location,
535
+ previewInvokeMethod = _ref17.previewInvokeMethod;
372
536
  return {
373
537
  action: 'clicked',
374
538
  actionSubject: 'button',
@@ -376,9 +540,12 @@ var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(i
376
540
  eventType: 'ui',
377
541
  attributes: _objectSpread(_objectSpread({}, context), {}, {
378
542
  id: id,
379
- definitionId: definitionId || '',
380
- extensionKey: extensionKey || '',
381
543
  previewDisplay: previewDisplay,
544
+ extensionKey: extensionKey,
545
+ definitionId: definitionId,
546
+ destinationProduct: destinationProduct,
547
+ destinationSubproduct: destinationSubproduct,
548
+ location: location,
382
549
  previewInvokeMethod: previewInvokeMethod
383
550
  })
384
551
  };
@@ -135,21 +135,38 @@ Object.defineProperty(exports, "unresolvedEvent", {
135
135
 
136
136
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
137
137
 
138
- var _analytics = require("./analytics");
139
-
140
138
  var _performance = require("../performance");
141
139
 
140
+ var _analytics = require("./analytics");
141
+
142
142
  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; }
143
143
 
144
144
  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) { (0, _defineProperty2.default)(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; }
145
145
 
146
- var instrumentEvent = function instrumentEvent(id, status, definitionId, extensionKey, resourceType, error) {
146
+ var instrumentEvent = function instrumentEvent(_ref) {
147
+ var id = _ref.id,
148
+ status = _ref.status,
149
+ extensionKey = _ref.extensionKey,
150
+ definitionId = _ref.definitionId,
151
+ resourceType = _ref.resourceType,
152
+ destinationProduct = _ref.destinationProduct,
153
+ destinationSubproduct = _ref.destinationSubproduct,
154
+ location = _ref.location,
155
+ error = _ref.error;
147
156
  var measure = (0, _performance.getMeasure)(id, status) || {
148
157
  duration: undefined
149
158
  };
150
159
 
151
160
  if (status === 'resolved') {
152
- var event = (0, _analytics.resolvedEvent)(id, definitionId, extensionKey, resourceType);
161
+ var event = (0, _analytics.resolvedEvent)({
162
+ id: id,
163
+ extensionKey: extensionKey,
164
+ definitionId: definitionId,
165
+ resourceType: resourceType,
166
+ destinationProduct: destinationProduct,
167
+ destinationSubproduct: destinationSubproduct,
168
+ location: location
169
+ });
153
170
  return _objectSpread(_objectSpread({}, event), {}, {
154
171
  attributes: _objectSpread(_objectSpread({}, event.attributes), {}, {
155
172
  duration: measure.duration
@@ -157,7 +174,17 @@ var instrumentEvent = function instrumentEvent(id, status, definitionId, extensi
157
174
  });
158
175
  } else {
159
176
  if ((error === null || error === void 0 ? void 0 : error.type) !== 'ResolveUnsupportedError') {
160
- var _event = (0, _analytics.unresolvedEvent)(id, status, definitionId, extensionKey, resourceType, error);
177
+ var _event = (0, _analytics.unresolvedEvent)({
178
+ id: id,
179
+ status: status,
180
+ extensionKey: extensionKey,
181
+ definitionId: definitionId,
182
+ resourceType: resourceType,
183
+ destinationProduct: destinationProduct,
184
+ destinationSubproduct: destinationSubproduct,
185
+ location: location,
186
+ error: error
187
+ });
161
188
 
162
189
  return _objectSpread(_objectSpread({}, _event), {}, {
163
190
  attributes: _objectSpread(_objectSpread({}, _event.attributes), {}, {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "21.3.0",
3
+ "version": "22.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -90,7 +90,16 @@ function CardWithUrlContent(_ref) {
90
90
  }, [state.details, url]);
91
91
  var handleClickWrapper = (0, _react.useCallback)(function (event) {
92
92
  var isModifierKeyPressed = (0, _utils.isSpecialEvent)(event);
93
- analytics.ui.cardClickedEvent(id, isFlexibleUi ? 'flexible' : appearance, state.status, definitionId, extensionKey, isModifierKeyPressed, undefined, product, subproduct);
93
+ analytics.ui.cardClickedEvent({
94
+ id: id,
95
+ display: isFlexibleUi ? 'flexible' : appearance,
96
+ status: state.status,
97
+ definitionId: definitionId,
98
+ extensionKey: extensionKey,
99
+ isModifierKeyPressed: isModifierKeyPressed,
100
+ destinationProduct: product,
101
+ destinationSubproduct: subproduct
102
+ });
94
103
 
95
104
  if (onClick) {
96
105
  onClick(event);
@@ -114,7 +123,14 @@ function CardWithUrlContent(_ref) {
114
123
 
115
124
  if (state.status !== 'pending') {
116
125
  measure.create(id, state.status);
117
- analytics.operational.instrument(id, state.status, definitionId, extensionKey, resourceType, state.error);
126
+ analytics.operational.instrument({
127
+ id: id,
128
+ status: state.status,
129
+ definitionId: definitionId,
130
+ extensionKey: extensionKey,
131
+ resourceType: resourceType,
132
+ error: state.error
133
+ });
118
134
  }
119
135
  }, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational]); // NB: once the smart-card has rendered into an end state, we capture
120
136
  // this as a successful render. These can be one of:
@@ -123,7 +139,13 @@ function CardWithUrlContent(_ref) {
123
139
 
124
140
  (0, _react.useEffect)(function () {
125
141
  if ((0, _helpers.isFinalState)(state.status)) {
126
- analytics.ui.renderSuccessEvent(appearance, state.status, id, definitionId, extensionKey);
142
+ analytics.ui.renderSuccessEvent({
143
+ display: appearance,
144
+ status: state.status,
145
+ id: id,
146
+ definitionId: definitionId,
147
+ extensionKey: extensionKey
148
+ });
127
149
  }
128
150
  }, [appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
129
151
 
@@ -96,7 +96,12 @@ function CardWithURLRenderer(props) {
96
96
  var errorInfo = {
97
97
  componentStack: componentStack
98
98
  };
99
- analytics.ui.renderFailedEvent(appearance, id, error, errorInfo);
99
+ analytics.ui.renderFailedEvent({
100
+ display: appearance,
101
+ id: id,
102
+ error: error,
103
+ errorInfo: errorInfo
104
+ });
100
105
  }
101
106
  }, [analytics.ui, appearance, id]);
102
107