@atlaskit/smart-card 32.7.7 → 32.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/analytics.spec.yaml +31 -5
  3. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +7 -6
  4. package/dist/cjs/state/actions/index.js +13 -38
  5. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +59 -306
  6. package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +2 -7
  7. package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +99 -6
  8. package/dist/cjs/utils/analytics/analytics.js +27 -301
  9. package/dist/cjs/utils/analytics/index.js +0 -66
  10. package/dist/cjs/view/CardWithUrl/component.js +7 -23
  11. package/dist/cjs/view/CardWithUrl/loader.js +14 -5
  12. package/dist/cjs/view/EmbedModal/components/analytics/index.js +88 -32
  13. package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
  14. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
  15. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
  16. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -2
  17. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +21 -53
  18. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +0 -1
  19. package/dist/cjs/view/HoverCard/index.js +15 -8
  20. package/dist/cjs/view/LinkUrl/index.js +1 -1
  21. package/dist/cjs/view/common/UnauthorisedViewContent.js +3 -9
  22. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +8 -7
  23. package/dist/es2019/state/actions/index.js +13 -38
  24. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -239
  25. package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +0 -3
  26. package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +97 -2
  27. package/dist/es2019/utils/analytics/analytics.js +2 -286
  28. package/dist/es2019/utils/analytics/index.js +1 -1
  29. package/dist/es2019/view/CardWithUrl/component.js +8 -24
  30. package/dist/es2019/view/CardWithUrl/loader.js +9 -1
  31. package/dist/es2019/view/EmbedModal/components/analytics/index.js +88 -32
  32. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
  33. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
  34. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
  35. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
  36. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +21 -53
  37. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +0 -1
  38. package/dist/es2019/view/HoverCard/index.js +10 -2
  39. package/dist/es2019/view/LinkUrl/index.js +1 -1
  40. package/dist/es2019/view/common/UnauthorisedViewContent.js +3 -9
  41. package/dist/esm/extractors/action/extract-invoke-preview-action.js +8 -7
  42. package/dist/esm/state/actions/index.js +13 -38
  43. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +60 -307
  44. package/dist/esm/utils/analytics/LinkAnalyticsContext.js +2 -7
  45. package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +95 -5
  46. package/dist/esm/utils/analytics/analytics.js +26 -300
  47. package/dist/esm/utils/analytics/index.js +1 -1
  48. package/dist/esm/view/CardWithUrl/component.js +8 -24
  49. package/dist/esm/view/CardWithUrl/loader.js +14 -5
  50. package/dist/esm/view/EmbedModal/components/analytics/index.js +88 -32
  51. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -13
  52. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +4 -16
  53. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -5
  54. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
  55. package/dist/esm/view/HoverCard/components/HoverCardContent.js +21 -53
  56. package/dist/esm/view/HoverCard/components/views/resolved/index.js +0 -1
  57. package/dist/esm/view/HoverCard/index.js +14 -4
  58. package/dist/esm/view/LinkUrl/index.js +1 -1
  59. package/dist/esm/view/common/UnauthorisedViewContent.js +3 -9
  60. package/dist/types/common/analytics/generated/analytics.types.d.ts +16 -2
  61. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +6 -102
  62. package/dist/types/state/hooks/useSmartLink.d.ts +0 -12
  63. package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +14 -0
  64. package/dist/types/utils/analytics/analytics.d.ts +1 -51
  65. package/dist/types/utils/analytics/index.d.ts +1 -1
  66. package/dist/types/utils/analytics/types.d.ts +0 -60
  67. package/dist/types/utils/mocks.d.ts +0 -12
  68. package/dist/types/view/EmbedModal/components/analytics/types.d.ts +1 -0
  69. package/dist/types/view/HoverCard/components/HoverCardComponent.d.ts +1 -0
  70. package/dist/types/view/common/UnauthorisedViewContent.d.ts +1 -1
  71. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +16 -2
  72. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +6 -102
  73. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -12
  74. package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +14 -0
  75. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -51
  76. package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
  77. package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -60
  78. package/dist/types-ts4.5/utils/mocks.d.ts +0 -12
  79. package/dist/types-ts4.5/view/EmbedModal/components/analytics/types.d.ts +1 -0
  80. package/dist/types-ts4.5/view/HoverCard/components/HoverCardComponent.d.ts +1 -0
  81. package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +1 -1
  82. package/package.json +2 -5
