@atlaskit/smart-card 21.2.0 → 22.1.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 (128) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/cjs/extractors/block/index.js +6 -7
  3. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +16 -19
  4. package/dist/cjs/state/actions/index.js +54 -10
  5. package/dist/cjs/state/analytics/types.js +5 -0
  6. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +429 -109
  7. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -3
  8. package/dist/cjs/utils/analytics/analytics.js +241 -74
  9. package/dist/cjs/utils/analytics/index.js +32 -5
  10. package/dist/cjs/utils/mocks.js +28 -2
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +2 -2
  13. package/dist/cjs/view/BlockCard/index.js +6 -5
  14. package/dist/cjs/view/CardWithUrl/component.js +27 -5
  15. package/dist/cjs/view/CardWithUrl/loader.js +6 -1
  16. package/dist/cjs/view/EmbedCard/index.js +3 -2
  17. package/dist/cjs/view/EmbedModal/components/analytics/index.js +100 -0
  18. package/dist/cjs/view/EmbedModal/components/analytics/types.js +5 -0
  19. package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +5 -10
  20. package/dist/cjs/view/EmbedModal/index.js +54 -15
  21. package/dist/cjs/view/EmbedModal/types.js +9 -1
  22. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +17 -3
  23. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  24. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  25. package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  26. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +5 -2
  27. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -3
  28. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +36 -8
  29. package/dist/cjs/view/HoverCard/components/SnippetOrPreview.js +74 -0
  30. package/dist/cjs/view/HoverCard/index.js +6 -1
  31. package/dist/cjs/view/HoverCard/styled.js +11 -3
  32. package/dist/cjs/view/common/Modal.js +29 -4
  33. package/dist/cjs/view/common/ModalHeader.js +3 -2
  34. package/dist/es2019/extractors/block/index.js +6 -7
  35. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +16 -10
  36. package/dist/es2019/state/actions/index.js +54 -10
  37. package/dist/es2019/state/analytics/types.js +1 -0
  38. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +424 -41
  39. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -3
  40. package/dist/es2019/utils/analytics/analytics.js +254 -79
  41. package/dist/es2019/utils/analytics/index.js +32 -4
  42. package/dist/es2019/utils/mocks.js +26 -1
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +3 -3
  45. package/dist/es2019/view/BlockCard/index.js +5 -4
  46. package/dist/es2019/view/CardWithUrl/component.js +27 -5
  47. package/dist/es2019/view/CardWithUrl/loader.js +6 -1
  48. package/dist/es2019/view/EmbedCard/index.js +3 -2
  49. package/dist/es2019/view/EmbedModal/components/analytics/index.js +80 -0
  50. package/dist/es2019/view/EmbedModal/components/analytics/types.js +1 -0
  51. package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +5 -9
  52. package/dist/es2019/view/EmbedModal/index.js +46 -13
  53. package/dist/es2019/view/EmbedModal/types.js +6 -1
  54. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +17 -7
  55. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +4 -1
  56. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  57. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -3
  58. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +5 -2
  59. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -3
  60. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +36 -10
  61. package/dist/es2019/view/HoverCard/components/SnippetOrPreview.js +42 -0
  62. package/dist/es2019/view/HoverCard/index.js +6 -1
  63. package/dist/es2019/view/HoverCard/styled.js +8 -0
  64. package/dist/es2019/view/common/Modal.js +27 -6
  65. package/dist/es2019/view/common/ModalHeader.js +3 -2
  66. package/dist/esm/extractors/block/index.js +6 -7
  67. package/dist/esm/extractors/common/actions/extractPreviewAction.js +17 -19
  68. package/dist/esm/state/actions/index.js +54 -10
  69. package/dist/esm/state/analytics/types.js +1 -0
  70. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +428 -111
  71. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -3
  72. package/dist/esm/utils/analytics/analytics.js +241 -74
  73. package/dist/esm/utils/analytics/index.js +31 -4
  74. package/dist/esm/utils/mocks.js +25 -0
  75. package/dist/esm/version.json +1 -1
  76. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  77. package/dist/esm/view/BlockCard/index.js +5 -4
  78. package/dist/esm/view/CardWithUrl/component.js +27 -5
  79. package/dist/esm/view/CardWithUrl/loader.js +6 -1
  80. package/dist/esm/view/EmbedCard/index.js +3 -2
  81. package/dist/esm/view/EmbedModal/components/analytics/index.js +82 -0
  82. package/dist/esm/view/EmbedModal/components/analytics/types.js +1 -0
  83. package/dist/esm/view/EmbedModal/components/size-experiment/index.js +5 -10
  84. package/dist/esm/view/EmbedModal/index.js +52 -15
  85. package/dist/esm/view/EmbedModal/types.js +6 -1
  86. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +11 -3
  87. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  88. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  89. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  90. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +5 -2
  91. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -3
  92. package/dist/esm/view/HoverCard/components/HoverCardContent.js +36 -10
  93. package/dist/esm/view/HoverCard/components/SnippetOrPreview.js +53 -0
  94. package/dist/esm/view/HoverCard/index.js +6 -1
  95. package/dist/esm/view/HoverCard/styled.js +6 -2
  96. package/dist/esm/view/common/Modal.js +28 -6
  97. package/dist/esm/view/common/ModalHeader.js +3 -2
  98. package/dist/types/extractors/block/types.d.ts +4 -2
  99. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +7 -5
  100. package/dist/types/state/analytics/types.d.ts +9 -0
  101. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +41 -24
  102. package/dist/types/state/hooks/useSmartLink.d.ts +26 -18
  103. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +6 -2
  104. package/dist/types/utils/analytics/analytics.d.ts +19 -21
  105. package/dist/types/utils/analytics/index.d.ts +2 -2
  106. package/dist/types/utils/analytics/types.d.ts +91 -0
  107. package/dist/types/utils/mocks.d.ts +48 -0
  108. package/dist/types/utils/types.d.ts +3 -1
  109. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -0
  110. package/dist/types/view/BlockCard/index.d.ts +2 -2
  111. package/dist/types/view/BlockCard/types.d.ts +4 -4
  112. package/dist/types/view/Card/index.d.ts +1 -1
  113. package/dist/types/view/EmbedCard/types.d.ts +2 -2
  114. package/dist/types/view/EmbedModal/components/analytics/index.d.ts +5 -0
  115. package/dist/types/view/EmbedModal/components/analytics/types.d.ts +6 -0
  116. package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +4 -3
  117. package/dist/types/view/EmbedModal/index.d.ts +3 -1
  118. package/dist/types/view/EmbedModal/types.d.ts +14 -4
  119. package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +7 -1
  120. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +15 -0
  121. package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
  122. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +5 -0
  123. package/dist/types/view/HoverCard/components/SnippetOrPreview.d.ts +4 -0
  124. package/dist/types/view/HoverCard/styled.d.ts +2 -0
  125. package/dist/types/view/HoverCard/types.d.ts +5 -0
  126. package/dist/types/view/common/Modal.d.ts +6 -8
  127. package/package.json +1 -1
  128. package/report.api.md +324 -108
