@atlaskit/smart-card 21.3.0 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +10 -2
  3. package/dist/cjs/state/actions/index.js +54 -10
  4. package/dist/cjs/state/analytics/types.js +5 -0
  5. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +386 -109
  6. package/dist/cjs/utils/analytics/analytics.js +239 -72
  7. package/dist/cjs/utils/analytics/index.js +32 -5
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/cjs/view/CardWithUrl/component.js +25 -3
  10. package/dist/cjs/view/CardWithUrl/loader.js +6 -1
  11. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +9 -2
  12. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +15 -4
  13. package/dist/cjs/view/HoverCard/index.js +6 -1
  14. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +10 -2
  15. package/dist/es2019/state/actions/index.js +54 -10
  16. package/dist/es2019/state/analytics/types.js +1 -0
  17. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +379 -39
  18. package/dist/es2019/utils/analytics/analytics.js +253 -78
  19. package/dist/es2019/utils/analytics/index.js +32 -4
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/es2019/view/CardWithUrl/component.js +25 -3
  22. package/dist/es2019/view/CardWithUrl/loader.js +6 -1
  23. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +9 -2
  24. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +15 -4
  25. package/dist/es2019/view/HoverCard/index.js +6 -1
  26. package/dist/esm/extractors/common/actions/extractPreviewAction.js +10 -2
  27. package/dist/esm/state/actions/index.js +54 -10
  28. package/dist/esm/state/analytics/types.js +1 -0
  29. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +383 -109
  30. package/dist/esm/utils/analytics/analytics.js +239 -72
  31. package/dist/esm/utils/analytics/index.js +31 -4
  32. package/dist/esm/version.json +1 -1
  33. package/dist/esm/view/CardWithUrl/component.js +25 -3
  34. package/dist/esm/view/CardWithUrl/loader.js +6 -1
  35. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +9 -2
  36. package/dist/esm/view/HoverCard/components/HoverCardContent.js +15 -4
  37. package/dist/esm/view/HoverCard/index.js +6 -1
  38. package/dist/types/state/analytics/types.d.ts +9 -0
  39. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +18 -23
  40. package/dist/types/state/hooks/useSmartLink.d.ts +17 -18
  41. package/dist/types/utils/analytics/analytics.d.ts +19 -21
  42. package/dist/types/utils/analytics/index.d.ts +2 -2
  43. package/dist/types/utils/analytics/types.d.ts +91 -0
  44. package/package.json +1 -1
  45. package/report.api.md +271 -108
@@ -26,7 +26,9 @@ export var getOpenAction = function getOpenAction(url, analytics, onActionClick)
26
26
  }
27
27
 
28
28
  window.open(url, '_blank');
29
- analytics.ui.hoverCardOpenLinkClickedEvent('card');
29
+ analytics.ui.hoverCardOpenLinkClickedEvent({
30
+ previewDisplay: 'card'
31
+ });
30
32
  },
31
33
  testId: 'hover-card-open-button'
32
34
  };
@@ -68,15 +70,24 @@ var HoverCardContent = function HoverCardContent(_ref) {
68
70
  useEffect(function () {
69
71
  // Since hover preview only render on resolved status,
70
72
  // there is no need to check for statuses.
71
- analytics.ui.renderSuccessEvent(SMART_CARD_ANALYTICS_DISPLAY, cardState.status);
73
+ analytics.ui.renderSuccessEvent({
74
+ display: SMART_CARD_ANALYTICS_DISPLAY,
75
+ status: cardState.status
76
+ });
72
77
  }, [analytics.ui, cardState.status]);
73
78
  var extensionKey = useMemo(function () {
74
79
  return getExtensionKey(cardState.details);
75
80
  }, [cardState.details]);
76
81
  var onClick = useCallback(function (event) {
77
82
  var isModifierKeyPressed = isSpecialEvent(event);
78
- analytics.ui.cardClickedEvent(undefined, SMART_CARD_ANALYTICS_DISPLAY, cardState.status, undefined, undefined, isModifierKeyPressed, undefined, undefined, undefined, 'titleGoToLink');
79
- }, [cardState.status, analytics.ui]);
83
+ analytics.ui.cardClickedEvent({
84
+ id: id,
85
+ display: SMART_CARD_ANALYTICS_DISPLAY,
86
+ status: cardState.status,
87
+ isModifierKeyPressed: isModifierKeyPressed,
88
+ actionSubjectId: 'titleGoToLink'
89
+ });
90
+ }, [cardState.status, analytics.ui, id]);
80
91
  var titleActions = useMemo(function () {
81
92
  return [getOpenAction(url, analytics, onActionClick)];
82
93
  }, [url, analytics, onActionClick]);
