@atlaskit/smart-card 23.7.3 → 23.8.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 (96) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/constants.js +14 -2
  3. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +3 -1
  4. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +41 -13
  5. package/dist/cjs/utils/analytics/analytics.js +128 -96
  6. package/dist/cjs/utils/analytics/index.js +12 -0
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +1 -1
  9. package/dist/cjs/view/BlockCard/index.js +4 -2
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
  11. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -3
  12. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +17 -4
  13. package/dist/cjs/view/CardWithUrl/component.js +3 -1
  14. package/dist/cjs/view/EmbedCard/index.js +6 -2
  15. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +21 -4
  16. package/dist/cjs/view/EmbedModal/components/analytics/index.js +4 -2
  17. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -10
  18. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +6 -4
  19. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +1 -1
  20. package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +26 -7
  21. package/dist/cjs/view/HoverCard/index.js +6 -3
  22. package/dist/cjs/view/HoverCard/utils.js +1 -4
  23. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +2 -1
  24. package/dist/cjs/view/InlineCard/index.js +2 -1
  25. package/dist/cjs/view/common/UnauthorisedViewContent.js +14 -3
  26. package/dist/es2019/constants.js +12 -1
  27. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -1
  28. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +33 -8
  29. package/dist/es2019/utils/analytics/analytics.js +28 -4
  30. package/dist/es2019/utils/analytics/index.js +1 -1
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +1 -1
  33. package/dist/es2019/view/BlockCard/index.js +4 -2
  34. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
  35. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -4
  36. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -3
  37. package/dist/es2019/view/CardWithUrl/component.js +2 -1
  38. package/dist/es2019/view/EmbedCard/index.js +6 -2
  39. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +14 -3
  40. package/dist/es2019/view/EmbedModal/components/analytics/index.js +3 -2
  41. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -10
  42. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +8 -6
  43. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -3
  44. package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +23 -7
  45. package/dist/es2019/view/HoverCard/index.js +6 -3
  46. package/dist/es2019/view/HoverCard/utils.js +0 -1
  47. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +2 -1
  48. package/dist/es2019/view/InlineCard/index.js +2 -1
  49. package/dist/es2019/view/common/UnauthorisedViewContent.js +18 -11
  50. package/dist/esm/constants.js +12 -1
  51. package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -1
  52. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +42 -14
  53. package/dist/esm/utils/analytics/analytics.js +118 -92
  54. package/dist/esm/utils/analytics/index.js +1 -1
  55. package/dist/esm/version.json +1 -1
  56. package/dist/esm/view/BlockCard/components/flexible/footer/index.js +1 -1
  57. package/dist/esm/view/BlockCard/index.js +4 -2
  58. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +1 -1
  59. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -4
  60. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +18 -5
  61. package/dist/esm/view/CardWithUrl/component.js +2 -1
  62. package/dist/esm/view/EmbedCard/index.js +6 -2
  63. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +15 -4
  64. package/dist/esm/view/EmbedModal/components/analytics/index.js +3 -2
  65. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -10
  66. package/dist/esm/view/HoverCard/components/HoverCardContent.js +8 -6
  67. package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -3
  68. package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +27 -9
  69. package/dist/esm/view/HoverCard/index.js +6 -3
  70. package/dist/esm/view/HoverCard/utils.js +0 -1
  71. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +2 -1
  72. package/dist/esm/view/InlineCard/index.js +2 -1
  73. package/dist/esm/view/common/UnauthorisedViewContent.js +8 -3
  74. package/dist/types/constants.d.ts +8 -0
  75. package/dist/types/state/actions/index.d.ts +1 -2
  76. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +17 -4
  77. package/dist/types/state/flexible-ui-context/index.d.ts +8 -4
  78. package/dist/types/state/hooks/useSmartLink.d.ts +5 -3
  79. package/dist/types/utils/analytics/analytics.d.ts +4 -2
  80. package/dist/types/utils/analytics/index.d.ts +1 -1
  81. package/dist/types/utils/analytics/types.d.ts +2 -0
  82. package/dist/types/utils/mocks.d.ts +4 -2
  83. package/dist/types/utils/types.d.ts +1 -1
  84. package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +1 -1
  85. package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
  86. package/dist/types/view/BlockCard/views/flexible/types.d.ts +17 -13
  87. package/dist/types/view/Card/types.d.ts +1 -1
  88. package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +3 -0
  89. package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +15 -4
  90. package/dist/types/view/HoverCard/types.d.ts +0 -2
  91. package/dist/types/view/HoverCard/utils.d.ts +0 -1
  92. package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +2 -0
  93. package/dist/types/view/common/UnauthorisedViewContent.d.ts +7 -1
  94. package/package.json +5 -5
  95. package/report.api.md +15 -1
  96. package/tmp/api-report-tmp.d.ts +8 -4
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
 
