@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
@@ -0,0 +1,53 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ var _templateObject;
5
+
6
+ import React, { useCallback, useState, useRef } from 'react';
7
+ import { css } from '@emotion/core';
8
+ import extractPreview from '../../../extractors/flexible/extract-preview';
9
+ import { PreviewBlock, SnippetBlock } from '../../FlexibleCard/components/blocks';
10
+ import { getTransitionStyles } from '../styled';
11
+
12
+ var SnippetOrPreview = function SnippetOrPreview(_ref) {
13
+ var data = _ref.data,
14
+ snippetHeight = _ref.snippetHeight;
15
+ var transitionStarted = useRef(false);
16
+ var previewBlockRef = useRef(null);
17
+
18
+ var _useState = useState(false),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ showSnippet = _useState2[0],
21
+ setShowSnippet = _useState2[1];
22
+
23
+ var _useState3 = useState(),
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ previewCss = _useState4[0],
26
+ setPreviewCss = _useState4[1]; // Set Preview to a fixed height to enable transitions
27
+
28
+
29
+ var onPreviewRender = useCallback(function () {
30
+ var _previewBlockRef$curr;
31
+
32
+ previewBlockRef.current && setPreviewCss(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n "])), (_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
33
+ }, []); // On error set Preview to Snippet height with transition
34
+
35
+ var onPreviewError = useCallback(function () {
36
+ if (transitionStarted.current === false) {
37
+ setPreviewCss(getTransitionStyles(snippetHeight));
38
+ transitionStarted.current = true;
39
+ }
40
+ }, [snippetHeight]);
41
+ var onPreviewTransitionEnd = useCallback(function () {
42
+ setShowSnippet(true);
43
+ }, []);
44
+ return !showSnippet && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
45
+ onError: onPreviewError,
46
+ overrideCss: previewCss,
47
+ onTransitionEnd: onPreviewTransitionEnd,
48
+ blockRef: previewBlockRef,
49
+ onRender: onPreviewRender
50
+ }) : /*#__PURE__*/React.createElement(SnippetBlock, null);
51
+ };
52
+
53
+ export default SnippetOrPreview;
@@ -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,
@@ -1,6 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
4
4
 
5
5
  import { css } from '@emotion/core';
6
6
  import { loadingPlaceholderClassName } from '../../index';
@@ -23,4 +23,8 @@ export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTe
23
23
  export var metadataBlockCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n gap: 0px;\n\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n"])), separatorCss, elementGap, elementGap);
24
24
  export var footerBlockCss = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: 0.25rem;\n"])));
25
25
  export var loadingViewContainer = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
26
- export var skeletonContainer = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
26
+ export var skeletonContainer = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
27
+ export var hiddenSnippetStyles = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n visibility: hidden;\n position: absolute;\n"])));
28
+ export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
29
+ return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
30
+ };
@@ -25,10 +25,12 @@ manually passed to your custom components.
25
25
 
26
26
  For a complete guide on customization using the new compositional API, refer to the docs at
27
27
  https://atlassian.design/components/modal-dialog/examples#customizing-modal-dialog. */
28
- import React, { useState } from 'react';
29
- import ModalDialog, { ModalTransition, ModalBody } from '@atlaskit/modal-dialog';
28
+ import React, { useCallback, useRef, useState } from 'react';
29
+ import ModalDialog, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
30
30
  import { Header } from './ModalHeader';
31
31
  import { getIframeSandboxAttribute } from '../../utils';