@@ -1,15 +1,14 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { SmartLinkActionType } from '@atlaskit/linking-types';
7
6
  import { getMeasure } from '../performance';
8
7
  export var ANALYTICS_CHANNEL = 'media';
9
8
  export var context = {
10
9
  componentName: 'smart-cards',
11
10
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "32.7.7"
11
+ packageVersion: "32.7.9"
13
12
  };
14
13
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
15
14
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -21,8 +20,6 @@ export var TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActi
21
20
  TrackQuickActionFailureReason["UnknownError"] = "UnknownError";
22
21
  return TrackQuickActionFailureReason;
23
22
  }({});
24
- export var SmartLinkActionTypeTrackingEventMapper = _defineProperty(_defineProperty(_defineProperty({}, SmartLinkActionType.FollowEntityAction, 'Follow'), SmartLinkActionType.StatusUpdateAction, 'StatusUpdate'), SmartLinkActionType.UnfollowEntityAction, 'Unfollow');
25
- export var SmartLinkActionTypeUiEventMapper = _defineProperty(_defineProperty({}, SmartLinkActionType.FollowEntityAction, 'smartLinkFollowButton'), SmartLinkActionType.UnfollowEntityAction, 'smartLinkFollowButton');
26
23
  var uiActionSubjectIds = {
27
24
  DownloadAction: 'downloadDocument',
28
25
  PreviewAction: 'invokePreviewScreen',
@@ -111,100 +108,15 @@ export var invokeFailedEvent = function invokeFailedEvent(_ref2) {
111
108
  })
112
109
  };
113
110
  };
114
-
115
- /**
116
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
117
- */
118
- export var uiAuthEvent = function uiAuthEvent(_ref3) {
119
- var definitionId = _ref3.definitionId,
111
+ export var uiActionClickedEvent = function uiActionClickedEvent(_ref3) {
112
+ var id = _ref3.id,
113
+ actionType = _ref3.actionType,
120
114
  extensionKey = _ref3.extensionKey,
115
+ display = _ref3.display,
116
+ definitionId = _ref3.definitionId,
121
117
  destinationProduct = _ref3.destinationProduct,
122
118
  destinationSubproduct = _ref3.destinationSubproduct,
123
- location = _ref3.location,
124
- display = _ref3.display;
125
- return {
126
- action: 'clicked',
127
- actionSubject: 'button',
128
- actionSubjectId: 'connectAccount',
129
- eventType: 'ui',
130
- attributes: _objectSpread(_objectSpread({}, context), {}, {
131
- definitionId: definitionId,
132
- extensionKey: extensionKey,
133
- destinationProduct: destinationProduct,
134
- destinationSubproduct: destinationSubproduct,
135
- location: location,
136
- display: display
137
- })
138
- };
139
- };
140
-
141
- /**
142
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
143
- */
144
- export var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref4) {
145
- var definitionId = _ref4.definitionId,
146
- extensionKey = _ref4.extensionKey,
147
- destinationProduct = _ref4.destinationProduct,
148
- destinationSubproduct = _ref4.destinationSubproduct,
149
- location = _ref4.location,
150
- display = _ref4.display;
151
- return {
152
- action: 'clicked',
153
- actionSubject: 'smartLink',
154
- actionSubjectId: 'tryAnotherAccount',
155
- eventType: 'ui',
156
- attributes: _objectSpread(_objectSpread({}, context), {}, {
157
- definitionId: definitionId,
158
- extensionKey: extensionKey,
159
- destinationProduct: destinationProduct,
160
- destinationSubproduct: destinationSubproduct,
161
- location: location,
162
- display: display
163
- })
164
- };
165
- };
166
-
167
- /**
168
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
169
- */
170
- export var uiCardClickedEvent = function uiCardClickedEvent(_ref5) {
171
- var id = _ref5.id,
172
- display = _ref5.display,
173
- status = _ref5.status,
174
- definitionId = _ref5.definitionId,
175
- extensionKey = _ref5.extensionKey,
176
- isModifierKeyPressed = _ref5.isModifierKeyPressed,
177
- location = _ref5.location,
178
- destinationProduct = _ref5.destinationProduct,
179
- destinationSubproduct = _ref5.destinationSubproduct,
180
- actionSubjectId = _ref5.actionSubjectId;
181
- return {
182
- action: 'clicked',
183
- actionSubject: 'smartLink',
184
- actionSubjectId: actionSubjectId,
185
- eventType: 'ui',
186
- attributes: _objectSpread(_objectSpread({}, context), {}, {
187
- id: id,
188
- status: status,
189
- definitionId: definitionId,
190
- extensionKey: extensionKey,
191
- display: display,
192
- isModifierKeyPressed: isModifierKeyPressed,
193
- location: location,
194
- destinationProduct: destinationProduct,
195
- destinationSubproduct: destinationSubproduct
196
- })
197
- };
198
- };
199
- export var uiActionClickedEvent = function uiActionClickedEvent(_ref6) {
200
- var id = _ref6.id,
201
- actionType = _ref6.actionType,
202
- extensionKey = _ref6.extensionKey,
203
- display = _ref6.display,
204
- definitionId = _ref6.definitionId,
205
- destinationProduct = _ref6.destinationProduct,
206
- destinationSubproduct = _ref6.destinationSubproduct,
207
- location = _ref6.location;
119
+ location = _ref3.location;
208
120
  return {
209
121
  action: 'clicked',
210
122
  actionSubject: 'button',
@@ -222,40 +134,15 @@ export var uiActionClickedEvent = function uiActionClickedEvent(_ref6) {
222
134
  })
223
135
  };
