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