@@ -20,7 +20,12 @@ var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
20
20
  }, [createAnalyticsEvent]);
21
21
  var analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
22
22
  var onError = useCallback(function (error, info) {
23
- analytics.ui.renderFailedEvent(SMART_CARD_ANALYTICS_DISPLAY, id, error, info);
23
+ analytics.ui.renderFailedEvent({
24
+ display: SMART_CARD_ANALYTICS_DISPLAY,
25
+ id: id,
26
+ error: error,
27
+ errorInfo: info
28
+ });
24
29
  }, [analytics.ui, id]);
25
30
  return jsx(ErrorBoundary, {
26
31
  fallback: children,
@@ -0,0 +1,9 @@
1
+ import { DestinationSubproduct, DestinationProduct } from '../../utils/analytics/types';
2
+ export interface CommonEventProps {
3
+ definitionId?: string;
4
+ extensionKey?: string;
5
+ resourceType?: string;
6
+ destinationSubproduct?: DestinationSubproduct | string;
7
+ destinationProduct?: DestinationProduct | string;
8
+ location?: string;
9
+ }
@@ -1,10 +1,5 @@
1
- import { ErrorInfo } from 'react';
2
- import { CardType, APIError } from '@atlaskit/linking-common';
3
1
  import { AnalyticsHandler } from '../../utils/types';
4
- import { CardInnerAppearance } from '../../view/Card/types';
5
- import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
6
- import { InvokeType } from '../../model/invoke-opts';
7
- import { DestinationProduct, DestinationSubproduct } from '../../utils/analytics/types';
2
+ import { ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps } from '../../utils/analytics/types';
8
3
  /**
9
4
  * This hook provides usage of Smart Link analytics outside of the Card component.
10
5
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
@@ -24,7 +19,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
24
19
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
25
20
  * @returns
26
21
  */
27
- authEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
22
+ authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiAuthEventProps) => void;
28
23
  /**
29
24
  * This fires an event that represents when a user clicks on the authentication
30
25
  * call to action with a forbidden authenticated account. (i.e. Try another account).
@@ -33,7 +28,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
33
28
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
34
29
  * @returns
35
30
  */
36
- authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
31
+ authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiAuthAlternateAccountEventProps) => void;
37
32
  /**
38
33
  * This fires an event that represents when a user clicks on a Smart Link.
39
34
  * @param id The unique ID for this Smart Link.
@@ -46,7 +41,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
46
41
  * @param destinationProduct The product the Smart Link is linked to.
47
42
  * @returns
48
43
  */
49
- cardClickedEvent: (id: string | undefined, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: DestinationProduct | string | undefined, destinationSubproduct?: DestinationSubproduct | string | undefined, actionSubjectId?: string | undefined) => void;
44
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: UiCardClickedEventProps) => void;
50
45
  /**
51
46
  * This fires an event that represents when a user clicks on a Smart Link action.
52
47
  * Note: This also starts the UFO smart-link-action-invocation experience.
@@ -57,7 +52,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
57
52
  * @param invokeType Whether the action invoked made a call to a server.
58
53
  * @returns
59
54
  */
60
- actionClickedEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: CardInnerAppearance, invokeType: InvokeType) => void;
55
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
61
56
  /**
62
57
  * This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
63
58
  * https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
@@ -66,7 +61,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
66
61
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
67
62
  * @param previewInvokeMethod How the preview was triggered.
68
63
  */