224
136
  };
225
-
226
- /**
227
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
228
- */
229
- export var uiClosedAuthEvent = function uiClosedAuthEvent(_ref7) {
230
- var display = _ref7.display,
231
- extensionKey = _ref7.extensionKey,
232
- definitionId = _ref7.definitionId,
233
- destinationProduct = _ref7.destinationProduct,
234
- destinationSubproduct = _ref7.destinationSubproduct,
235
- location = _ref7.location;
236
- return {
237
- action: 'closed',
238
- actionSubject: 'consentModal',
239
- eventType: 'ui',
240
- attributes: _objectSpread(_objectSpread({}, context), {}, {
241
- extensionKey: extensionKey,
242
- definitionId: definitionId,
243
- destinationProduct: destinationProduct,
244
- destinationSubproduct: destinationSubproduct,
245
- location: location,
246
- display: display
247
- })
248
- };
249
- };
250
- export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref8) {
251
- var display = _ref8.display,
252
- status = _ref8.status,
253
- extensionKey = _ref8.extensionKey,
254
- definitionId = _ref8.definitionId,
255
- destinationProduct = _ref8.destinationProduct,
256
- destinationSubproduct = _ref8.destinationSubproduct,
257
- location = _ref8.location,
258
- canBeDatasource = _ref8.canBeDatasource;
137
+ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref4) {
138
+ var display = _ref4.display,
139
+ status = _ref4.status,
140
+ extensionKey = _ref4.extensionKey,
141
+ definitionId = _ref4.definitionId,
142
+ destinationProduct = _ref4.destinationProduct,
143
+ destinationSubproduct = _ref4.destinationSubproduct,
144
+ location = _ref4.location,
145
+ canBeDatasource = _ref4.canBeDatasource;
259
146
  return {
260
147
  action: 'renderSuccess',
261
148
  actionSubject: 'smartLink',
@@ -272,15 +159,15 @@ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref8) {
272
159
  })
273
160
  };
274
161
  };