32
+ import withAnalytics from '../EmbedModal/components/analytics';
33
+ import { EmbedModalSize } from '../EmbedModal/types';
32
34
  var iframeStyles = {
33
35
  width: "100%",
34
36
  height: 'calc(100vh - 248px)'
@@ -72,7 +74,8 @@ var Modal = function Modal(_ref) {
72
74
  providerName = _ref.providerName,
73
75
  metadata = _ref.metadata,
74
76
  icon = _ref.icon,
75
- closeLabel = _ref.closeLabel,
77
+ _ref$closeLabel = _ref.closeLabel,
78
+ closeLabel = _ref$closeLabel === void 0 ? 'Close Preview' : _ref$closeLabel,
76
79
  iframeName = _ref.iframeName,
77
80
  title = _ref.title,
78
81
  url = _ref.url,
@@ -88,16 +91,35 @@ var Modal = function Modal(_ref) {
88
91
  isOpen = _useState2[0],
89
92
  setIsOpen = _useState2[1];
90
93
 
94
+ var openAt = useRef();
95
+ var handleOnOpenComplete = useCallback(function () {
96
+ openAt.current = Date.now();
97
+
98
+ if (onOpen) {
99
+ onOpen({
100
+ size: EmbedModalSize.Small
101
+ });
102
+ }
103
+ }, [onOpen]);
104
+ var handleOnCloseComplete = useCallback(function () {
105
+ if (onClose) {
106
+ var duration = openAt.current ? Date.now() - openAt.current : undefined;
107
+ onClose({
108
+ duration: duration,
109
+ size: EmbedModalSize.Small
110
+ });
111
+ }
112
+ }, [onClose]);
91
113
  var sandbox = getIframeSandboxAttribute(isTrusted);
92
114
  return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
93
115
  height: "100%",
94
116
  width: "large",
95
117
  testId: testId,
96
- onOpenComplete: onOpen,
118
+ onOpenComplete: handleOnOpenComplete,
97
119
  onClose: function onClose() {
98
120
  setIsOpen(false);
99
121
  },
100
- onCloseComplete: onClose
122
+ onCloseComplete: handleOnCloseComplete
101
123
  }, /*#__PURE__*/React.createElement(Header, {
102
124
  providerName: providerName,
103
125
  icon: icon,
@@ -123,4 +145,4 @@ var Modal = function Modal(_ref) {
123
145
  }))));
124
146
  };
125
147
 
126
- export default ModalWithErrorBoundary;
148
+ export default withAnalytics(ModalWithErrorBoundary);
@@ -75,7 +75,7 @@ export var Header = function Header(_ref) {
75
75
  testId: "preview-view-action",
76
76
  iconAfter: jsx(ShortcutIcon, {
77
77
  size: "small",
78
- label: "go to source"
78
+ label: ""
79
79
  }),
80
80
  onClick: onViewActionClick
81
81
  }, providerName ? jsx(F, null, jsx(FormattedMessage, messages.viewIn), " ", providerName) : jsx(FormattedMessage, messages.viewOriginal)), jsx(Button, {
@@ -83,6 +83,7 @@ export var Header = function Header(_ref) {
83
83
  iconBefore: jsx(EditorCloseIcon, {
84
84
  label: label
85
85
  }),
86
- onClick: onClose
86
+ onClick: onClose,
87
+ testId: "preview-close-button"
87
88
  }))));
88
89
  };
@@ -1,10 +1,12 @@
1
1
  import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
2
2
  import { InvokeHandler } from '../../model/invoke-handler';
3
- import { AnalyticsHandler } from '../../utils/types';
3
+ import { AnalyticsFacade } from '../../state/analytics';
4
4
  import { CardInnerAppearance } from '../../view/Card/types';
5
+ import { AnalyticsOrigin } from '../../utils/types';
5
6
  export interface ExtractBlockOpts {
6
7
  handleInvoke: InvokeHandler;
7
- handleAnalytics: AnalyticsHandler;
8
+ analytics: AnalyticsFacade;
9
+ origin?: AnalyticsOrigin;
8
10
  extensionKey?: string;
9
11
  featureFlags?: Partial<LinkingPlatformFeatureFlags>;
10
12
  source?: CardInnerAppearance;
@@ -1,7 +1,9 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
- import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
3
- import { InvokeHandler } from '../../../model/invoke-handler';
4
- import { CardInnerAppearance } from '../../../view/Card/types';
5
- import { AnalyticsHandler } from '../../../utils/types';
2
+ import { CardPlatform } from '../../../view/Card/types';
6
3
  import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
7
- export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: JsonLd.Primitives.Platforms | undefined, source?: CardInnerAppearance | undefined, featureFlags?: Partial<LinkingPlatformFeatureFlags> | undefined) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
4
+ import { ExtractBlockOpts } from '../../block/types';
5
+ export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, featureFlags, analytics, }: ExtractBlockOpts & {
6
+ viewProps: BlockCardResolvedViewProps;
7
+ jsonLd: JsonLd.Data.BaseData;
8
+ platform?: JsonLd.Primitives.Platforms | undefined;
9
+ }) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
@@ -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
- 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';
1
+ import { AnalyticsHandler, AnalyticsName, AnalyticsPayload } from '../../utils/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,15 @@ 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;
32
+ /**
33
+ * This fires an event that represents when a user
34
+ * click a button.
35
+ * @param data A partial analytics event payload
36
+ */
37
+ buttonClickedEvent: (data: Partial<AnalyticsPayload> & {
38
+ actionSubjectId: Required<string>;
39
+ }) => void;
37
40
  /**
38
41
  * This fires an event that represents when a user clicks on a Smart Link.
39
42
  * @param id The unique ID for this Smart Link.
@@ -46,7 +49,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
46
49
  * @param destinationProduct The product the Smart Link is linked to.
47
50
  * @returns
48
51
  */
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;
52
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: UiCardClickedEventProps) => void;
50
53
  /**
51
54
  * This fires an event that represents when a user clicks on a Smart Link action.
52
55
  * Note: This also starts the UFO smart-link-action-invocation experience.
@@ -57,7 +60,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
57
60
  * @param invokeType Whether the action invoked made a call to a server.
58
61
  * @returns
59
62
  */