69
- hoverCardOpenLinkClickedEvent: (previewDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => void;
64
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardOpenLinkClickedEventProps) => void;
70
65
  /**
71
66
  * This fires an event that represents when a user closed the authentication window without authenticating after opening it.
72
67
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -74,7 +69,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
74
69
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
75
70
  * @returns
76
71
  */
77
- closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
72
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => void;
78
73
  /**
79
74
  * This fires an event that represents when a Smart Link was rendered successfully.
80
75
  * Note: this fires even if the Smart Link request errored out.
@@ -83,7 +78,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
83
78
  * @param definitionId The definitionId of the Smart Link resolver invoked.
84
79
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
85
80
  */
86
- renderSuccessEvent: (display: CardInnerAppearance, status: CardType, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
81
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
87
82
  /**
88
83
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
89
84
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -91,7 +86,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
91
86
  * @param error: An error representing why the Smart Link render failed.
92
87
  * @param errorInfo: Additional details about the error including the stack trace.
93
88
  */
94
- renderFailedEvent: (display: CardInnerAppearance, id: string | undefined, error: Error, errorInfo: ErrorInfo) => void;
89
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
95
90
  /**
96
91
  * This fires an event that represents a hover preview being opened.
97
92
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -100,7 +95,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
100
95
  * @param previewInvokeMethod How the preview was triggered.
101
96
  * @returns
102
97
  */
103
- hoverCardViewedEvent: (previewDisplay: PreviewDisplay, previewInvokeMethod?: PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
98
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiHoverCardViewedEventProps) => void;
104
99
  /**
105
100
  * This fires an event that represents a hover preview being dismissed.
106
101
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -110,7 +105,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
110
105
  * @param previewInvokeMethod How the preview was triggered.
111
106
  * @returns
112
107
  */
113
- hoverCardDismissedEvent: (previewDisplay: PreviewDisplay, hoverTime: number, previewInvokeMethod?: PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
108
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiHoverCardDismissedEventProps) => void;
114
109
  };
115
110
  operational: {
116
111
  /**
@@ -120,7 +115,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
120
115
  * @param actionType The type of action invoked, e.g. PreviewAction
121
116
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
122
117
  */
123
- invokeSucceededEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: CardInnerAppearance) => void;
118
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
124
119
  /**
125
120
  * This fires an event that represents an action being unsuccessfully invoked.
126
121
  * @param id The unique ID for this Smart Link.
@@ -129,14 +124,14 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
129
124
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
130
125
  * @param reason The reason the invocation failed.
131
126
  */
132
- invokeFailedEvent: (id: string | undefined, providerKey: string | undefined, actionType: string, display: CardInnerAppearance, reason: string) => void;
127
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
133
128
  /**
134
129
  * This fires an event that represents an account successfully being connected via a Smart Link.
135
130
  * @param id The unique ID for this Smart Link.
136
131
  * @param definitionId The definitionId of the Smart Link resolver invoked.
137
132
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
138
133
  */
139
- connectSucceededEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
134
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectSucceededEventProps) => void;
140
135
  /**
141
136
  * This fires an event that represents an account unsuccessfully being connected.
142
137
  * @param id The unique ID for this Smart Link.
@@ -144,7 +139,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
144
139
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
145
140
  * @param reason The reason why the Smart Link connect account failed.
146
141
  */
147
- connectFailedEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => void;
142
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectFailedEventProps) => void;
148
143
  /**
149
144
  * This fires an event which represents a Smart Link request succeeding or failing based on the status.
150
145
  * @param id The unique ID for this Smart Link.
@@ -154,7 +149,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
154
149
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
155
150
  * @param error An error representing why the Smart Link request failed.
156
151
  */
157
- instrument: (id: string | undefined, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => void;
152
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: InstrumentEventProps) => void;
158
153
  };