275
- export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref9) {
276
- var display = _ref9.display,
277
- error = _ref9.error,
278
- errorInfo = _ref9.errorInfo,
279
- extensionKey = _ref9.extensionKey,
280
- definitionId = _ref9.definitionId,
281
- destinationProduct = _ref9.destinationProduct,
282
- destinationSubproduct = _ref9.destinationSubproduct,
283
- location = _ref9.location;
162
+ export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref5) {
163
+ var display = _ref5.display,
164
+ error = _ref5.error,
165
+ errorInfo = _ref5.errorInfo,
166
+ extensionKey = _ref5.extensionKey,
167
+ definitionId = _ref5.definitionId,
168
+ destinationProduct = _ref5.destinationProduct,
169
+ destinationSubproduct = _ref5.destinationSubproduct,
170
+ location = _ref5.location;
284
171
  return {
285
172
  actionSubject: 'smartLink',
286
173
  action: 'renderFailed',
@@ -296,165 +183,4 @@ export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref9) {
296
183
  location: location
297
184
  })
298
185
  };
299
- };
300
-
301
- /**
302
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
303
- */
304
- export var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref10) {
305
- var id = _ref10.id,
306
- previewDisplay = _ref10.previewDisplay,
307
- extensionKey = _ref10.extensionKey,
308
- definitionId = _ref10.definitionId,
309
- destinationProduct = _ref10.destinationProduct,
310
- destinationSubproduct = _ref10.destinationSubproduct,
311
- location = _ref10.location,
312
- previewInvokeMethod = _ref10.previewInvokeMethod,
313
- status = _ref10.status;
314
- return {
315
- action: 'viewed',
316
- actionSubject: 'hoverCard',
317
- eventType: 'ui',
318
- attributes: _objectSpread(_objectSpread({}, context), {}, {
319
- id: id,
320
- previewDisplay: previewDisplay,
321
- extensionKey: extensionKey,
322
- definitionId: definitionId,
323
- destinationProduct: destinationProduct,
324
- destinationSubproduct: destinationSubproduct,
325
- location: location,
326
- previewInvokeMethod: previewInvokeMethod,
327
- status: status
328
- })
329
- };
330
- };
331
-
332
- /**
333
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
334
- */
335
- export var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref11) {
336
- var id = _ref11.id,
337
- previewDisplay = _ref11.previewDisplay,
338
- hoverTime = _ref11.hoverTime,
339
- extensionKey = _ref11.extensionKey,
340
- definitionId = _ref11.definitionId,
341
- destinationProduct = _ref11.destinationProduct,
342
- destinationSubproduct = _ref11.destinationSubproduct,
343
- location = _ref11.location,
344
- previewInvokeMethod = _ref11.previewInvokeMethod,
345
- status = _ref11.status;
346
- return {
347
- action: 'dismissed',
348
- actionSubject: 'hoverCard',
349
- eventType: 'ui',
350
- attributes: _objectSpread(_objectSpread({}, context), {}, {
351
- id: id,
352
- previewDisplay: previewDisplay,
353
- hoverTime: hoverTime,
354
- extensionKey: extensionKey,
355
- definitionId: definitionId,
356
- destinationProduct: destinationProduct,
357
- destinationSubproduct: destinationSubproduct,
358
- location: location,
359
- previewInvokeMethod: previewInvokeMethod,
360
- status: status
361
- })
362
- };
363
- };
364
-
365
- /**
366
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
367
- */
368
- export var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref12) {
369
- var id = _ref12.id,
370
- previewDisplay = _ref12.previewDisplay,
371
- extensionKey = _ref12.extensionKey,
372
- definitionId = _ref12.definitionId,
373
- destinationProduct = _ref12.destinationProduct,
374
- destinationSubproduct = _ref12.destinationSubproduct,
375
- location = _ref12.location,
376
- previewInvokeMethod = _ref12.previewInvokeMethod;
377
- return {
378
- action: 'clicked',
379
- actionSubject: 'button',
380
- actionSubjectId: 'shortcutGoToLink',
381
- eventType: 'ui',
382
- attributes: _objectSpread(_objectSpread({}, context), {}, {
383
- id: id,
384
- previewDisplay: previewDisplay,
385
- extensionKey: extensionKey,
386
- definitionId: definitionId,
387
- destinationProduct: destinationProduct,
388
- destinationSubproduct: destinationSubproduct,
389
- location: location,
390
- previewInvokeMethod: previewInvokeMethod
391
- })
392
- };
393
- };
394
-
395
- /**
396
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
397
- */
398
- export var uiLearnMoreLinkClickedEvent = function uiLearnMoreLinkClickedEvent() {
399
- return {
400
- action: 'clicked',
401
- actionSubject: 'button',
402
- actionSubjectId: 'learnMore',
403
- eventType: 'ui',
404
- attributes: _objectSpread({}, context)
405
- };
406
- };
407
-
408
- /**
409
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
410
- */
411
- export var uiSmartLinkStatusLozengeButtonClicked = function uiSmartLinkStatusLozengeButtonClicked() {
412
- return {
413
- action: 'clicked',
414
- actionSubject: 'button',
415
- actionSubjectId: 'smartLinkStatusLozenge',
416
- eventType: 'ui',
417
- attributes: _objectSpread({}, context)
418
- };
419
- };
420
-
421
- /**
422
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
423
- */
424
- export var uiSmartLinkStatusListItemButtonClicked = function uiSmartLinkStatusListItemButtonClicked() {
425
- return {
426
- action: 'clicked',
427
- actionSubject: 'button',
428
- actionSubjectId: 'smartLinkStatusListItem',
429
- eventType: 'ui',
430
- attributes: _objectSpread({}, context)
431
- };
432
- };
433
-
434
- /**
435
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
436
- */
437
- export var uiSmartLinkStatusOpenPreviewButtonClicked = function uiSmartLinkStatusOpenPreviewButtonClicked() {
438
- return {
439
- action: 'clicked',
440
- actionSubject: 'button',
441
- actionSubjectId: 'smartLinkStatusOpenPreview',
442
- eventType: 'ui',
443
- attributes: _objectSpread({}, context)
444
- };
445
- };
446
-
447
- /**
448
- * @deprecated consider removing when cleaning up FF platform_migrate-some-ui-events-smart-card
449
- */
450
- export var uiServerActionClicked = function uiServerActionClicked(_ref13) {
451
- var _SmartLinkActionTypeU2;
452
- var smartLinkActionType = _ref13.smartLinkActionType;
453
- return {
454
- action: 'clicked',
455
- actionSubject: 'button',
456
- actionSubjectId: (_SmartLinkActionTypeU2 = SmartLinkActionTypeUiEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeU2 !== void 0 ? _SmartLinkActionTypeU2 : smartLinkActionType,
457
- eventType: 'ui',
458
- attributes: _objectSpread({}, context)
459
- };
460
186
  };
@@ -1 +1 @@
1
- export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, invokeSucceededEvent, invokeFailedEvent, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from './analytics';
1
+ export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, invokeSucceededEvent, invokeFailedEvent, uiActionClickedEvent, uiRenderSuccessEvent, uiRenderFailedEvent } from './analytics';
@@ -5,7 +5,7 @@ import { useAnalyticsEvents } from '../../common/analytics/generated/use-analyti
5
5
  import { CardDisplay } from '../../constants';