8
8
  import { useMemo } from 'react';
9
9
  import { getUrl } from '@atlaskit/linking-common';
10
- import { connectFailedEvent as _connectFailedEvent, connectSucceededEvent as _connectSucceededEvent, context, instrumentEvent, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, screenAuthPopupEvent, trackAppAccountConnected, uiActionClickedEvent, uiAuthAlternateAccountEvent, uiAuthEvent, uiCardClickedEvent, uiClosedAuthEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiHoverCardViewedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
10
+ import { connectFailedEvent as _connectFailedEvent, connectSucceededEvent as _connectSucceededEvent, context, instrumentEvent, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, screenAuthPopupEvent, trackAppAccountAuthStarted, trackAppAccountConnected, uiActionClickedEvent, uiAuthAlternateAccountEvent, uiAuthEvent, uiCardClickedEvent, uiClosedAuthEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiHoverCardViewedEvent, uiLearnMoreLinkClickedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
11
11
  import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
12
12
  import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
13
13
  import { useSmartLinkContext } from '@atlaskit/link-provider';
@@ -373,7 +373,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
373
373
  resourceType = _ref9.resourceType,
374
374
  destinationProduct = _ref9.destinationProduct,
375
375
  destinationSubproduct = _ref9.destinationSubproduct,
376
- location = _ref9.location;
376
+ location = _ref9.location,
377
+ status = _ref9.status;
377
378
  return dispatchAnalytics(applyCommonAttributes(uiHoverCardViewedEvent({
378
379
  id: id,
379
380
  previewDisplay: previewDisplay,
@@ -383,7 +384,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
383
384
  destinationProduct: destinationProduct,
384
385
  destinationSubproduct: destinationSubproduct,
385
386
  location: location,
386
- previewInvokeMethod: previewInvokeMethod
387
+ previewInvokeMethod: previewInvokeMethod,
388
+ status: status
387
389
  }), commonAttributes));
388
390
  },
389
391
 
@@ -392,7 +394,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
392
394
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
393
395
  * @param hoverTime The duration that the user hovered over a Smart Link before the preview was dismissed.
394
396
  * @param definitionId The definitionId of the Smart Link resolver invoked.
395
- * @param extensionKey The extensionKey of the Smart Link resovler invoked.
397
+ * @param extensionKey The extensionKey of the Smart Link resolver invoked.
396
398
  * @param previewInvokeMethod How the preview was triggered.
397
399
  * @returns
398
400
  */
@@ -406,7 +408,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
406
408
  resourceType = _ref10.resourceType,
407
409
  destinationProduct = _ref10.destinationProduct,
408
410
  destinationSubproduct = _ref10.destinationSubproduct,
409
- location = _ref10.location;
411
+ location = _ref10.location,
412
+ status = _ref10.status;
410
413
  return dispatchAnalytics(applyCommonAttributes(uiHoverCardDismissedEvent({
411
414
  previewDisplay: previewDisplay,
412
415
  id: id,
@@ -417,8 +420,18 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
417
420
  destinationProduct: destinationProduct,
418
421
  destinationSubproduct: destinationSubproduct,
419
422
  location: location,
420
- previewInvokeMethod: previewInvokeMethod
423
+ previewInvokeMethod: previewInvokeMethod,
424
+ status: status
421
425
  }), commonAttributes));
426
+ },
427
+
428
+ /**
429
+ * Fires an event that signifies that a "Learn More" link was clicked on an unauthenticated card
430
+ * @param extensionKey The extensionKey of the Smart Link resovler invoked.
431
+ * @param location The location where a link is displayed (jiraWebLinks, confluencePages etc)
432
+ */
433
+ learnMoreClickedEvent: function learnMoreClickedEvent() {
434
+ return dispatchAnalytics(applyCommonAttributes(uiLearnMoreLinkClickedEvent(), commonAttributes));
422
435
  }