60
- actionClickedEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: CardInnerAppearance, invokeType: InvokeType) => void;
63
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
61
64
  /**
62
65
  * This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
63
66
  * https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
@@ -66,7 +69,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
66
69
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
67
70
  * @param previewInvokeMethod How the preview was triggered.
68
71
  */
69
- hoverCardOpenLinkClickedEvent: (previewDisplay: PreviewDisplay, definitionId?: string | undefined, extensionKey?: string | undefined, previewInvokeMethod?: PreviewInvokeMethod | undefined) => void;
72
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardOpenLinkClickedEventProps) => void;
70
73
  /**
71
74
  * This fires an event that represents when a user closed the authentication window without authenticating after opening it.
72
75
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -74,7 +77,14 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
74
77
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
75
78
  * @returns
76
79
  */
77
- closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
80
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => void;
81
+ /**
82
+ * This fires an event that represents when a user close a modal.
83
+ * @param data A partial analytics event payload
84
+ */
85
+ modalClosedEvent: (data: Partial<AnalyticsPayload> & {
86
+ actionSubjectId: Required<string>;
87
+ }) => void;
78
88
  /**
79
89
  * This fires an event that represents when a Smart Link was rendered successfully.
80
90
  * Note: this fires even if the Smart Link request errored out.
@@ -83,7 +93,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
83
93
  * @param definitionId The definitionId of the Smart Link resolver invoked.
84
94
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
85
95
  */
86
- renderSuccessEvent: (display: CardInnerAppearance, status: CardType, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
96
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
87
97
  /**
88
98
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
89
99
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -91,7 +101,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
91
101
  * @param error: An error representing why the Smart Link render failed.
92
102
  * @param errorInfo: Additional details about the error including the stack trace.
93
103
  */
94
- renderFailedEvent: (display: CardInnerAppearance, id: string | undefined, error: Error, errorInfo: ErrorInfo) => void;
104
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
95
105
  /**
96
106
  * This fires an event that represents a hover preview being opened.
97
107
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -100,7 +110,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
100
110
  * @param previewInvokeMethod How the preview was triggered.
101
111
  * @returns
102
112
  */
103
- hoverCardViewedEvent: (previewDisplay: PreviewDisplay, previewInvokeMethod?: PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
113
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiHoverCardViewedEventProps) => void;
104
114
  /**
105
115
  * This fires an event that represents a hover preview being dismissed.
106
116
  * @param hoverDisplay Whether the hover preview was displayed as a card or embed.
@@ -110,7 +120,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
110
120
  * @param previewInvokeMethod How the preview was triggered.
111
121
  * @returns
112
122
  */
113
- hoverCardDismissedEvent: (previewDisplay: PreviewDisplay, hoverTime: number, previewInvokeMethod?: PreviewInvokeMethod | undefined, id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
123
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiHoverCardDismissedEventProps) => void;
114
124
  };