6
6
  import { useSmartLink } from '../../state';
7
7
  import { succeedUfoExperience } from '../../state/analytics';
8
- import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getProduct, getResourceType, getServices, getSubproduct, isFinalState } from '../../state/helpers';
8
+ import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getResourceType, getServices, isFinalState } from '../../state/helpers';
9
9
  import { SmartLinkModalProvider } from '../../state/modal';
10
10
  import { isSpecialEvent } from '../../utils';
11
11
  import { combineActionOptions } from '../../utils/actions/combine-action-options';
@@ -60,8 +60,6 @@ function Component(_ref) {
60
60
  var definitionId = getDefinitionId(state.details);
61
61
  var extensionKey = getExtensionKey(state.details);
62
62
  var resourceType = getResourceType(state.details);
63
- var product = getProduct(state.details);
64
- var subproduct = getSubproduct(state.details);
65
63
  var services = getServices(state.details);
66
64
  var canBeDatasource = getCanBeDatasource(state.details);
67
65
  var isFlexibleUi = useMemo(function () {
@@ -75,25 +73,12 @@ function Component(_ref) {
75
73
  // Setup UI handlers.
76
74
  var handleClickWrapper = useCallback(function (event) {
77
75
  var isModifierKeyPressed = isSpecialEvent(event);
78
- if (fg('platform_migrate-some-ui-events-smart-card')) {
79
- fireEvent('ui.smartLink.clicked', {
80
- id: id,
81
- display: isFlexibleUi ? CardDisplay.Flexible : appearance,
82
- definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
83
- isModifierKeyPressed: isModifierKeyPressed
84
- });
85
- } else {
86
- analytics.ui.cardClickedEvent({
87
- id: id,
88
- display: isFlexibleUi ? CardDisplay.Flexible : appearance,
89
- status: state.status,
90
- definitionId: definitionId,
91
- extensionKey: extensionKey,
92
- isModifierKeyPressed: isModifierKeyPressed,
93
- destinationProduct: product,
94
- destinationSubproduct: subproduct
95
- });
96
- }
76
+ fireEvent('ui.smartLink.clicked', {
77
+ id: id,
78
+ display: isFlexibleUi ? CardDisplay.Flexible : appearance,
79
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
80
+ isModifierKeyPressed: isModifierKeyPressed
81
+ });
97
82
  if (!onClick && !isFlexibleUi) {
98
83
  var clickUrl = getClickUrl(url, state.details);
99
84
  // Ctrl+left click on mac typically doesn't trigger onClick
@@ -113,7 +98,7 @@ function Component(_ref) {
113
98
  }
114
99
  fireLinkClickedEvent(createAnalyticsEvent)(event);
115
100
  }
116
- }, [id, url, state.details, state.status, analytics.ui, appearance, definitionId, extensionKey, onClick, isFlexibleUi, product, subproduct, createAnalyticsEvent, fireEvent]);
101
+ }, [id, url, state.details, appearance, definitionId, onClick, isFlexibleUi, createAnalyticsEvent, fireEvent]);
117
102
  var handleAuthorize = useCallback(function () {
118
103
  return actions.authorize(appearance);
119
104
  }, [actions, appearance]);
@@ -168,7 +153,6 @@ function Component(_ref) {
168
153
  display: isFlexibleUi ? 'flexible' : appearance
169
154
  });
170
155
  fireEvent('ui.smartLink.renderSuccess', {
171
- definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
172
156
  display: isFlexibleUi ? 'flexible' : appearance
173
157
  });
174
158
  } else {
@@ -1,4 +1,7 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
5
  import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
3
6
  import { ErrorBoundary } from 'react-error-boundary';
4
7
  import { di } from 'react-magnetic-di';
@@ -8,6 +11,7 @@ import { useAnalyticsEvents } from '../../common/analytics/generated/use-analyti
8
11
  import { useSmartLinkAnalytics } from '../../state';
9
12
  import { failUfoExperience, startUfoExperience } from '../../state/analytics';
10
13
  import { importWithRetry } from '../../utils';
14
+ import { useSmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
11
15
  import { isFlexibleUiCard } from '../../utils/flexible';
12
16
  import { clearMarks, clearMeasures } from '../../utils/performance';
13
17
  import { LoadingCardLink } from './component-lazy/LoadingCardLink';
@@ -59,6 +63,11 @@ export function CardWithURLRenderer(props) {
59
63
  truncateInline = props.truncateInline;
60
64
  var analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', id);
61
65
  var isFlexibleUi = isFlexibleUiCard(children);
66
+ var analyticsContext = useSmartLinkAnalyticsContext({
67
+ display: isFlexibleUi ? 'flexible' : appearance,
68
+ id: id,
69
+ url: url !== null && url !== void 0 ? url : ''
70
+ });
62
71
  var errorHandler = useCallback(function (error, info) {
63
72
  var componentStack = info.componentStack;
64
73
  var errorInfo = {
@@ -70,23 +79,23 @@ export function CardWithURLRenderer(props) {
70
79
  // to the reliability of the smart-card front-end components.
71
80
  // Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
72
81
  if (error.name === 'ChunkLoadError') {
73
- fireEvent('operational.smartLink.chunkLoadFailed', {
82
+ fireEvent('operational.smartLink.chunkLoadFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
74
83
  display: appearance,
75
84
  error: error,
76
85
  errorInfo: errorInfo,
77
86
  definitionId: null
78
- });
87
+ }));
79
88
  } else if (error.name !== 'APIError') {
80
89
  if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
81
90
  startUfoExperience('smart-link-rendered', id || 'NULL');
82
91
  failUfoExperience('smart-link-rendered', id || 'NULL');
83
92
  failUfoExperience('smart-link-authenticated', id || 'NULL');
84
- fireEvent('ui.smartLink.renderFailed', {
93
+ fireEvent('ui.smartLink.renderFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
85
94
  display: isFlexibleUi ? 'flexible' : appearance,
86
95
  id: id !== null && id !== void 0 ? id : null,
87
96
  error: error,
88
97
  errorInfo: errorInfo
89
- });
98
+ }));
90
99
  } else {
91
100
  analytics.ui.renderFailedEvent({
92
101
  display: isFlexibleUi ? 'flexible' : appearance,
@@ -101,7 +110,7 @@ export function CardWithURLRenderer(props) {
101
110
  url: url !== null && url !== void 0 ? url : '',
102
111
  err: error
103
112
  });
104
- }, [analytics.ui, appearance, id, onError, url, isFlexibleUi, fireEvent]);
113
+ }, [analytics.ui, analyticsContext, appearance, id, onError, url, isFlexibleUi, fireEvent]);
105
114
  if (!url) {
106
115
  throw new Error('@atlaskit/smart-card: url property is missing.');
107
116
  }
@@ -1,6 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback } from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { CardDisplay } from '../../../../constants';
5
+ import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../../../state/analytics';
4
6
  import { EmbedModalSize } from '../../types';