423
436
  };
424
437
  }, [defaultId, commonAttributes, dispatchAnalytics]);
@@ -596,7 +609,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
596
609
  var track = useMemo(function () {
597
610
  return {
598
611
  /**
599
- * This fires an event which represents a user starting the Smart Link connect account process.
612
+ * This fires an event which represents a user connecting their account to view a Smart Link.
600
613
  * @param definitionId The definitionId of the Smart Link resolver invoked.
601
614
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
602
615
  * @returns
@@ -616,6 +629,21 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
616
629
  destinationSubproduct: destinationSubproduct,
617
630
  location: location
618
631
  })), commonAttributes));
632
+ },
633
+
634
+ /**
635
+ * This fires an event which represents a user starting the Smart Link connect account process.
636
+ * @param location a location where the Smart Link auth action was initiated.
637
+ * @param extensionKey The extensionKey of the Smart Link resolver invoked.
638
+ * @returns
639
+ */
640
+ appAccountAuthStarted: function appAccountAuthStarted(_ref17) {
641
+ var extensionKey = _ref17.extensionKey,
642
+ location = _ref17.location;
643
+ return dispatchAnalytics(applyCommonAttributes(trackAppAccountAuthStarted(_objectSpread(_objectSpread({}, commonAttributes), {}, {
644
+ extensionKey: extensionKey,
645
+ location: location
646
+ })), commonAttributes));
619
647
  }
620
648
  };
621
649
  }, [commonAttributes, dispatchAnalytics]);
@@ -629,13 +657,13 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
629
657
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
630
658
  * @returns
631
659
  */