159
154
  track: {
160
155
  /**
@@ -163,7 +158,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
163
158
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
164
159
  * @returns
165
160
  */
166
- appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
161
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => void;
167
162
  };
168
163
  screen: {
169
164
  /**
@@ -172,7 +167,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
172
167
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
173
168
  * @returns
174
169
  */
175
- authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
170
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => void;
176
171
  };
177
172
  };
178
173
  export declare type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AnalyticsHandler } from '../../utils/types';
3
2
  export declare function useSmartLink(id: string, url: string, dispatchAnalytics: AnalyticsHandler): {
4
3
  state: import("@atlaskit/linking-common").CardState;
@@ -12,29 +11,29 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
12
11
  config: (import("@atlaskit/link-provider").CardProviderCacheOpts & import("@atlaskit/link-provider").CardAuthFlowOpts) | undefined;
13
12
  analytics: {
14
13
  ui: {
15
- authEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
16
- authAlternateAccountEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
17
- cardClickedEvent: (id: string | undefined, display: import("../../view/Card/types").CardInnerAppearance, status: import("@atlaskit/linking-common/types").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined, actionSubjectId?: string | undefined) => void;
18
- actionClickedEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, invokeType: import("../../model/invoke-opts").InvokeType) => void;
19
- hoverCardOpenLinkClickedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined) => void;
20
- closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
21
- renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, status: import("@atlaskit/linking-common/types").CardType, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
22
- renderFailedEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string | undefined, error: Error, errorInfo: import("react").ErrorInfo) => void;
23
- hoverCardViewedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
24
- hoverCardDismissedEvent: (previewDisplay: import("../../view/HoverCard/types").PreviewDisplay, hoverTime: number, previewInvokeMethod?: import("../../view/HoverCard/types").PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
14
+ authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthEventProps) => void;
15
+ authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiAuthAlternateAccountEventProps) => void;
16
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../utils/analytics/types").UiCardClickedEventProps) => void;
17
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiActionClickedEventProps) => void;
18
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
19
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiClosedAuthEventProps) => void;
20
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
21
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
22
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
23
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
25
24
  };
26
25
  operational: {
27
- invokeSucceededEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: import("../../view/Card/types").CardInnerAppearance) => void;
28
- invokeFailedEvent: (id: string | undefined, providerKey: string | undefined, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, reason: string) => void;
29
- connectSucceededEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
30
- connectFailedEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => void;
31
- instrument: (id: string | undefined, status: import("@atlaskit/linking-common/types").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: import("@atlaskit/linking-common").APIError | undefined) => void;
26
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
27
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeFailedEventProps) => void;
28
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectSucceededEventProps) => void;
29
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectFailedEventProps) => void;
30
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../utils/analytics/types").InstrumentEventProps) => void;
32
31
  };
33
32
  track: {
34
- appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
33
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
35
34
  };
36
35
  screen: {
37
- authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
36
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
38
37
  };
39
38
  };
40
39
  renderers: import("@atlaskit/link-provider").CardProviderRenderers | undefined;
@@ -1,9 +1,7 @@
1
1
  import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
- import { APIError, CardType } from '@atlaskit/linking-common';
3
2
  import { AnalyticsPayload } from '../types';
4
- import { ErrorInfo } from 'react';
5
3
  import { CardInnerAppearance } from '../../view/Card/types';
6
- import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
4
+ import { ConnectFailedEventProps, ConnectSucceededEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ResolvedEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UnresolvedEventProps } from './types';
7
5
  export declare const ANALYTICS_CHANNEL = "media";