5
7
  var getResizeFrom = function getResizeFrom(size) {
6
8
  return size === EmbedModalSize.Small ? EmbedModalSize.Large : EmbedModalSize.Small;
@@ -8,63 +10,117 @@ var getResizeFrom = function getResizeFrom(size) {
8
10
  var withAnalytics = function withAnalytics(Component) {
9
11
  return function (props) {
10
12
  var analytics = props.analytics,
13
+ fireEvent = props.fireEvent,
14
+ extensionKey = props.extensionKey,
15
+ id = props.id,
11
16
  onClose = props.onClose,
12
17
  onOpen = props.onOpen,
13
18
  onOpenFailed = props.onOpenFailed,
14
19
  onResize = props.onResize,
15
20
  origin = props.origin;
16
21
  var handleOnOpen = useCallback(function (context) {
17
- analytics === null || analytics === void 0 || analytics.screen.modalViewedEvent({
18
- name: 'embedPreviewModal',
19
- attributes: {
20
- origin: origin,
22
+ if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
23
+ fireEvent === null || fireEvent === void 0 || fireEvent('screen.embedPreviewModal.viewed', {
24
+ origin: origin !== null && origin !== void 0 ? origin : null,
21
25
  size: context.size
22
- }
23
- });
24
- analytics === null || analytics === void 0 || analytics.ui.renderSuccessEvent({
25
- status: 'resolved',
26
- display: CardDisplay.EmbedPreview
27
- });
26
+ });
27
+ } else {
28
+ analytics === null || analytics === void 0 || analytics.screen.modalViewedEvent({
29
+ name: 'embedPreviewModal',
30
+ attributes: {
31
+ origin: origin,
32
+ size: context.size
33
+ }
34
+ });
35
+ }
36
+ if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
37
+ succeedUfoExperience('smart-link-rendered', id || 'NULL', {
38
+ extensionKey: extensionKey,
39
+ display: CardDisplay.EmbedPreview
40
+ });
41
+
42
+ // UFO will disregard this if authentication experience has not yet been started
43
+ succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
44
+ display: CardDisplay.EmbedPreview
45
+ });
46
+ fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderSuccess', {
47
+ display: CardDisplay.EmbedPreview
48
+ });
49
+ } else {
50
+ analytics === null || analytics === void 0 || analytics.ui.renderSuccessEvent({
51
+ status: 'resolved',
52
+ display: CardDisplay.EmbedPreview
53
+ });
54
+ }
28
55
  if (onOpen) {
29
56
  onOpen(context);
30
57
  }