632
- authPopupEvent: function authPopupEvent(_ref17) {
633
- var extensionKey = _ref17.extensionKey,
634
- definitionId = _ref17.definitionId,
635
- resourceType = _ref17.resourceType,
636
- destinationProduct = _ref17.destinationProduct,
637
- destinationSubproduct = _ref17.destinationSubproduct,
638
- location = _ref17.location;
660
+ authPopupEvent: function authPopupEvent(_ref18) {
661
+ var extensionKey = _ref18.extensionKey,
662
+ definitionId = _ref18.definitionId,
663
+ resourceType = _ref18.resourceType,
664
+ destinationProduct = _ref18.destinationProduct,
665
+ destinationSubproduct = _ref18.destinationSubproduct,
666
+ location = _ref18.location;
639
667
  return dispatchAnalytics(applyCommonAttributes(screenAuthPopupEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
640
668
  extensionKey: extensionKey,
641
669
  definitionId: definitionId,
@@ -215,29 +215,20 @@ export var trackAppAccountConnected = function trackAppAccountConnected(_ref6) {
215
215
  })
216
216
  };
217
217
  };
218
- export var uiAuthEvent = function uiAuthEvent(_ref7) {
219
- var definitionId = _ref7.definitionId,
220
- extensionKey = _ref7.extensionKey,
221
- destinationProduct = _ref7.destinationProduct,
222
- destinationSubproduct = _ref7.destinationSubproduct,
223
- location = _ref7.location,
224
- display = _ref7.display;
218
+ export var trackAppAccountAuthStarted = function trackAppAccountAuthStarted(_ref7) {
219
+ var extensionKey = _ref7.extensionKey,
220
+ location = _ref7.location;
225
221
  return {
226
- action: 'clicked',
227
- actionSubject: 'button',
228
- actionSubjectId: 'connectAccount',
229
- eventType: 'ui',
222
+ action: 'authStarted',
223
+ actionSubject: 'applicationAccount',
224
+ eventType: 'track',
230
225
  attributes: _objectSpread(_objectSpread({}, context), {}, {
231
- definitionId: definitionId,
232
226
  extensionKey: extensionKey,
233
- destinationProduct: destinationProduct,
234
- destinationSubproduct: destinationSubproduct,
235
- location: location,
236
- display: display
227
+ location: location
237
228
  })
238
229
  };
239
230
  };
240
- export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref8) {
231
+ export var uiAuthEvent = function uiAuthEvent(_ref8) {
241
232
  var definitionId = _ref8.definitionId,
242
233
  extensionKey = _ref8.extensionKey,
243
234
  destinationProduct = _ref8.destinationProduct,
@@ -246,8 +237,8 @@ export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_r
246
237
  display = _ref8.display;
247
238
  return {
248
239
  action: 'clicked',
249
- actionSubject: 'smartLink',
250
- actionSubjectId: 'tryAnotherAccount',
240
+ actionSubject: 'button',
241
+ actionSubjectId: 'connectAccount',
251
242
  eventType: 'ui',
252
243
  attributes: _objectSpread(_objectSpread({}, context), {}, {
253
244
  definitionId: definitionId,
@@ -259,209 +250,235 @@ export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_r
259
250
  })
260
251
  };
261
252
  };
262
- export var uiCardClickedEvent = function uiCardClickedEvent(_ref9) {
263
- var id = _ref9.id,
264
- display = _ref9.display,
265
- status = _ref9.status,
266
- definitionId = _ref9.definitionId,
253
+ export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref9) {
254
+ var definitionId = _ref9.definitionId,
267
255
  extensionKey = _ref9.extensionKey,
268
- isModifierKeyPressed = _ref9.isModifierKeyPressed,
269
- location = _ref9.location,
270
256
  destinationProduct = _ref9.destinationProduct,
271
257
  destinationSubproduct = _ref9.destinationSubproduct,
272
- actionSubjectId = _ref9.actionSubjectId;
258
+ location = _ref9.location,
259
+ display = _ref9.display;
273
260
  return {
274
261
  action: 'clicked',
275
262
  actionSubject: 'smartLink',
276
- actionSubjectId: actionSubjectId,
263
+ actionSubjectId: 'tryAnotherAccount',
277
264
  eventType: 'ui',
278
265
  attributes: _objectSpread(_objectSpread({}, context), {}, {
279
- id: id,
280
- status: status,
281
266
  definitionId: definitionId,
282
267
  extensionKey: extensionKey,
283
- display: display,
284
- isModifierKeyPressed: isModifierKeyPressed,
285
- location: location,
286
268
  destinationProduct: destinationProduct,
287
- destinationSubproduct: destinationSubproduct
269
+ destinationSubproduct: destinationSubproduct,
270
+ location: location,
271
+ display: display
288
272
  })
289
273
  };
290
274
  };
291
- export var uiActionClickedEvent = function uiActionClickedEvent(_ref10) {
275
+ export var uiCardClickedEvent = function uiCardClickedEvent(_ref10) {
292
276
  var id = _ref10.id,
293
- actionType = _ref10.actionType,
294
- extensionKey = _ref10.extensionKey,
295
277
  display = _ref10.display,
278
+ status = _ref10.status,
296
279
  definitionId = _ref10.definitionId,
280
+ extensionKey = _ref10.extensionKey,
281
+ isModifierKeyPressed = _ref10.isModifierKeyPressed,
282
+ location = _ref10.location,
297
283
  destinationProduct = _ref10.destinationProduct,
298
284
  destinationSubproduct = _ref10.destinationSubproduct,
299
- location = _ref10.location;
285
+ actionSubjectId = _ref10.actionSubjectId;
300
286
  return {
301
287
  action: 'clicked',
302
- actionSubject: 'button',
303
- actionSubjectId: uiActionSubjectIds[actionType],
288
+ actionSubject: 'smartLink',
289
+ actionSubjectId: actionSubjectId,
304
290
  eventType: 'ui',
305
291
  attributes: _objectSpread(_objectSpread({}, context), {}, {
306
292
  id: id,
307
- display: display,
308
- actionType: actionType,
309
- extensionKey: extensionKey,
293
+ status: status,
310
294
  definitionId: definitionId,
295
+ extensionKey: extensionKey,
296
+ display: display,
297
+ isModifierKeyPressed: isModifierKeyPressed,
298
+ location: location,
311
299
  destinationProduct: destinationProduct,
312
- destinationSubproduct: destinationSubproduct,
313
- location: location
300
+ destinationSubproduct: destinationSubproduct
314
301
  })
315
302
  };
316
303
  };
317
- export var uiClosedAuthEvent = function uiClosedAuthEvent(_ref11) {
318
- var display = _ref11.display,
304
+ export var uiActionClickedEvent = function uiActionClickedEvent(_ref11) {
305
+ var id = _ref11.id,
306
+ actionType = _ref11.actionType,
319
307
  extensionKey = _ref11.extensionKey,
308
+ display = _ref11.display,
320
309
  definitionId = _ref11.definitionId,
321
310
  destinationProduct = _ref11.destinationProduct,
322
311
  destinationSubproduct = _ref11.destinationSubproduct,
323
312
  location = _ref11.location;
324
313
  return {
325
- action: 'closed',
326
- actionSubject: 'consentModal',
314
+ action: 'clicked',
315
+ actionSubject: 'button',
316
+ actionSubjectId: uiActionSubjectIds[actionType],
327
317
  eventType: 'ui',
328
318
  attributes: _objectSpread(_objectSpread({}, context), {}, {
319
+ id: id,
320
+ display: display,
321
+ actionType: actionType,
329
322
  extensionKey: extensionKey,
330
323
  definitionId: definitionId,
331
324
  destinationProduct: destinationProduct,
332
325
  destinationSubproduct: destinationSubproduct,
333
- location: location,
334
- display: display
326
+ location: location
335
327
  })
336
328
  };
337
329
  };
338
- export var screenAuthPopupEvent = function screenAuthPopupEvent(_ref12) {
339
- var extensionKey = _ref12.extensionKey,
330
+ export var uiClosedAuthEvent = function uiClosedAuthEvent(_ref12) {
331
+ var display = _ref12.display,
332
+ extensionKey = _ref12.extensionKey,
340
333
  definitionId = _ref12.definitionId,
341
334
  destinationProduct = _ref12.destinationProduct,
342
335
  destinationSubproduct = _ref12.destinationSubproduct,
343
336
  location = _ref12.location;
344
337
  return {
338
+ action: 'closed',
345
339
  actionSubject: 'consentModal',
346
- eventType: 'screen',
340
+ eventType: 'ui',
347
341
  attributes: _objectSpread(_objectSpread({}, context), {}, {
348
342
  extensionKey: extensionKey,
349
343
  definitionId: definitionId,
350
344
  destinationProduct: destinationProduct,
351
345
  destinationSubproduct: destinationSubproduct,
352
- location: location
346
+ location: location,
347
+ display: display
353
348
  })
354
349
  };
355
350
  };
356
- export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref13) {
357
- var display = _ref13.display,
358
- status = _ref13.status,
359
- extensionKey = _ref13.extensionKey,
351
+ export var screenAuthPopupEvent = function screenAuthPopupEvent(_ref13) {
352
+ var extensionKey = _ref13.extensionKey,
360
353
  definitionId = _ref13.definitionId,
361
354
  destinationProduct = _ref13.destinationProduct,
362
355
  destinationSubproduct = _ref13.destinationSubproduct,
363
356
  location = _ref13.location;
364
357
  return {
365
- action: 'renderSuccess',
366
- actionSubject: 'smartLink',
367
- eventType: 'ui',
358
+ actionSubject: 'consentModal',
359
+ eventType: 'screen',
368
360
  attributes: _objectSpread(_objectSpread({}, context), {}, {
369
- status: status,
370
361
  extensionKey: extensionKey,
371
362
  definitionId: definitionId,
372
363
  destinationProduct: destinationProduct,
373
364
  destinationSubproduct: destinationSubproduct,
374
- location: location,
375
- display: display
365
+ location: location
376
366
  })
377
367
  };
378
368
  };
379
- export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref14) {
369
+ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref14) {
380
370
  var display = _ref14.display,
381
- error = _ref14.error,
382
- errorInfo = _ref14.errorInfo,
371
+ status = _ref14.status,
383
372
  extensionKey = _ref14.extensionKey,
384
373
  definitionId = _ref14.definitionId,
385
374
  destinationProduct = _ref14.destinationProduct,
386
375
  destinationSubproduct = _ref14.destinationSubproduct,
387
376
  location = _ref14.location;
388
377
  return {
378
+ action: 'renderSuccess',
389
379
  actionSubject: 'smartLink',
390
- action: 'renderFailed',
391
380
  eventType: 'ui',
392
381
  attributes: _objectSpread(_objectSpread({}, context), {}, {
393
- error: error,
394
- errorInfo: errorInfo,
395
- display: display,
382
+ status: status,
396
383
  extensionKey: extensionKey,
397
384
  definitionId: definitionId,
398
385
  destinationProduct: destinationProduct,
399
386
  destinationSubproduct: destinationSubproduct,
400
- location: location
387
+ location: location,
388
+ display: display
401
389
  })
402
390
  };
403
391
  };
404
- export var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref15) {
405
- var id = _ref15.id,
406
- previewDisplay = _ref15.previewDisplay,
392
+ export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref15) {
393
+ var display = _ref15.display,
394
+ error = _ref15.error,
395
+ errorInfo = _ref15.errorInfo,
407
396
  extensionKey = _ref15.extensionKey,
408
397
  definitionId = _ref15.definitionId,
409
398
  destinationProduct = _ref15.destinationProduct,
410
399
  destinationSubproduct = _ref15.destinationSubproduct,
411
- location = _ref15.location,
412
- previewInvokeMethod = _ref15.previewInvokeMethod;
400
+ location = _ref15.location;
413
401
  return {
414
- action: 'viewed',
415
- actionSubject: 'hoverCard',
402
+ actionSubject: 'smartLink',
403
+ action: 'renderFailed',
416
404
  eventType: 'ui',
417
405
  attributes: _objectSpread(_objectSpread({}, context), {}, {
418
- id: id,
419
- previewDisplay: previewDisplay,
406
+ error: error,
407
+ errorInfo: errorInfo,
408
+ display: display,
420
409
  extensionKey: extensionKey,
421
410
  definitionId: definitionId,
422
411
  destinationProduct: destinationProduct,
423
412
  destinationSubproduct: destinationSubproduct,
424
- location: location,
425
- previewInvokeMethod: previewInvokeMethod
413
+ location: location
426
414
  })
427
415
  };
428
416
  };
429
- export var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref16) {
417
+ export var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref16) {
430
418
  var id = _ref16.id,
431
419
  previewDisplay = _ref16.previewDisplay,
432
- hoverTime = _ref16.hoverTime,
433
420
  extensionKey = _ref16.extensionKey,
434
421
  definitionId = _ref16.definitionId,
435
422
  destinationProduct = _ref16.destinationProduct,
436
423
  destinationSubproduct = _ref16.destinationSubproduct,
437
424
  location = _ref16.location,
438
- previewInvokeMethod = _ref16.previewInvokeMethod;
425
+ previewInvokeMethod = _ref16.previewInvokeMethod,
426
+ status = _ref16.status;
439
427
  return {
440
- action: 'dismissed',
428
+ action: 'viewed',
441
429
  actionSubject: 'hoverCard',
442
430
  eventType: 'ui',
443
431
  attributes: _objectSpread(_objectSpread({}, context), {}, {
444
432
  id: id,
445
433
  previewDisplay: previewDisplay,
446
- hoverTime: hoverTime,
447
434
  extensionKey: extensionKey,
448
435
  definitionId: definitionId,
449
436
  destinationProduct: destinationProduct,
450
437
  destinationSubproduct: destinationSubproduct,
451
438
  location: location,
452
- previewInvokeMethod: previewInvokeMethod
439
+ previewInvokeMethod: previewInvokeMethod,
440
+ status: status
453
441
  })
454
442
  };
455
443
  };
456
- export var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref17) {
444
+ export var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref17) {
457
445
  var id = _ref17.id,
458
446
  previewDisplay = _ref17.previewDisplay,
447
+ hoverTime = _ref17.hoverTime,
459
448
  extensionKey = _ref17.extensionKey,
460
449
  definitionId = _ref17.definitionId,
461
450
  destinationProduct = _ref17.destinationProduct,
462
451
  destinationSubproduct = _ref17.destinationSubproduct,
463
452
  location = _ref17.location,
464
- previewInvokeMethod = _ref17.previewInvokeMethod;
453
+ previewInvokeMethod = _ref17.previewInvokeMethod,
454
+ status = _ref17.status;
455
+ return {
456
+ action: 'dismissed',
457
+ actionSubject: 'hoverCard',
458
+ eventType: 'ui',
459
+ attributes: _objectSpread(_objectSpread({}, context), {}, {
460
+ id: id,
461
+ previewDisplay: previewDisplay,
462
+ hoverTime: hoverTime,
463
+ extensionKey: extensionKey,
464
+ definitionId: definitionId,
465
+ destinationProduct: destinationProduct,
466
+ destinationSubproduct: destinationSubproduct,
467
+ location: location,
468
+ previewInvokeMethod: previewInvokeMethod,
469
+ status: status
470
+ })
471
+ };
472
+ };
473
+ export var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref18) {
474
+ var id = _ref18.id,
475
+ previewDisplay = _ref18.previewDisplay,
476
+ extensionKey = _ref18.extensionKey,
477
+ definitionId = _ref18.definitionId,
478
+ destinationProduct = _ref18.destinationProduct,
479
+ destinationSubproduct = _ref18.destinationSubproduct,
480
+ location = _ref18.location,
481
+ previewInvokeMethod = _ref18.previewInvokeMethod;
465
482
  return {
466
483
  action: 'clicked',
467
484
  actionSubject: 'button',
@@ -478,4 +495,13 @@ export var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClicked
478
495
  previewInvokeMethod: previewInvokeMethod
479
496
  })
