@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
package/report.api.md CHANGED
@@ -29,6 +29,7 @@ import { SmartCardProvider as Provider } from '@atlaskit/link-provider';
29
29
  import { ProviderProps } from '@atlaskit/link-provider';
30
30
  import { default as React_2 } from 'react';
31
31
  import { ReactChild } from 'react';
32
+ import { Ref } from 'react';
32
33
  import { SerializedStyles } from '@emotion/core';
33
34
  import { SmartCardContext } from '@atlaskit/link-provider';
34
35
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
@@ -114,12 +115,16 @@ export declare type AnalyticsActionSubject =
114
115
  | 'applicationAccount'
115
116
  | 'button'
116
117
  | 'consentModal'
117
- | 'hoverCard';
118
+ | 'hoverCard'
119
+ | 'modal'
120
+ | 'embedPreviewModal';
118
121
 
119
122
  declare type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
120
123
 
121
124
  export declare type AnalyticsHandler = (event: AnalyticsPayload) => void;
122
125
 
126
+ declare type AnalyticsName = 'embedPreviewModal';
127
+
123
128
  export declare type AnalyticsPayload = GasPayload & {
124
129
  action?: AnalyticsAction;
125
130
  actionSubject: AnalyticsActionSubject;
@@ -237,6 +242,20 @@ declare type BlockProps = {
237
242
  * serving as a hook for automated tests
238
243
  */
239
244
  testId?: string;
245
+ /**
246
+ * Ref to block wrapper div.
247
+ */
248
+ blockRef?: Ref<HTMLDivElement>;
249
+ /**
250
+ * Function to be called on render of block.
251
+ * @internal
252
+ */
253
+ onRender?: () => void;
254
+ /**
255
+ * Function to be called on transition end of block.
256
+ * @internal
257
+ */
258
+ onTransitionEnd?: () => void;
240
259
  };
241
260
 
242
261
  export declare const Card: React_2.ForwardRefExoticComponent<
@@ -263,8 +282,8 @@ export declare const Card: React_2.ForwardRefExoticComponent<
263
282
  | 'key'
264
283
  | 'url'
265
284
  | 'ui'
266
- | 'showHoverPreview'
267
285
  | 'showActions'
286
+ | 'showHoverPreview'
268
287
  | 'onResolve'
269
288
  | 'platform'
270
289
  | 'isFrameVisible'
@@ -333,6 +352,25 @@ declare type CommentCount = {
333
352
  name: ElementName.CommentCount;
334
353
  };
335
354
 
355
+ declare interface CommonEventProps {
356
+ id?: string;
357
+ definitionId?: string;
358
+ extensionKey?: string;
359
+ resourceType?: string;
360
+ destinationSubproduct?: DestinationSubproduct | string;
361
+ destinationProduct?: DestinationProduct | string;
362
+ location?: string;
363
+ }
364
+
365
+ declare type ConnectFailedEventProps = CommonEventProps & {
366
+ id?: string;
367
+ reason?: string;
368
+ };
369
+
370
+ declare type ConnectSucceededEventProps = CommonEventProps & {
371
+ id?: string;
372
+ };
373
+
336
374
  export declare const contentFooterClassName = 'smart-link-content-footer';
337
375
 
338
376
  /**
@@ -554,6 +592,25 @@ declare type InlinePreloaderStyle =
554
592
  | 'on-left-with-skeleton'
555
593
  | 'on-right-without-skeleton';
556
594
 
595
+ declare type InstrumentEventProps = CommonEventProps & {
596
+ error?: APIError;
597
+ status: CardType;
598
+ id: string;
599
+ };
600
+
601
+ declare type InvokeFailedEventProps = CommonEventProps & {
602
+ id: string;
603
+ actionType: string;
604
+ display: CardInnerAppearance;
605
+ reason: string;
606
+ };
607
+
608
+ declare type InvokeSucceededEventProps = CommonEventProps & {
609
+ id: string;
610
+ actionType: string;
611
+ display: CardInnerAppearance;
612
+ };
613
+
557
614
  declare type InvokeType = 'server' | 'client';
558
615
 
559
616
  /**
@@ -672,7 +729,13 @@ declare type Preview = {
672
729
  */
673
730
  export declare const PreviewBlock: React_2.FC<PreviewBlockProps>;
674
731
 
675
- declare type PreviewBlockProps = BlockProps;
732
+ declare type PreviewBlockProps = {
733
+ /**
734
+ * Function to be called on error loading media.
735
+ * @internal
736
+ */
737
+ onError?: () => void;
738
+ } & BlockProps;
676
739
 
677
740
  declare type PreviewDisplay = 'card' | 'embed';
678
741
 
@@ -739,6 +802,8 @@ declare type RetryOptions = {
739
802
  values?: Record<string, string>;
740
803
  };
741
804
 
805
+ declare type ScreenAuthPopupEventProps = CommonEventProps;
806
+
742
807
  export { SmartCardContext as Context };
743
808
  export { SmartCardContext };
744
809
 
@@ -962,6 +1027,62 @@ declare type TitleBlockProps = {
962
1027
  theme?: SmartLinkTheme;
963
1028
  } & BlockProps;
964
1029
 
1030
+ declare type TrackAppAccountConnectedProps = CommonEventProps;
1031
+
1032
+ declare type UiActionClickedEventProps = CommonEventProps & {
1033
+ id: string;
1034
+ display: CardInnerAppearance;
1035
+ actionType: string;
1036
+ invokeType?: InvokeType;
1037
+ };
1038
+
1039
+ declare type UiAuthAlternateAccountEventProps = CommonEventProps & {
1040
+ display: CardInnerAppearance;
1041
+ };
1042
+
1043
+ declare type UiAuthEventProps = CommonEventProps & {
1044
+ display: CardInnerAppearance;
1045
+ };
1046
+
1047
+ declare type UiCardClickedEventProps = CommonEventProps & {
1048
+ id: string;
1049
+ display: CardInnerAppearance;
1050
+ status: CardType;
1051
+ isModifierKeyPressed?: boolean;
1052
+ actionSubjectId?: string;
1053
+ };
1054
+
1055
+ declare type UiClosedAuthEventProps = CommonEventProps & {
1056
+ display: CardInnerAppearance;
1057
+ };
1058
+
1059
+ declare type UiHoverCardDismissedEventProps = CommonEventProps & {
1060
+ previewDisplay: PreviewDisplay;
1061
+ hoverTime: number;
1062
+ previewInvokeMethod?: PreviewInvokeMethod;
1063
+ };
1064
+
1065
+ declare type UiHoverCardOpenLinkClickedEventProps = CommonEventProps & {
1066
+ previewDisplay: PreviewDisplay;
1067
+ previewInvokeMethod?: PreviewInvokeMethod;
1068
+ };
1069
+
1070
+ declare type UiHoverCardViewedEventProps = CommonEventProps & {
1071
+ previewDisplay: PreviewDisplay;
1072
+ previewInvokeMethod?: PreviewInvokeMethod;
1073
+ };
1074
+
1075
+ declare type UiRenderFailedEventProps = CommonEventProps & {
1076
+ display: CardInnerAppearance;
1077
+ error: Error;
1078
+ errorInfo: ErrorInfo;
1079
+ };
1080
+
1081
+ declare type UiRenderSuccessEventProps = CommonEventProps & {
1082
+ display: CardInnerAppearance;
1083
+ status: CardType;
1084
+ };
1085
+
965
1086
  /**
966
1087
  * This hook provides usage of Smart Link analytics outside of the Card component.
967
1088
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
@@ -986,11 +1107,15 @@ export declare const useSmartLinkAnalytics: (
986
1107
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
987
1108
  * @returns
988
1109
  */
989
- authEvent: (
990
- display: CardInnerAppearance,
991
- definitionId?: string | undefined,
992
- extensionKey?: string | undefined,
993
- ) => void;
1110
+ authEvent: ({
1111
+ display,
1112
+ extensionKey,
1113
+ definitionId,
1114
+ resourceType,
1115
+ destinationProduct,
1116
+ destinationSubproduct,
1117
+ location,
1118
+ }: UiAuthEventProps) => void;
994
1119
  /**
995
1120
  * This fires an event that represents when a user clicks on the authentication
996
1121
  * call to action with a forbidden authenticated account. (i.e. Try another account).
@@ -999,10 +1124,24 @@ export declare const useSmartLinkAnalytics: (
999
1124
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1000
1125
  * @returns
1001
1126
  */
1002
- authAlternateAccountEvent: (
1003
- display: CardInnerAppearance,
1004
- definitionId?: string | undefined,
1005
- extensionKey?: string | undefined,
1127
+ authAlternateAccountEvent: ({
1128
+ display,
1129
+ extensionKey,
1130
+ definitionId,
1131
+ resourceType,
1132
+ destinationProduct,
1133
+ destinationSubproduct,
1134
+ location,
1135
+ }: UiAuthAlternateAccountEventProps) => void;
1136
+ /**
1137
+ * This fires an event that represents when a user
1138
+ * click a button.
1139
+ * @param data A partial analytics event payload
1140
+ */
1141
+ buttonClickedEvent: (
1142
+ data: Partial<AnalyticsPayload> & {
1143
+ actionSubjectId: Required<string>;
1144
+ },
1006
1145
  ) => void;
1007
1146
  /**
1008
1147
  * This fires an event that represents when a user clicks on a Smart Link.
@@ -1016,18 +1155,18 @@ export declare const useSmartLinkAnalytics: (
1016
1155
  * @param destinationProduct The product the Smart Link is linked to.
1017
1156
  * @returns
1018
1157
  */
1019
- cardClickedEvent: (
1020
- id: string | undefined,
1021
- display: CardInnerAppearance,
1022
- status: CardType,
1023
- definitionId?: string | undefined,
1024
- extensionKey?: string | undefined,
1025
- isModifierKeyPressed?: boolean | undefined,
1026
- location?: string | undefined,
1027
- destinationProduct?: DestinationProduct | string | undefined,
1028
- destinationSubproduct?: DestinationSubproduct | string | undefined,
1029
- actionSubjectId?: string | undefined,
1030
- ) => void;
1158
+ cardClickedEvent: ({
1159
+ id,
1160
+ display,
1161
+ status,
1162
+ definitionId,
1163
+ extensionKey,
1164
+ isModifierKeyPressed,
1165
+ location,
1166
+ destinationProduct,
1167
+ destinationSubproduct,
1168
+ actionSubjectId,
1169
+ }: UiCardClickedEventProps) => void;
1031
1170
  /**
1032
1171
  * This fires an event that represents when a user clicks on a Smart Link action.
1033
1172
  * Note: This also starts the UFO smart-link-action-invocation experience.
@@ -1038,13 +1177,18 @@ export declare const useSmartLinkAnalytics: (
1038
1177
  * @param invokeType Whether the action invoked made a call to a server.
1039
1178
  * @returns
1040
1179
  */
1041
- actionClickedEvent: (
1042
- id: string | undefined,
1043
- extensionKey: string | undefined,
1044
- actionType: string,
1045
- display: CardInnerAppearance,
1046
- invokeType: InvokeType,
1047
- ) => void;
1180
+ actionClickedEvent: ({
1181
+ id,
1182
+ actionType,
1183
+ display,
1184
+ invokeType,
1185
+ extensionKey,
1186
+ definitionId,
1187
+ resourceType,
1188
+ destinationProduct,
1189
+ destinationSubproduct,
1190
+ location,
1191
+ }: UiActionClickedEventProps) => void;
1048
1192
  /**
1049
1193
  * This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
1050
1194
  * https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
@@ -1053,12 +1197,15 @@ export declare const useSmartLinkAnalytics: (
1053
1197
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1054
1198
  * @param previewInvokeMethod How the preview was triggered.
1055
1199
  */
1056
- hoverCardOpenLinkClickedEvent: (
1057
- previewDisplay: PreviewDisplay,
1058
- definitionId?: string | undefined,
1059
- extensionKey?: string | undefined,
1060
- previewInvokeMethod?: PreviewInvokeMethod | undefined,
1061
- ) => void;
1200
+ hoverCardOpenLinkClickedEvent: ({
1201
+ previewDisplay,
1202
+ definitionId,
1203
+ extensionKey,
1204
+ destinationProduct,
1205
+ destinationSubproduct,
1206
+ location,
1207
+ previewInvokeMethod,
1208
+ }: UiHoverCardOpenLinkClickedEventProps) => void;
1062
1209
  /**
1063
1210
  * This fires an event that represents when a user closed the authentication window without authenticating after opening it.
1064
1211
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1066,10 +1213,23 @@ export declare const useSmartLinkAnalytics: (
1066
1213
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1067
1214
  * @returns
1068
1215
  */
1069
- closedAuthEvent: (
1070
- display: CardInnerAppearance,
1071
- definitionId?: string | undefined,
1072
- extensionKey?: string | undefined,
1216
+ closedAuthEvent: ({
1217
+ display,
1218
+ extensionKey,
1219
+ definitionId,
1220
+ resourceType,
1221
+ destinationProduct,
1222
+ destinationSubproduct,
1223
+ location,
1224
+ }: UiClosedAuthEventProps) => void;
1225
+ /**
1226
+ * This fires an event that represents when a user close a modal.
1227
+ * @param data A partial analytics event payload
1228
+ */
1229
+ modalClosedEvent: (
1230
+ data: Partial<AnalyticsPayload> & {
1231
+ actionSubjectId: Required<string>;
1232
+ },
1073
1233
  ) => void;
1074
1234
  /**
1075
1235
  * This fires an event that represents when a Smart Link was rendered successfully.
@@ -1079,13 +1239,17 @@ export declare const useSmartLinkAnalytics: (
1079
1239
  * @param definitionId The definitionId of the Smart Link resolver invoked.
1080
1240
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1081
1241
  */
1082
- renderSuccessEvent: (
1083
- display: CardInnerAppearance,
1084
- status: CardType,
1085
- id?: string,
1086
- definitionId?: string | undefined,
1087
- extensionKey?: string | undefined,
1088
- ) => void;
1242
+ renderSuccessEvent: ({
1243
+ display,
1244
+ status,
1245
+ id,
1246
+ extensionKey,
1247
+ definitionId,
1248
+ resourceType,
1249
+ destinationProduct,
1250
+ destinationSubproduct,
1251
+ location,
1252
+ }: UiRenderSuccessEventProps) => void;
1089
1253
  /**
1090
1254
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
1091
1255
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1093,12 +1257,18 @@ export declare const useSmartLinkAnalytics: (
1093
1257
  * @param error: An error representing why the Smart Link render failed.
1094
1258
  * @param errorInfo: Additional details about the error including the stack trace.
1095
1259
  */
1096
- renderFailedEvent: (
1097
- display: CardInnerAppearance,
1098
- id: string | undefined,
1099
- error: Error,
1100
- errorInfo: ErrorInfo,
1101
- ) => void;
1260
+ renderFailedEvent: ({
1261
+ display,
1262
+ id,
1263
+ error,
1264
+ errorInfo,
1265
+ extensionKey,
1266
+ definitionId,
1267
+ resourceType,
1268
+ destinationProduct,
1269
+ destinationSubproduct,
1270
+ location,
1271
+ }: UiRenderFailedEventProps) => void;
1102
1272
  /**
1103
1273
  * This fires an event that represents a hover preview being opened.
1104
1274
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -1107,13 +1277,17 @@ export declare const useSmartLinkAnalytics: (
1107
1277
  * @param previewInvokeMethod How the preview was triggered.
1108
1278
  * @returns
1109
1279
  */
1110
- hoverCardViewedEvent: (
1111
- previewDisplay: PreviewDisplay,
1112
- previewInvokeMethod?: PreviewInvokeMethod | undefined,
1113
- id?: string,
1114
- definitionId?: string | undefined,
1115
- extensionKey?: string | undefined,
1116
- ) => void;
1280
+ hoverCardViewedEvent: ({
1281
+ previewDisplay,
1282
+ previewInvokeMethod,
1283
+ id,
1284
+ extensionKey,
1285
+ definitionId,
1286
+ resourceType,
1287
+ destinationProduct,
1288
+ destinationSubproduct,
1289
+ location,
1290
+ }: UiHoverCardViewedEventProps) => void;
1117
1291
  /**
1118
1292
  * This fires an event that represents a hover preview being dismissed.
1119
1293
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -1123,14 +1297,18 @@ export declare const useSmartLinkAnalytics: (
1123
1297
  * @param previewInvokeMethod How the preview was triggered.
1124
1298
  * @returns
1125
1299
  */
1126
- hoverCardDismissedEvent: (
1127
- previewDisplay: PreviewDisplay,
1128
- hoverTime: number,
1129
- previewInvokeMethod?: PreviewInvokeMethod | undefined,
1130
- id?: string,
1131
- definitionId?: string | undefined,
1132
- extensionKey?: string | undefined,
1133
- ) => void;
1300
+ hoverCardDismissedEvent: ({
1301
+ id,
1302
+ previewDisplay,
1303
+ hoverTime,
1304
+ previewInvokeMethod,
1305
+ extensionKey,
1306
+ definitionId,
1307
+ resourceType,
1308
+ destinationProduct,
1309
+ destinationSubproduct,
1310
+ location,
1311
+ }: UiHoverCardDismissedEventProps) => void;
1134
1312
  };
1135
1313
  operational: {
1136
1314
  /**
@@ -1140,12 +1318,17 @@ export declare const useSmartLinkAnalytics: (
1140
1318
  * @param actionType The type of action invoked, e.g. PreviewAction
1141
1319
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1142
1320
  */
1143
- invokeSucceededEvent: (
1144
- id: string | undefined,
1145
- extensionKey: string | undefined,
1146
- actionType: string,
1147
- display: CardInnerAppearance,
1148
- ) => void;
1321
+ invokeSucceededEvent: ({
1322
+ id,
1323
+ actionType,
1324
+ display,
1325
+ extensionKey,
1326
+ definitionId,
1327
+ resourceType,
1328
+ destinationProduct,
1329
+ destinationSubproduct,
1330
+ location,
1331
+ }: InvokeSucceededEventProps) => void;
1149
1332
  /**
1150
1333
  * This fires an event that represents an action being unsuccessfully invoked.
1151
1334
  * @param id The unique ID for this Smart Link.
@@ -1154,24 +1337,33 @@ export declare const useSmartLinkAnalytics: (
1154
1337
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
1155
1338
  * @param reason The reason the invocation failed.
1156
1339
  */
1157
- invokeFailedEvent: (
1158
- id: string | undefined,
1159
- providerKey: string | undefined,
1160
- actionType: string,
1161
- display: CardInnerAppearance,
1162
- reason: string,
1163
- ) => void;
1340
+ invokeFailedEvent: ({
1341
+ id,
1342
+ actionType,
1343
+ display,
1344
+ reason,
1345
+ extensionKey,
1346
+ definitionId,
1347
+ resourceType,
1348
+ destinationProduct,
1349
+ destinationSubproduct,
1350
+ location,
1351
+ }: InvokeFailedEventProps) => void;
1164
1352
  /**
1165
1353
  * This fires an event that represents an account successfully being connected via a Smart Link.
1166
1354
  * @param id The unique ID for this Smart Link.
1167
1355
  * @param definitionId The definitionId of the Smart Link resolver invoked.
1168
1356
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1169
1357
  */
1170
- connectSucceededEvent: (
1171
- id?: string,
1172
- definitionId?: string | undefined,
1173
- extensionKey?: string | undefined,
1174
- ) => void;
1358
+ connectSucceededEvent: ({
1359
+ id,
1360
+ extensionKey,
1361
+ definitionId,
1362
+ resourceType,
1363
+ destinationProduct,
1364
+ destinationSubproduct,
1365
+ location,
1366
+ }: ConnectSucceededEventProps) => void;
1175
1367
  /**
1176
1368
  * This fires an event that represents an account unsuccessfully being connected.
1177
1369
  * @param id The unique ID for this Smart Link.
@@ -1179,12 +1371,16 @@ export declare const useSmartLinkAnalytics: (
1179
1371
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1180
1372
  * @param reason The reason why the Smart Link connect account failed.
1181
1373
  */
1182
- connectFailedEvent: (
1183
- id?: string,
1184
- definitionId?: string | undefined,
1185
- extensionKey?: string | undefined,
1186
- reason?: string | undefined,
1187
- ) => void;
1374
+ connectFailedEvent: ({
1375
+ id,
1376
+ reason,
1377
+ extensionKey,
1378
+ definitionId,
1379
+ resourceType,
1380
+ destinationProduct,
1381
+ destinationSubproduct,
1382
+ location,
1383
+ }: ConnectFailedEventProps) => void;
1188
1384
  /**
1189
1385
  * This fires an event which represents a Smart Link request succeeding or failing based on the status.
1190
1386
  * @param id The unique ID for this Smart Link.
@@ -1194,14 +1390,17 @@ export declare const useSmartLinkAnalytics: (
1194
1390
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
1195
1391
  * @param error An error representing why the Smart Link request failed.
1196
1392
  */
1197
- instrument: (
1198
- id: string | undefined,
1199
- status: CardType,
1200
- definitionId?: string | undefined,
1201
- extensionKey?: string | undefined,
1202
- resourceType?: string | undefined,
1203
- error?: APIError | undefined,
1204
- ) => void;
1393
+ instrument: ({
1394
+ id,
1395
+ status,
1396
+ extensionKey,
1397
+ definitionId,
1398
+ resourceType,
1399
+ destinationProduct,
1400
+ destinationSubproduct,
1401
+ location,
1402
+ error,
1403
+ }: InstrumentEventProps) => void;
1205
1404
  };
1206
1405
  track: {
1207
1406
  /**
@@ -1210,10 +1409,14 @@ export declare const useSmartLinkAnalytics: (
1210
1409
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1211
1410
  * @returns
1212
1411
  */
1213
- appAccountConnected: (
1214
- definitionId?: string | undefined,
1215
- extensionKey?: string | undefined,
1216
- ) => void;
1412
+ appAccountConnected: ({
1413
+ extensionKey,
1414
+ definitionId,
1415
+ resourceType,
1416
+ destinationProduct,
1417
+ destinationSubproduct,
1418
+ location,
1419
+ }: TrackAppAccountConnectedProps) => void;
1217
1420
  };
1218
1421
  screen: {
1219
1422
  /**
@@ -1222,9 +1425,22 @@ export declare const useSmartLinkAnalytics: (
1222
1425
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
1223
1426
  * @returns
1224
1427
  */
1225
- authPopupEvent: (
1226
- definitionId?: string | undefined,
1227
- extensionKey?: string | undefined,
1428
+ authPopupEvent: ({
1429
+ extensionKey,
1430
+ definitionId,
1431
+ resourceType,
1432
+ destinationProduct,
1433
+ destinationSubproduct,
1434
+ location,
1435
+ }: ScreenAuthPopupEventProps) => void;
1436
+ /**
1437
+ * This fires an event that represents when a user view a modal.
1438
+ * @param data A partial analytics event payload
1439
+ */
1440
+ modalViewedEvent: (
1441
+ data: Partial<AnalyticsPayload> & {
1442
+ name: Extract<AnalyticsName, 'embedPreviewModal'>;
1443
+ },
1228
1444
  ) => void;
1229
1445
  };
1230
1446
  };