31
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.screen, analytics === null || analytics === void 0 ? void 0 : analytics.ui, onOpen, origin]);
58
+ }, [analytics === null || analytics === void 0 ? void 0 : analytics.screen, analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, extensionKey, id, onOpen, origin]);
32
59
  var handleOnOpenFailed = useCallback(function (error, errorInfo) {
33
- analytics === null || analytics === void 0 || analytics.ui.renderFailedEvent({
34
- display: CardDisplay.EmbedPreview,
35
- error: error,
36
- errorInfo: errorInfo
37
- });
60
+ if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
61
+ startUfoExperience('smart-link-rendered', id || 'NULL');
62
+ failUfoExperience('smart-link-rendered', id || 'NULL');
63
+ failUfoExperience('smart-link-authenticated', id || 'NULL');
64
+ fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderFailed', {
65
+ display: CardDisplay.EmbedPreview,
66
+ error: error,
67
+ errorInfo: errorInfo,
68
+ id: id !== null && id !== void 0 ? id : null
69
+ });
70
+ } else {
71
+ analytics === null || analytics === void 0 || analytics.ui.renderFailedEvent({
72
+ display: CardDisplay.EmbedPreview,
73
+ error: error,
74
+ errorInfo: errorInfo
75
+ });
76
+ }
38
77
  if (onOpenFailed) {
39
78
  onOpenFailed(error, errorInfo);
40
79
  }