480
497
  };
498
+ };
499
+ export var uiLearnMoreLinkClickedEvent = function uiLearnMoreLinkClickedEvent() {
500
+ return {
501
+ action: 'clicked',
502
+ actionSubject: 'button',
503
+ actionSubjectId: 'learnMore',
504
+ eventType: 'ui',
505
+ attributes: _objectSpread({}, context)
506
+ };
481
507
  };
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { getMeasure } from '../performance';
8
8
  import { resolvedEvent, unresolvedEvent } from './analytics';
9
- export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent } from './analytics';
9
+ export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountAuthStarted, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent } from './analytics';
10
10
  export var instrumentEvent = function instrumentEvent(_ref) {
11
11
  var id = _ref.id,
12
12
  status = _ref.status,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.7.3",
3
+ "version": "23.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ var getActionGroupStyles = function getActionGroupStyles(size) {
20
20
 
21
21
  var providerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n span:first-child {\n margin-right: 0.375rem;\n }\n"])));
22
22
  /**
23
- * This Components is a footer that is used in a Block Card with Flexible UI.
23
+ * This Component is a footer that is used in a Block Card with Flexible UI.
24
24
  * It contains a provider icon if provider is present and an actions list if one is passed.
25
25
  * To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
26
26
  *
@@ -51,11 +51,12 @@ export var BlockCard = function BlockCard(_ref) {
51
51
  details = cardState.details;
52
52
  var data = details && details.data || getEmptyJsonLd();
53
53
  var meta = details && details.meta;
54
+ var extensionKey = getExtensionKey(details);
54
55
  var extractorOpts = {
55
56
  analytics: analytics,
56
57
  origin: 'smartLinkCard',
57
58
  handleInvoke: handleInvoke,
58
- extensionKey: getExtensionKey(details)
59
+ extensionKey: extensionKey
59
60
  };
60
61
 
61
62
  if (enableFlexibleBlockCard) {
@@ -70,7 +71,8 @@ export var BlockCard = function BlockCard(_ref) {
70
71
  onError: onError,
71
72
  renderers: renderers,
72
73
  ui: ui,
73
- analytics: analytics
74
+ analytics: analytics,
75
+ extensionKey: extensionKey
74
76
  };
75
77
 
76
78
  switch (status) {
@@ -45,7 +45,7 @@ var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
45
45
  message: {
46
46
  descriptor: messages.not_found_description
47
47
  },
48
- testId: testId
48
+ testId: "".concat(testId, "-message")
49
49
  })), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
50
50
  status: status
51
51
  })));
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
3
3
  import FlexibleCard from '../../../FlexibleCard';
4
4
  import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
5
5
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
6
- import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
6
+ import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
7
7
  import uuid from 'uuid';
8
8
  /**
9
9
  * This view represents a Block card that has an 'Resolved' status.
@@ -91,7 +91,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
91
91
  analytics.operational.invokeSucceededEvent({
92
92
  id: analyticsId,
93
93
  actionType: 'preview',
94
- display: 'block'
94
+ display: CardDisplay.Block
95
95
  });
96
96
  }
97
97
  }, {
@@ -101,7 +101,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
101
101
  analytics.operational.invokeSucceededEvent({
102
102
  id: analyticsId,
103
103
  actionType: 'view',
104
- display: 'block'
104
+ display: CardDisplay.Block
105
105
  });
106
106
  }
107
107
  }, {
@@ -111,7 +111,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
111
111
  analytics.operational.invokeSucceededEvent({
112
112
  id: analyticsId,
113
113
  actionType: 'download',
114
- display: 'block'
114
+ display: CardDisplay.Block
115
115
  });
116
116
  }
117
117
  }]
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject;
4
4
 
5
- import React, { useMemo } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
6
6
  import FlexibleCard from '../../../FlexibleCard';
7
7
  import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
8
8
  import BlockCardFooter from '../../components/flexible/footer';
@@ -24,7 +24,10 @@ var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLit
24
24
  var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
25
25
  var _cardState$details, _extractProvider;
26
26
 
27
- var cardState = _ref.cardState,
27
+ var analytics = _ref.analytics,
28
+ cardState = _ref.cardState,
29
+ _ref$extensionKey = _ref.extensionKey,
30
+ extensionKey = _ref$extensionKey === void 0 ? '' : _ref$extensionKey,
28
31
  onAuthorize = _ref.onAuthorize,
29
32
  onClick = _ref.onClick,
30
33
  onError = _ref.onError,
@@ -34,9 +37,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
34
37
  url = _ref.url;
35
38
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
36
39
  var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
40
+ var handleAuthorize = useCallback(function () {
41
+ if (onAuthorize) {
42
+ analytics.track.appAccountAuthStarted({
43
+ extensionKey: extensionKey
44
+ });
45
+ onAuthorize();
46
+ }
47
+ }, [onAuthorize, extensionKey, analytics.track]);
37
48
  var actions = useMemo(function () {
38
- return onAuthorize ? [AuthorizeAction(onAuthorize, providerName)] : [];
39
- }, [onAuthorize, providerName]);
49
+ return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
50
+ }, [handleAuthorize, onAuthorize, providerName]);
40
51
  return /*#__PURE__*/React.createElement(FlexibleCard, {
41
52
  appearance: "block",
42
53
  cardState: cardState,
@@ -52,7 +63,9 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
52
63
  overrideCss: contentStyles,
53
64
  testId: "".concat(testId, "-content")
54
65
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
55
- providerName: providerName
66
+ providerName: providerName,
67
+ analytics: analytics,
68
+ testId: testId
56
69
  }))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
57
70
  actions: actions,
58
71
  status: SmartLinkStatus.Unauthorized,
@@ -10,6 +10,7 @@ import { EmbedCard } from '../EmbedCard';
10
10
  import { isFlexibleUiCard } from '../../utils/flexible';
11
11
  import FlexibleCard from '../FlexibleCard';
12
12
  import { APIError } from '../..';
13
+ import { CardDisplay } from '../../constants';
13
14
  export function CardWithUrlContent(_ref) {
14
15
  var id = _ref.id,
15
16
  url = _ref.url,
@@ -68,7 +69,7 @@ export function CardWithUrlContent(_ref) {
68
69
  var isModifierKeyPressed = isSpecialEvent(event);
69
70
  analytics.ui.cardClickedEvent({
70
71
  id: id,
71
- display: isFlexibleUi ? 'flexible' : appearance,
72
+ display: isFlexibleUi ? CardDisplay.Flexible : appearance,
72
73
  status: state.status,
73
74
  definitionId: definitionId,
74
75
  extensionKey: extensionKey,