8
6
  export declare const context: {
9
7
  componentName: string;
@@ -14,21 +12,21 @@ export declare class SmartLinkEvents {
14
12
  insertSmartLink(url: string, type: CardInnerAppearance, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
15
13
  }
16
14
  export declare const fireSmartLinkEvent: (payload: AnalyticsPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined) => void;
17
- export declare const resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => AnalyticsPayload;
18
- export declare const unresolvedEvent: (id: string, status: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => AnalyticsPayload;
19
- export declare const invokeSucceededEvent: (id: string, actionType: string, display: CardInnerAppearance, extensionKey?: string | undefined) => AnalyticsPayload;
20
- export declare const invokeFailedEvent: (id: string, actionType: string, display: CardInnerAppearance, reason: string, extensionKey?: string | undefined) => AnalyticsPayload;
21
- export declare const connectSucceededEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
22
- export declare const connectFailedEvent: (definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => AnalyticsPayload;
23
- export declare const trackAppAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
24
- export declare const uiAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
25
- export declare const uiAuthAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
26
- export declare const uiCardClickedEvent: (id: string, display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, isModifierKeyPressed?: boolean | undefined, location?: string | undefined, destinationProduct?: string | undefined, destinationSubproduct?: string | undefined, actionSubjectId?: string | undefined) => AnalyticsPayload;
27
- export declare const uiActionClickedEvent: (id: string, actionType: string, extensionKey?: string | undefined, display?: CardInnerAppearance | undefined) => AnalyticsPayload;
28
- export declare const uiClosedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
29
- export declare const screenAuthPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
30
- export declare const uiRenderSuccessEvent: (display: CardInnerAppearance, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
31
- export declare const uiRenderFailedEvent: (display: CardInnerAppearance, error: Error, errorInfo: ErrorInfo) => AnalyticsPayload;
32
- export declare const uiHoverCardViewedEvent: (id: string, previewDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
33
- export declare const uiHoverCardDismissedEvent: (id: string, previewDisplay: PreviewDisplay, hoverTime: number, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
34
- export declare const uiHoverCardOpenLinkClickedEvent: (id: string, previewDisplay: string, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => AnalyticsPayload;
15
+ export declare const resolvedEvent: (props: ResolvedEventProps) => AnalyticsPayload;
16
+ export declare const unresolvedEvent: ({ id, definitionId, extensionKey, resourceType, destinationSubproduct, destinationProduct, error, status, location, }: UnresolvedEventProps) => AnalyticsPayload;
17
+ export declare const invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => AnalyticsPayload;
18
+ export declare const invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => AnalyticsPayload;
19
+ export declare const connectSucceededEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: ConnectSucceededEventProps) => AnalyticsPayload;
20
+ export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
21
+ export declare const trackAppAccountConnected: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
22
+ export declare const uiAuthEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, display, }: UiAuthEventProps) => AnalyticsPayload;
23
+ export declare const uiAuthAlternateAccountEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, display, }: UiAuthAlternateAccountEventProps) => AnalyticsPayload;
24
+ export declare const uiCardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: UiCardClickedEventProps) => AnalyticsPayload;
25
+ export declare const uiActionClickedEvent: ({ id, actionType, extensionKey, display, definitionId, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => AnalyticsPayload;
26
+ export declare const uiClosedAuthEvent: ({ display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => AnalyticsPayload;
27
+ export declare const screenAuthPopupEvent: ({ extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => AnalyticsPayload;
28
+ export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => AnalyticsPayload;
29
+ export declare const uiRenderFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
30
+ export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardViewedEventProps) => AnalyticsPayload;
31
+ export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
32
+ export declare const uiHoverCardOpenLinkClickedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardOpenLinkClickedEventProps) => AnalyticsPayload;
@@ -1,4 +1,4 @@
1
- import { APIError, CardType } from '@atlaskit/linking-common';
2
1
  import { AnalyticsPayload } from '../types';
2
+ import { InstrumentEventProps } from './types';
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 declare const instrumentEvent: (id: string, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => AnalyticsPayload | undefined;
4
+ export declare const instrumentEvent: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: InstrumentEventProps) => AnalyticsPayload | undefined;
@@ -1,2 +1,93 @@
1
+ import { APIError, CardType } from '@atlaskit/linking-common';
2
+ import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
3
+ import { ErrorInfo } from 'react';
4
+ import { CardInnerAppearance } from '../../view/Card/types';
5
+ import { InvokeType } from '../../model/invoke-opts';
1
6
  export declare type DestinationProduct = 'jira' | 'confluence' | 'bitbucket' | 'trello';
2
7
  export declare type DestinationSubproduct = 'core' | 'software' | 'servicedesk';
8
+ export interface CommonEventProps {
9
+ id?: string;
10
+ definitionId?: string;
11
+ extensionKey?: string;
12
+ resourceType?: string;
13
+ destinationSubproduct?: DestinationSubproduct | string;
14
+ destinationProduct?: DestinationProduct | string;
15
+ location?: string;
16
+ }
17
+ export declare type ResolvedEventProps = CommonEventProps & {
18
+ id: string;
19
+ };
20
+ export declare type UnresolvedEventProps = CommonEventProps & {
21
+ id: string;
22
+ status: string;
23
+ error?: APIError;
24
+ };
25
+ export declare type InvokeSucceededEventProps = CommonEventProps & {
26
+ id: string;
27
+ actionType: string;
28
+ display: CardInnerAppearance;
29
+ };
30
+ export declare type InvokeFailedEventProps = CommonEventProps & {
31
+ id: string;
32
+ actionType: string;
33
+ display: CardInnerAppearance;
34
+ reason: string;
35
+ };
36
+ export declare type ConnectSucceededEventProps = CommonEventProps & {
37
+ id?: string;
38
+ };
39
+ export declare type ConnectFailedEventProps = CommonEventProps & {
40
+ id?: string;
41
+ reason?: string;
42
+ };
43
+ export declare type TrackAppAccountConnectedProps = CommonEventProps;
44
+ export declare type UiAuthEventProps = CommonEventProps & {
45
+ display: CardInnerAppearance;
46
+ };
47
+ export declare type UiAuthAlternateAccountEventProps = CommonEventProps & {
48
+ display: CardInnerAppearance;
49
+ };
50
+ export declare type UiCardClickedEventProps = CommonEventProps & {
51
+ id: string;
52
+ display: CardInnerAppearance;
53
+ status: CardType;
54
+ isModifierKeyPressed?: boolean;
55
+ actionSubjectId?: string;
56
+ };
57
+ export declare type UiActionClickedEventProps = CommonEventProps & {
58
+ id: string;
59
+ display: CardInnerAppearance;
60
+ actionType: string;
61
+ invokeType?: InvokeType;
62
+ };
63
+ export declare type ScreenAuthPopupEventProps = CommonEventProps;
64
+ export declare type UiClosedAuthEventProps = CommonEventProps & {
65
+ display: CardInnerAppearance;
66
+ };
67
+ export declare type UiRenderSuccessEventProps = CommonEventProps & {
68
+ display: CardInnerAppearance;
69
+ status: CardType;
70
+ };
71
+ export declare type UiRenderFailedEventProps = CommonEventProps & {
72
+ display: CardInnerAppearance;
73
+ error: Error;
74
+ errorInfo: ErrorInfo;
75
+ };
76
+ export declare type UiHoverCardViewedEventProps = CommonEventProps & {
77
+ previewDisplay: PreviewDisplay;
78
+ previewInvokeMethod?: PreviewInvokeMethod;
79
+ };
80
+ export declare type UiHoverCardDismissedEventProps = CommonEventProps & {
81
+ previewDisplay: PreviewDisplay;
82
+ hoverTime: number;
83
+ previewInvokeMethod?: PreviewInvokeMethod;
84
+ };
85
+ export declare type UiHoverCardOpenLinkClickedEventProps = CommonEventProps & {
86
+ previewDisplay: PreviewDisplay;
87
+ previewInvokeMethod?: PreviewInvokeMethod;
88
+ };
89
+ export declare type InstrumentEventProps = CommonEventProps & {
90
+ error?: APIError;
91
+ status: CardType;
92
+ id: string;
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "21.3.0",
3
+ "version": "22.0.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"