41
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, onOpenFailed]);
80
+ }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, id, onOpenFailed]);
42
81
  var handleOnClose = useCallback(function (context) {
43
- analytics === null || analytics === void 0 || analytics.ui.modalClosedEvent({
44
- actionSubjectId: 'embedPreview',
45
- attributes: {
46
- origin: origin,
47
- previewTime: context.duration,
82
+ if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
83
+ var _context$duration;
84
+ fireEvent === null || fireEvent === void 0 || fireEvent('ui.modal.closed.embedPreview', {
85
+ origin: origin !== null && origin !== void 0 ? origin : null,
86
+ previewTime: (_context$duration = context.duration) !== null && _context$duration !== void 0 ? _context$duration : null,
48
87
  size: context.size
49
- }
50
- });
88
+ });
89
+ } else {
90
+ analytics === null || analytics === void 0 || analytics.ui.modalClosedEvent({
91
+ actionSubjectId: 'embedPreview',
92
+ attributes: {
93
+ origin: origin,
94
+ previewTime: context.duration,
95
+ size: context.size
96
+ }
97
+ });
98
+ }
51
99
  if (onClose) {
52
100
  onClose(context);
53
101
  }
54
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, onClose, origin]);
102
+ }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, onClose, origin]);
55
103
  var handleOnResize = useCallback(function (context) {
56
- analytics === null || analytics === void 0 || analytics.ui.buttonClickedEvent({
57
- actionSubjectId: 'embedPreviewResize',
58
- attributes: {
104
+ if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
105
+ fireEvent === null || fireEvent === void 0 || fireEvent('ui.button.clicked.embedPreviewResize', {
59
106
  newSize: context.size,
60
- origin: origin,
107
+ origin: origin !== null && origin !== void 0 ? origin : null,
61
108
  previousSize: getResizeFrom(context.size)
62
- }
63
- });
109
+ });
110
+ } else {
111
+ analytics === null || analytics === void 0 || analytics.ui.buttonClickedEvent({
112
+ actionSubjectId: 'embedPreviewResize',
113
+ attributes: {
114
+ newSize: context.size,
115
+ origin: origin,
116
+ previousSize: getResizeFrom(context.size)
117
+ }
118
+ });
119
+ }
64
120
  if (onResize) {
65
121
  onResize(context);
66
122
  }
67
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, onResize, origin]);
123
+ }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, onResize, origin]);
68
124
  return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
69
125
  onClose: handleOnClose,
70
126
  onOpen: handleOnOpen,