@@ -32,25 +32,25 @@ export const fireSmartLinkEvent = (payload, createAnalyticsEvent) => {
32
32
  createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
33
33
  }
34
34
  };
35
- export const resolvedEvent = (id, definitionId, extensionKey, resourceType) => ({
35
+ export const resolvedEvent = props => ({
36
36
  action: 'resolved',
37
37
  actionSubject: 'smartLink',
38
38
  eventType: 'operational',
39
- attributes: {
40
- id,
41
- ...context,
42
- ...(definitionId ? {
43
- definitionId
44
- } : {}),
45
- ...(extensionKey ? {
46
- extensionKey
47
- } : {}),
48
- ...(resourceType ? {
49
- resourceType
50
- } : {})
39
+ attributes: { ...props,
40
+ ...context
51
41
  }
52
42
  });
53
- export const unresolvedEvent = (id, status, definitionId, extensionKey, resourceType, error) => ({
43
+ export const unresolvedEvent = ({
44
+ id,
45
+ definitionId,
46
+ extensionKey,
47
+ resourceType,
48
+ destinationSubproduct,
49
+ destinationProduct,
50
+ error,
51
+ status,
52
+ location
53
+ }) => ({
54
54
  action: 'unresolved',
55
55
  actionSubject: 'smartLink',
56
56
  eventType: 'operational',
@@ -66,15 +66,33 @@ export const unresolvedEvent = (id, status, definitionId, extensionKey, resource
66
66
  ...(resourceType ? {
67
67
  resourceType
68
68
  } : {}),
69
+ ...(destinationSubproduct ? {
70
+ destinationSubproduct
71
+ } : {}),
72
+ ...(destinationProduct ? {
73
+ destinationProduct
74
+ } : {}),
75
+ ...(location ? {
76
+ location
77
+ } : {}),
69
78
  reason: status,
70
79
  error: error ? {
71
- message: error.message,
72
- kind: error.kind,
73
- type: error.type
80
+ message: error === null || error === void 0 ? void 0 : error.message,
81
+ kind: error === null || error === void 0 ? void 0 : error.kind,
82
+ type: error === null || error === void 0 ? void 0 : error.type
74
83
  } : undefined
75
84
  }
76
85
  });
77
- export const invokeSucceededEvent = (id, actionType, display, extensionKey) => {
86
+ export const invokeSucceededEvent = ({
87
+ id,
88
+ actionType,
89
+ display,
90
+ extensionKey,
91
+ definitionId,
92
+ destinationProduct,
93
+ destinationSubproduct,
94
+ location
95
+ }) => {
78
96
  const measure = getMeasure(id, 'resolved') || {
79
97
  duration: undefined
80
98
  };
@@ -86,12 +104,26 @@ export const invokeSucceededEvent = (id, actionType, display, extensionKey) => {
86
104
  id,
87
105
  actionType,
88
106
  display,
89
- extensionKey: extensionKey || '',
107
+ definitionId,
108
+ destinationProduct,
109
+ destinationSubproduct,
110
+ location,
111
+ extensionKey,
90
112
  duration: measure.duration
91
113
  }
92
114
  };
93
115
  };
94
- export const invokeFailedEvent = (id, actionType, display, reason, extensionKey) => {
116
+ export const invokeFailedEvent = ({
117
+ id,
118
+ actionType,
119
+ display,
120
+ reason,
121
+ extensionKey,
122
+ definitionId,
123
+ destinationProduct,
124
+ destinationSubproduct,
125
+ location
126
+ }) => {
95
127
  const measure = getMeasure(id, 'errored') || {
96
128
  duration: undefined
97
129
  };
@@ -103,78 +135,127 @@ export const invokeFailedEvent = (id, actionType, display, reason, extensionKey)
103
135
  id,
104
136
  actionType,
105
137
  display,
106
- extensionKey: extensionKey || '',
138
+ extensionKey,
139
+ definitionId,
140
+ destinationProduct,
141
+ destinationSubproduct,
142
+ location,
107
143
  duration: measure.duration,
108
144
  reason
109
145
  }
110
146
  };
111
147
  };
112
- export const connectSucceededEvent = (definitionId, extensionKey) => ({
148
+ export const connectSucceededEvent = ({
149
+ definitionId,
150
+ extensionKey,
151
+ destinationProduct,
152
+ destinationSubproduct,
153
+ location
154
+ }) => ({
113
155
  action: 'connectSucceeded',
114
156
  actionSubject: 'smartLink',
115
157
  eventType: 'operational',
116
158
  attributes: { ...context,
117
- ...(definitionId ? {
118
- definitionId
119
- } : {}),
120
- ...(extensionKey ? {
121
- extensionKey
122
- } : {})
159
+ definitionId,
160
+ extensionKey,
161
+ destinationProduct,
162
+ destinationSubproduct,
163
+ location
123
164
  }
124
165
  });
125
- export const connectFailedEvent = (definitionId, extensionKey, reason) => ({
166
+ export const connectFailedEvent = ({
167
+ definitionId,
168
+ extensionKey,
169
+ destinationProduct,
170
+ destinationSubproduct,
171
+ location,
172
+ reason
173
+ }) => ({
126
174
  action: 'connectFailed',
127
175
  actionSubject: 'smartLink',
128
176
  actionSubjectId: reason,
129
177
  eventType: 'operational',
130
178
  attributes: { ...context,
131
- ...(reason ? {
132
- reason: reason
133
- } : {}),
134
- ...(definitionId ? {
135
- definitionId
136
- } : {}),
137
- ...(extensionKey ? {
138
- extensionKey
139
- } : {})
179
+ reason,
180
+ extensionKey,
181
+ definitionId,
182
+ destinationProduct,
183
+ destinationSubproduct,
184
+ location
140
185
  }
141
186
  });
142
- export const trackAppAccountConnected = (definitionId, extensionKey) => ({
187
+ export const trackAppAccountConnected = ({
188
+ definitionId,
189
+ extensionKey,
190
+ destinationProduct,
191
+ destinationSubproduct,
192
+ location
193
+ }) => ({
143
194
  action: 'connected',
144
195
  actionSubject: 'applicationAccount',
145
196
  eventType: 'track',
146
197
  attributes: { ...context,
147
- ...(definitionId ? {
148
- definitionId
149
- } : {}),
150
- ...(extensionKey ? {
151
- extensionKey
152
- } : {})
198
+ definitionId,
199
+ extensionKey,
200
+ destinationProduct,
201
+ destinationSubproduct,
202
+ location
153
203
  }
154
204
  });
155
- export const uiAuthEvent = (display, definitionId, extensionKey) => ({
205
+ export const uiAuthEvent = ({
206
+ definitionId,
207
+ extensionKey,
208
+ destinationProduct,
209
+ destinationSubproduct,
210
+ location,
211
+ display
212
+ }) => ({
156
213
  action: 'clicked',
157
214
  actionSubject: 'button',
158
215
  actionSubjectId: 'connectAccount',
159
216
  eventType: 'ui',
160
217
  attributes: { ...context,
161
- definitionId: definitionId || '',
162
- extensionKey: extensionKey || '',
218
+ definitionId,
219
+ extensionKey,
220
+ destinationProduct,
221
+ destinationSubproduct,
222
+ location,
163
223
  display
164
224
  }
165
225
  });
166
- export const uiAuthAlternateAccountEvent = (display, definitionId, extensionKey) => ({
226
+ export const uiAuthAlternateAccountEvent = ({
227
+ definitionId,
228
+ extensionKey,
229
+ destinationProduct,
230
+ destinationSubproduct,
231
+ location,
232
+ display
233
+ }) => ({
167
234
  action: 'clicked',
168
235
  actionSubject: 'smartLink',
169
236
  actionSubjectId: 'tryAnotherAccount',
170
237
  eventType: 'ui',
171
238
  attributes: { ...context,
172
- definitionId: definitionId || '',
173
- extensionKey: extensionKey || '',
239
+ definitionId,
240
+ extensionKey,
241
+ destinationProduct,
242
+ destinationSubproduct,
243
+ location,
174
244
  display
175
245
  }
176
246
  });
177
- export const uiCardClickedEvent = (id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId) => ({
247
+ export const uiCardClickedEvent = ({
248
+ id,
249
+ display,
250
+ status,
251
+ definitionId,
252
+ extensionKey,
253
+ isModifierKeyPressed,
254
+ location,
255
+ destinationProduct,
256
+ destinationSubproduct,
257
+ actionSubjectId
258
+ }) => ({
178
259
  action: 'clicked',
179
260
  actionSubject: 'smartLink',
180
261
  actionSubjectId,
@@ -182,8 +263,8 @@ export const uiCardClickedEvent = (id, display, status, definitionId, extensionK
182
263
  attributes: { ...context,
183
264
  id,
184
265
  status,
185
- definitionId: definitionId || '',
186
- extensionKey: extensionKey || '',
266
+ definitionId,
267
+ extensionKey,
187
268
  display,
188
269
  isModifierKeyPressed,
189
270
  location,
@@ -191,7 +272,16 @@ export const uiCardClickedEvent = (id, display, status, definitionId, extensionK
191
272
  destinationSubproduct
192
273
  }
193
274
  });
194
- export const uiActionClickedEvent = (id, actionType, extensionKey, display) => ({
275
+ export const uiActionClickedEvent = ({
276
+ id,
277
+ actionType,
278
+ extensionKey,
279
+ display,
280
+ definitionId,
281
+ destinationProduct,
282
+ destinationSubproduct,
283
+ location
284
+ }) => ({
195
285
  action: 'clicked',
196
286
  actionSubject: 'button',
197
287
  actionSubjectId: uiActionSubjectIds[actionType],
@@ -199,84 +289,169 @@ export const uiActionClickedEvent = (id, actionType, extensionKey, display) => (
199
289
  attributes: { ...context,
200
290
  id,
201
291
  display,
202
- extensionKey: extensionKey || '',
203
- actionType: actionType
292
+ actionType: actionType,
293
+ extensionKey: extensionKey,
294
+ definitionId,
295
+ destinationProduct,
296
+ destinationSubproduct,
297
+ location
204
298
  }
205
299
  });
206
- export const uiClosedAuthEvent = (display, definitionId, extensionKey) => ({
300
+ export const uiClosedAuthEvent = ({
301
+ display,
302
+ extensionKey,
303
+ definitionId,
304
+ destinationProduct,
305
+ destinationSubproduct,
306
+ location
307
+ }) => ({
207
308
  action: 'closed',
208
309
  actionSubject: 'consentModal',
209
310
  eventType: 'ui',
210
311
  attributes: { ...context,
211
- definitionId: definitionId || '',
212
- extensionKey: extensionKey || '',
312
+ extensionKey,
313
+ definitionId,
314
+ destinationProduct,
315
+ destinationSubproduct,
316
+ location,
213
317
  display
214
318
  }
215
319
  });
216
- export const screenAuthPopupEvent = (definitionId, extensionKey) => ({
320
+ export const screenAuthPopupEvent = ({
321
+ extensionKey,
322
+ definitionId,
323
+ destinationProduct,
324
+ destinationSubproduct,
325
+ location
326
+ }) => ({
217
327
  actionSubject: 'consentModal',
218
328
  eventType: 'screen',
219
329
  attributes: { ...context,
220
- definitionId: definitionId || '',
221
- extensionKey: extensionKey || ''
330
+ extensionKey,
331
+ definitionId,
332
+ destinationProduct,
333
+ destinationSubproduct,
334
+ location
222
335
  }
223
336
  });
224
- export const uiRenderSuccessEvent = (display, status, definitionId, extensionKey) => ({
337
+ export const uiRenderSuccessEvent = ({
338
+ display,
339
+ status,
340
+ extensionKey,
341
+ definitionId,
342
+ destinationProduct,
343
+ destinationSubproduct,
344
+ location
345
+ }) => ({
225
346
  action: 'renderSuccess',
226
347
  actionSubject: 'smartLink',
227
348
  eventType: 'ui',
228
349
  attributes: { ...context,
229
350
  status,
230
- definitionId: definitionId || '',
231
- extensionKey: extensionKey || '',
351
+ extensionKey,
352
+ definitionId,
353
+ destinationProduct,
354
+ destinationSubproduct,
355
+ location,
232
356
  display
233
357
  }
234
358
  });
235
- export const uiRenderFailedEvent = (display, error, errorInfo) => ({
359
+ export const uiRenderFailedEvent = ({
360
+ display,
361
+ error,
362
+ errorInfo,
363
+ extensionKey,
364
+ definitionId,
365
+ destinationProduct,
366
+ destinationSubproduct,
367
+ location
368
+ }) => ({
236
369
  actionSubject: 'smartLink',
237
370
  action: 'renderFailed',
238
371
  eventType: 'ui',
239
- attributes: {
372
+ attributes: { ...context,
240
373
  error,
241
374
  errorInfo,
242
- display
375
+ display,
376
+ extensionKey,
377
+ definitionId,
378
+ destinationProduct,
379
+ destinationSubproduct,
380
+ location
243
381
  }
244
382
  });
245
- export const uiHoverCardViewedEvent = (id, previewDisplay, definitionId, extensionKey, previewInvokeMethod) => ({
383
+ export const uiHoverCardViewedEvent = ({
384
+ id,
385
+ previewDisplay,
386
+ extensionKey,
387
+ definitionId,
388
+ destinationProduct,
389
+ destinationSubproduct,
390
+ location,
391
+ previewInvokeMethod
392
+ }) => ({
246
393
  action: 'viewed',
247
394
  actionSubject: 'hoverCard',
248
395
  eventType: 'ui',
249
396
  attributes: { ...context,
250
397
  id,
251
- definitionId: definitionId || '',
252
- extensionKey: extensionKey || '',
253
398
  previewDisplay,
399
+ extensionKey,
400
+ definitionId,
401
+ destinationProduct,
402
+ destinationSubproduct,
403
+ location,
254
404
  previewInvokeMethod
255
405
  }
256
406
  });
257
- export const uiHoverCardDismissedEvent = (id, previewDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod) => ({
407
+ export const uiHoverCardDismissedEvent = ({
408
+ id,
409
+ previewDisplay,
410
+ hoverTime,
411
+ extensionKey,
412
+ definitionId,
413
+ destinationProduct,
414
+ destinationSubproduct,
415
+ location,
416
+ previewInvokeMethod
417
+ }) => ({
258
418
  action: 'dismissed',
259
419
  actionSubject: 'hoverCard',
260
420
  eventType: 'ui',
261
421
  attributes: { ...context,
262
422
  id,
263
- definitionId: definitionId || '',
264
- extensionKey: extensionKey || '',
265
- hoverTime,
266
423
  previewDisplay,
424
+ hoverTime,
425
+ extensionKey,
426
+ definitionId,
427
+ destinationProduct,
428
+ destinationSubproduct,
429
+ location,
267
430
  previewInvokeMethod
268
431
  }
269
432
  });
270
- export const uiHoverCardOpenLinkClickedEvent = (id, previewDisplay, definitionId, extensionKey, previewInvokeMethod) => ({
433
+ export const uiHoverCardOpenLinkClickedEvent = ({
434
+ id,
435
+ previewDisplay,
436
+ extensionKey,
437
+ definitionId,
438
+ destinationProduct,
439
+ destinationSubproduct,
440
+ location,
441
+ previewInvokeMethod
442
+ }) => ({
271
443
  action: 'clicked',
272
444
  actionSubject: 'button',
273
445
  actionSubjectId: 'shortcutGoToLink',
274
446
  eventType: 'ui',
275
447
  attributes: { ...context,
276
448
  id,
277
- definitionId: definitionId || '',
278
- extensionKey: extensionKey || '',
279
449
  previewDisplay,
450
+ extensionKey,
451
+ definitionId,
452
+ destinationProduct,
453
+ destinationSubproduct,
454
+ location,
280
455
  previewInvokeMethod
281
456
  }
282
457
  });
@@ -1,13 +1,31 @@
1
- import { resolvedEvent, unresolvedEvent } from './analytics';
2
1
  import { getMeasure } from '../performance';
2
+ import { resolvedEvent, unresolvedEvent } from './analytics';
3
3
  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';
4
- export const instrumentEvent = (id, status, definitionId, extensionKey, resourceType, error) => {
4
+ export const instrumentEvent = ({
5
+ id,
6
+ status,
7
+ extensionKey,
8
+ definitionId,
9
+ resourceType,
10
+ destinationProduct,
11
+ destinationSubproduct,
12
+ location,
13
+ error
14
+ }) => {
5
15
  const measure = getMeasure(id, status) || {
6
16
  duration: undefined
7
17
  };
8
18
 
9
19
  if (status === 'resolved') {
10
- const event = resolvedEvent(id, definitionId, extensionKey, resourceType);
20
+ const event = resolvedEvent({
21
+ id,
22
+ extensionKey,
23
+ definitionId,
24
+ resourceType,
25
+ destinationProduct,
26
+ destinationSubproduct,
27
+ location
28
+ });
11
29
  return { ...event,
12
30
  attributes: { ...event.attributes,
13
31
  duration: measure.duration
@@ -15,7 +33,17 @@ export const instrumentEvent = (id, status, definitionId, extensionKey, resource
15
33
  };
16
34
  } else {
17
35
  if ((error === null || error === void 0 ? void 0 : error.type) !== 'ResolveUnsupportedError') {
18
- const event = unresolvedEvent(id, status, definitionId, extensionKey, resourceType, error);
36
+ const event = unresolvedEvent({
37
+ id,
38
+ status,
39
+ extensionKey,
40
+ definitionId,
41
+ resourceType,
42
+ destinationProduct,
43
+ destinationSubproduct,
44
+ location,
45
+ error
46
+ });
19
47
  return { ...event,
20
48
  attributes: { ...event.attributes,
21
49
  duration: measure.duration
@@ -109,6 +109,18 @@ export const mocks = {
109
109
  data: {
110
110
  status: 'CompletedStatus'
111
111
  }
112
+ },
113
+ analytics: {
114
+ status: 'resolved',
115
+ details: {
116
+ meta: {
117
+ definitionId: 'spaghetti-id',
118
+ key: 'spaghetti-key',
119
+ resourceType: 'spaghetti-resource',
120
+ subproduct: 'spaghetti-subproduct',
121
+ product: 'spaghetti-product'
122
+ }
123
+ }
112
124
  }
113
125
  };
114
126
  export const fakeResponse = () => Promise.resolve(mocks.success);
@@ -126,4 +138,17 @@ export const fakeFactory = (implementation, implementationPost, implementationPr
126
138
  }
127
139
 
128
140
  };
129
- export const waitFor = (time = 1) => new Promise(res => setTimeout(res, time));
141
+ export const waitFor = (time = 1) => new Promise(res => setTimeout(res, time));
142
+ export const mockAnalytics = {
143
+ ui: {
144
+ buttonClickedEvent: () => {},
145
+ modalClosedEvent: () => {},
146
+ renderSuccessEvent: () => {},
147
+ renderFailedEvent: () => {}
148
+ },
149
+ operational: {},
150
+ track: {},
151
+ screen: {
152
+ modalViewedEvent: () => {}
153
+ }
154
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "21.2.0",
3
+ "version": "22.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import ReactDOM from 'react-dom';
4
- import { IntlProvider, FormattedMessage } from 'react-intl-next';
4
+ import { FormattedMessage, IntlProvider } from 'react-intl-next';
5
5
  import { messages } from '../../../messages';
6
6
 
7
7
  /*
@@ -36,9 +36,9 @@ export async function previewFunction({
36
36
  ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
37
37
  locale: "en"
38
38
  }, /*#__PURE__*/React.createElement(Modal.default, _extends({}, rest, {
39
- onClose: () => {
39
+ onClose: context => {
40
40
  if (popupMountPoint) {
41
- onClose();
41
+ onClose(context);
42
42
  ReactDOM.unmountComponentAtNode(popupMountPoint);
43
43
  }
44
44
  }
@@ -5,7 +5,6 @@ import { extractBlockProps } from '../../extractors/block';
5
5
  import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
6
6
  import { extractRequestAccessContext } from '../../extractors/common/context';
7
7
  import { CardLinkView } from '../LinkView';
8
- export { default as PreviewAction } from './actions/PreviewAction';
9
8
  import { AuthorizeAction } from './actions/AuthorizeAction';
10
9
  import { ForbiddenAction } from './actions/ForbiddenAction';
11
10
  import { ResolvedView as BlockCardResolvedView } from './views/ResolvedView';
@@ -15,6 +14,7 @@ import { UnauthorizedView as BlockCardUnauthorisedView } from './views/Unauthori
15
14
  import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
16
15
  import { ErroredView as BlockCardErroredView } from './views/ErroredView';
17
16
  import { useFeatureFlag } from '@atlaskit/link-provider';
17
+ export { default as PreviewAction } from './actions/PreviewAction';
18
18
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
19
19
  export const BlockCard = ({
20
20
  url,
@@ -26,7 +26,6 @@ export const BlockCard = ({
26
26
  handleAuthorize,
27
27
  handleErrorRetry,
28
28
  handleFrameClick,
29
- handleAnalytics,
30
29
  handleInvoke,
31
30
  renderers,
32
31
  isSelected,
@@ -34,7 +33,8 @@ export const BlockCard = ({
34
33
  onError,
35
34
  testId,
36
35
  showActions,
37
- platform
36
+ platform,
37
+ analytics
38
38
  }) => {
39
39
  var _details$meta, _forbiddenViewProps$c;
40
40
 
@@ -48,8 +48,9 @@ export const BlockCard = ({
48
48
  const data = details && details.data || getEmptyJsonLd();
49
49
  const meta = details && details.meta;
50
50
  const extractorOpts = {
51
+ analytics,
52
+ origin: 'smartLinkCard',
51
53
  featureFlags,
52
- handleAnalytics,
53
54
  handleInvoke,
54
55
  extensionKey: getExtensionKey(details)
55
56
  };