115
125
  operational: {
116
126
  /**
@@ -120,7 +130,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
120
130
  * @param actionType The type of action invoked, e.g. PreviewAction
121
131
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
122
132
  */
123
- invokeSucceededEvent: (id: string | undefined, extensionKey: string | undefined, actionType: string, display: CardInnerAppearance) => void;
133
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
124
134
  /**
125
135
  * This fires an event that represents an action being unsuccessfully invoked.
126
136
  * @param id The unique ID for this Smart Link.
@@ -129,14 +139,14 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
129
139
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
130
140
  * @param reason The reason the invocation failed.
131
141
  */
132
- invokeFailedEvent: (id: string | undefined, providerKey: string | undefined, actionType: string, display: CardInnerAppearance, reason: string) => void;
142
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
133
143
  /**
134
144
  * This fires an event that represents an account successfully being connected via a Smart Link.
135
145
  * @param id The unique ID for this Smart Link.
136
146
  * @param definitionId The definitionId of the Smart Link resolver invoked.
137
147
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
138
148
  */
139
- connectSucceededEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
149
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectSucceededEventProps) => void;
140
150
  /**
141
151
  * This fires an event that represents an account unsuccessfully being connected.
142
152
  * @param id The unique ID for this Smart Link.
@@ -144,7 +154,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
144
154
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
145
155
  * @param reason The reason why the Smart Link connect account failed.
146
156
  */
147
- connectFailedEvent: (id?: string, definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => void;
157
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectFailedEventProps) => void;
148
158
  /**
149
159
  * This fires an event which represents a Smart Link request succeeding or failing based on the status.
150
160
  * @param id The unique ID for this Smart Link.
@@ -154,7 +164,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
154
164
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
155
165
  * @param error An error representing why the Smart Link request failed.
156
166
  */
157
- instrument: (id: string | undefined, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => void;
167
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: InstrumentEventProps) => void;
158
168
  };
159
169
  track: {
160
170
  /**
@@ -163,7 +173,7 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
163
173
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
164
174
  * @returns
165
175
  */
166
- appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
176
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => void;
167
177
  };
168
178
  screen: {
169
179
  /**
@@ -172,7 +182,14 @@ export declare const useSmartLinkAnalytics: (url: string, dispatchAnalytics: Ana
172
182
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
173
183
  * @returns
174
184
  */
175
- authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
185
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => void;
186
+ /**
187
+ * This fires an event that represents when a user view a modal.
188
+ * @param data A partial analytics event payload
189
+ */
190
+ modalViewedEvent: (data: Partial<AnalyticsPayload> & {
191
+ name: Extract<AnalyticsName, 'embedPreviewModal'>;
192
+ }) => void;
176
193
  };
177
194
  };
178
195
  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,38 @@ 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
+ buttonClickedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
17
+ actionSubjectId: string;
18
+ }) => void;
19
+ cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../utils/analytics/types").UiCardClickedEventProps) => void;
20
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiActionClickedEventProps) => void;
21
+ hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
22
+ closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiClosedAuthEventProps) => void;
23
+ modalClosedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
24
+ actionSubjectId: string;
25
+ }) => void;
26
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
27
+ renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
28
+ hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
29
+ hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
25
30
  };
26
31
  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;
32
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
33
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeFailedEventProps) => void;
34
+ connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectSucceededEventProps) => void;
35
+ connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").ConnectFailedEventProps) => void;
36
+ instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../utils/analytics/types").InstrumentEventProps) => void;
32
37
  };
33
38
  track: {
34
- appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
39
+ appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
35
40
  };
36
41
  screen: {
37
- authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
42
+ authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").CommonEventProps) => void;
43
+ modalViewedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
44
+ name: "embedPreviewModal";
45
+ }) => void;
38
46
  };
39
47
  };
40
48
  renderers: import("@atlaskit/link-provider").CardProviderRenderers | undefined;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { JsonLd } from 'json-ld-types';
3
- import type { AnalyticsHandler } from '../../utils/types';
3
+ import type { AnalyticsHandler, AnalyticsOrigin } from '../../utils/types';
4
4
  import type { CardInnerAppearance } from '../../view/Card/types';
5
5
  export interface LinkAction {
6
6
  /**
@@ -41,5 +41,9 @@ export interface UseSmartLinkActionsOpts {
41
41
  * @default 'web'
42
42
  */
43
43
  platform?: JsonLd.Primitives.Platforms;
44
+ /**
45
+ * Smart link origin that the action being invoked from.
46
+ */
47
+ origin?: AnalyticsOrigin;
44
48
  }
45
- export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, }: UseSmartLinkActionsOpts): LinkAction[];
49
+ export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, origin, }: UseSmartLinkActionsOpts): LinkAction[];
@@ -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;