@atlaskit/smart-card 32.7.2 → 32.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/analytics.spec.yaml +112 -53
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +26 -9
- package/dist/cjs/view/CardWithUrl/loader.js +21 -7
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +35 -8
- package/dist/cjs/view/HoverCard/index.js +25 -8
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +26 -9
- package/dist/es2019/view/CardWithUrl/loader.js +21 -7
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +33 -9
- package/dist/es2019/view/HoverCard/index.js +26 -8
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +26 -9
- package/dist/esm/view/CardWithUrl/loader.js +21 -7
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +36 -9
- package/dist/esm/view/HoverCard/index.js +25 -8
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +35 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +35 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,10 @@ var _react2 = require("@emotion/react");
|
|
|
9
9
|
var _reactErrorBoundary = require("react-error-boundary");
|
|
10
10
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
11
11
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
|
|
12
14
|
var _constants = require("../../constants");
|
|
15
|
+
var _state = require("../../state");
|
|
13
16
|
var _analytics = require("../../state/analytics");
|
|
14
17
|
var _modal = require("../../state/modal");
|
|
15
18
|
var _HoverCardComponent = require("./components/HoverCardComponent");
|
|
@@ -21,18 +24,32 @@ var _HoverCardComponent = require("./components/HoverCardComponent");
|
|
|
21
24
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
25
|
|
|
23
26
|
var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
27
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
28
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
24
29
|
var url = props.url,
|
|
25
30
|
id = props.id,
|
|
26
31
|
children = props.children;
|
|
27
|
-
var analytics = (0,
|
|
32
|
+
var analytics = (0, _state.useSmartLinkAnalytics)(url, id);
|
|
28
33
|
var onError = (0, _react.useCallback)(function (error, info) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
id
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
if ((0, _platformFeatureFlags.fg)('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
35
|
+
(0, _analytics.startUfoExperience)('smart-link-rendered', id || 'NULL');
|
|
36
|
+
(0, _analytics.failUfoExperience)('smart-link-rendered', id || 'NULL');
|
|
37
|
+
(0, _analytics.failUfoExperience)('smart-link-authenticated', id || 'NULL');
|
|
38
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
39
|
+
display: _constants.CardDisplay.HoverCardPreview,
|
|
40
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
41
|
+
error: error,
|
|
42
|
+
errorInfo: info
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
analytics.ui.renderFailedEvent({
|
|
46
|
+
display: _constants.CardDisplay.HoverCardPreview,
|
|
47
|
+
id: id,
|
|
48
|
+
error: error,
|
|
49
|
+
errorInfo: info
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, [analytics.ui, id, fireEvent]);
|
|
36
53
|
return (0, _react2.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
37
54
|
fallback: children,
|
|
38
55
|
onError: onError
|
|
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
20
20
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
21
21
|
var PACKAGE_DATA = {
|
|
22
22
|
packageName: "@atlaskit/smart-card",
|
|
23
|
-
packageVersion: "32.7.
|
|
23
|
+
packageVersion: "32.7.3",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "32.7.
|
|
7
|
+
packageVersion: "32.7.3"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,6 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
4
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
5
|
import { CardDisplay } from '../../constants';
|
|
6
6
|
import { useSmartLink } from '../../state';
|
|
7
|
+
import { succeedUfoExperience } from '../../state/analytics';
|
|
7
8
|
import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getProduct, getResourceType, getServices, getSubproduct, isFinalState } from '../../state/helpers';
|
|
8
9
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
9
10
|
import { isSpecialEvent } from '../../utils';
|
|
@@ -154,16 +155,32 @@ function Component({
|
|
|
154
155
|
// - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
|
|
155
156
|
useEffect(() => {
|
|
156
157
|
if (isFinalState(state.status)) {
|
|
157
|
-
analytics
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
159
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
160
|
+
extensionKey,
|
|
161
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
165
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
166
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
167
|
+
});
|
|
168
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
169
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
170
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
analytics.ui.renderSuccessEvent({
|
|
174
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
175
|
+
status: state.status,
|
|
176
|
+
id,
|
|
177
|
+
definitionId,
|
|
178
|
+
extensionKey,
|
|
179
|
+
canBeDatasource
|
|
180
|
+
});
|
|
181
|
+
}
|
|
165
182
|
}
|
|
166
|
-
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
|
|
183
|
+
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource, fireEvent]);
|
|
167
184
|
const onIframeDwell = useCallback((dwellTime, dwellPercentVisible) => {
|
|
168
185
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
169
186
|
id,
|
|
@@ -2,8 +2,10 @@ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
|
|
|
2
2
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
6
|
-
import { useSmartLinkAnalytics } from '../../state
|
|
7
|
+
import { useSmartLinkAnalytics } from '../../state';
|
|
8
|
+
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
7
9
|
import { importWithRetry } from '../../utils';
|
|
8
10
|
import { isFlexibleUiCard } from '../../utils/flexible';
|
|
9
11
|
import { clearMarks, clearMeasures } from '../../utils/performance';
|
|
@@ -71,12 +73,24 @@ export function CardWithURLRenderer(props) {
|
|
|
71
73
|
definitionId: null
|
|
72
74
|
});
|
|
73
75
|
} else if (error.name !== 'APIError') {
|
|
74
|
-
analytics
|
|
75
|
-
|
|
76
|
-
id
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
77
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
78
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
79
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
80
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
81
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
82
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
83
|
+
error: error,
|
|
84
|
+
errorInfo: errorInfo
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
analytics.ui.renderFailedEvent({
|
|
88
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
89
|
+
id,
|
|
90
|
+
error,
|
|
91
|
+
errorInfo
|
|
92
|
+
});
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
onError && onError({
|
|
82
96
|
status: 'errored',
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
3
5
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
4
|
-
import {
|
|
6
|
+
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
7
|
+
import { getCanBeDatasource, getDefinitionId } from '../../../../../state/helpers';
|
|
5
8
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
6
9
|
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
10
|
import { getMetadata } from '../../../utils';
|
|
@@ -14,19 +17,40 @@ const HoverCardResolvedView = ({
|
|
|
14
17
|
flexibleCardProps,
|
|
15
18
|
isAISummaryEnabled,
|
|
16
19
|
onActionClick,
|
|
17
|
-
titleBlockProps
|
|
20
|
+
titleBlockProps,
|
|
21
|
+
id
|
|
18
22
|
}) => {
|
|
19
23
|
var _cardState$details;
|
|
20
|
-
const
|
|
24
|
+
const {
|
|
25
|
+
fireEvent
|
|
26
|
+
} = useAnalyticsEvents();
|
|
27
|
+
const definitionId = React.useMemo(() => getDefinitionId(cardState.details), [cardState.details]);
|
|
28
|
+
const canBeDatasource = React.useMemo(() => getCanBeDatasource(cardState.details), [cardState.details]);
|
|
21
29
|
useEffect(() => {
|
|
22
30
|
// Since this hover view is only rendered on resolved status,
|
|
23
31
|
// there is no need to check for statuses.
|
|
24
|
-
analytics
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
33
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
34
|
+
extensionKey,
|
|
35
|
+
display: CardDisplay.HoverCardPreview
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
39
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
40
|
+
display: CardDisplay.HoverCardPreview
|
|
41
|
+
});
|
|
42
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
43
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
44
|
+
display: CardDisplay.HoverCardPreview
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
analytics.ui.renderSuccessEvent({
|
|
48
|
+
display: CardDisplay.HoverCardPreview,
|
|
49
|
+
status: cardState.status,
|
|
50
|
+
canBeDatasource
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, [analytics.ui, cardState.status, canBeDatasource, fireEvent, definitionId, extensionKey, id]);
|
|
30
54
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
31
55
|
const {
|
|
32
56
|
primary,
|
|
@@ -9,11 +9,17 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { di } from 'react-magnetic-di';
|
|
11
11
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
12
14
|
import { CardDisplay } from '../../constants';
|
|
13
|
-
import { useSmartLinkAnalytics } from '../../state
|
|
15
|
+
import { useSmartLinkAnalytics } from '../../state';
|
|
16
|
+
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
14
17
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
15
18
|
import { HoverCardComponent } from './components/HoverCardComponent';
|
|
16
19
|
const HoverCardWithErrorBoundary = props => {
|
|
20
|
+
const {
|
|
21
|
+
fireEvent
|
|
22
|
+
} = useAnalyticsEvents();
|
|
17
23
|
const {
|
|
18
24
|
url,
|
|
19
25
|
id,
|
|
@@ -21,13 +27,25 @@ const HoverCardWithErrorBoundary = props => {
|
|
|
21
27
|
} = props;
|
|
22
28
|
const analytics = useSmartLinkAnalytics(url, id);
|
|
23
29
|
const onError = useCallback((error, info) => {
|
|
24
|
-
analytics
|
|
25
|
-
|
|
26
|
-
id
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
31
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
32
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
33
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
34
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
35
|
+
display: CardDisplay.HoverCardPreview,
|
|
36
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
37
|
+
error: error,
|
|
38
|
+
errorInfo: info
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
analytics.ui.renderFailedEvent({
|
|
42
|
+
display: CardDisplay.HoverCardPreview,
|
|
43
|
+
id,
|
|
44
|
+
error,
|
|
45
|
+
errorInfo: info
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, [analytics.ui, id, fireEvent]);
|
|
31
49
|
return jsx(ErrorBoundary, {
|
|
32
50
|
fallback: children,
|
|
33
51
|
onError: onError
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.3",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -10,7 +10,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
10
10
|
export var context = {
|
|
11
11
|
componentName: 'smart-cards',
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.3"
|
|
14
14
|
};
|
|
15
15
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
16
16
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,6 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
4
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
5
|
import { CardDisplay } from '../../constants';
|
|
6
6
|
import { useSmartLink } from '../../state';
|
|
7
|
+
import { succeedUfoExperience } from '../../state/analytics';
|
|
7
8
|
import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getProduct, getResourceType, getServices, getSubproduct, isFinalState } from '../../state/helpers';
|
|
8
9
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
9
10
|
import { isSpecialEvent } from '../../utils';
|
|
@@ -156,16 +157,32 @@ function Component(_ref) {
|
|
|
156
157
|
// - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
|
|
157
158
|
useEffect(function () {
|
|
158
159
|
if (isFinalState(state.status)) {
|
|
159
|
-
analytics
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
161
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
162
|
+
extensionKey: extensionKey,
|
|
163
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
167
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
168
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
169
|
+
});
|
|
170
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
171
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
172
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
analytics.ui.renderSuccessEvent({
|
|
176
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
177
|
+
status: state.status,
|
|
178
|
+
id: id,
|
|
179
|
+
definitionId: definitionId,
|
|
180
|
+
extensionKey: extensionKey,
|
|
181
|
+
canBeDatasource: canBeDatasource
|
|
182
|
+
});
|
|
183
|
+
}
|
|
167
184
|
}
|
|
168
|
-
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
|
|
185
|
+
}, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource, fireEvent]);
|
|
169
186
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
170
187
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
171
188
|
id: id,
|
|
@@ -3,8 +3,10 @@ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
4
|
import { di } from 'react-magnetic-di';
|
|
5
5
|
import uuid from 'uuid';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
7
|
-
import { useSmartLinkAnalytics } from '../../state
|
|
8
|
+
import { useSmartLinkAnalytics } from '../../state';
|
|
9
|
+
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
8
10
|
import { importWithRetry } from '../../utils';
|
|
9
11
|
import { isFlexibleUiCard } from '../../utils/flexible';
|
|
10
12
|
import { clearMarks, clearMeasures } from '../../utils/performance';
|
|
@@ -75,12 +77,24 @@ export function CardWithURLRenderer(props) {
|
|
|
75
77
|
definitionId: null
|
|
76
78
|
});
|
|
77
79
|
} else if (error.name !== 'APIError') {
|
|
78
|
-
analytics
|
|
79
|
-
|
|
80
|
-
id
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
81
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
82
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
83
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
84
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
85
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
86
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
87
|
+
error: error,
|
|
88
|
+
errorInfo: errorInfo
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
analytics.ui.renderFailedEvent({
|
|
92
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
93
|
+
id: id,
|
|
94
|
+
error: error,
|
|
95
|
+
errorInfo: errorInfo
|
|
96
|
+
});
|
|
97
|
+
}
|
|
84
98
|
}
|
|
85
99
|
onError && onError({
|
|
86
100
|
status: 'errored',
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
3
5
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
4
|
-
import {
|
|
6
|
+
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
7
|
+
import { getCanBeDatasource, getDefinitionId } from '../../../../../state/helpers';
|
|
5
8
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
6
9
|
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
10
|
import { getMetadata } from '../../../utils';
|
|
@@ -15,17 +18,41 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
15
18
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
16
19
|
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
17
20
|
onActionClick = _ref.onActionClick,
|
|
18
|
-
titleBlockProps = _ref.titleBlockProps
|
|
19
|
-
|
|
21
|
+
titleBlockProps = _ref.titleBlockProps,
|
|
22
|
+
id = _ref.id;
|
|
23
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
24
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
25
|
+
var definitionId = React.useMemo(function () {
|
|
26
|
+
return getDefinitionId(cardState.details);
|
|
27
|
+
}, [cardState.details]);
|
|
28
|
+
var canBeDatasource = React.useMemo(function () {
|
|
29
|
+
return getCanBeDatasource(cardState.details);
|
|
30
|
+
}, [cardState.details]);
|
|
20
31
|
useEffect(function () {
|
|
21
32
|
// Since this hover view is only rendered on resolved status,
|
|
22
33
|
// there is no need to check for statuses.
|
|
23
|
-
analytics
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
35
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
36
|
+
extensionKey: extensionKey,
|
|
37
|
+
display: CardDisplay.HoverCardPreview
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
41
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
42
|
+
display: CardDisplay.HoverCardPreview
|
|
43
|
+
});
|
|
44
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
45
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
46
|
+
display: CardDisplay.HoverCardPreview
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
analytics.ui.renderSuccessEvent({
|
|
50
|
+
display: CardDisplay.HoverCardPreview,
|
|
51
|
+
status: cardState.status,
|
|
52
|
+
canBeDatasource: canBeDatasource
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, [analytics.ui, cardState.status, canBeDatasource, fireEvent, definitionId, extensionKey, id]);
|
|
29
56
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
30
57
|
var _useMemo = useMemo(function () {
|
|
31
58
|
return getMetadata(extensionKey, data);
|
|
@@ -9,23 +9,40 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { di } from 'react-magnetic-di';
|
|
11
11
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
12
14
|
import { CardDisplay } from '../../constants';
|
|
13
|
-
import { useSmartLinkAnalytics } from '../../state
|
|
15
|
+
import { useSmartLinkAnalytics } from '../../state';
|
|
16
|
+
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
14
17
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
15
18
|
import { HoverCardComponent } from './components/HoverCardComponent';
|
|
16
19
|
var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
|
|
20
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
21
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
17
22
|
var url = props.url,
|
|
18
23
|
id = props.id,
|
|
19
24
|
children = props.children;
|
|
20
25
|
var analytics = useSmartLinkAnalytics(url, id);
|
|
21
26
|
var onError = useCallback(function (error, info) {
|
|
22
|
-
analytics
|
|
23
|
-
|
|
24
|
-
id
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
28
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
29
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
30
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
31
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
32
|
+
display: CardDisplay.HoverCardPreview,
|
|
33
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
34
|
+
error: error,
|
|
35
|
+
errorInfo: info
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
analytics.ui.renderFailedEvent({
|
|
39
|
+
display: CardDisplay.HoverCardPreview,
|
|
40
|
+
id: id,
|
|
41
|
+
error: error,
|
|
42
|
+
errorInfo: info
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, [analytics.ui, id, fireEvent]);
|
|
29
46
|
return jsx(ErrorBoundary, {
|
|
30
47
|
fallback: children,
|
|
31
48
|
onError: onError
|
|
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
13
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
14
14
|
var PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "32.7.
|
|
16
|
+
packageVersion: "32.7.3",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::1e6835b50307a44a077c38d864a2c66e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataContextType = {
|
|
@@ -61,6 +61,13 @@ export type ButtonClickedShortcutGoToLinkAttributesType = {
|
|
|
61
61
|
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview' | null;
|
|
62
62
|
resourceType: string | null;
|
|
63
63
|
};
|
|
64
|
+
export type ButtonClickedIssueStatusUpdateAttributesType = {
|
|
65
|
+
actionType: string | null;
|
|
66
|
+
id: string | null;
|
|
67
|
+
definitionId: string | null;
|
|
68
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview' | null;
|
|
69
|
+
resourceType: string | null;
|
|
70
|
+
};
|
|
64
71
|
export type ButtonClickedAiSummaryAttributesType = {};
|
|
65
72
|
export type ButtonClickedCopySummaryAttributesType = {};
|
|
66
73
|
export type SummaryViewedAttributesType = {
|
|
@@ -200,6 +207,21 @@ export type ButtonClickedSmartLinkStatusOpenPreviewAttributesType = {};
|
|
|
200
207
|
export type ButtonClickedSmartLinkFollowButtonAttributesType = {};
|
|
201
208
|
export type ButtonClickedStatusUpdateActionAttributesType = {};
|
|
202
209
|
export type ButtonClickedGetStatusTransitionsActionAttributesType = {};
|
|
210
|
+
export type ButtonClickedEmbedPreviewResizeAttributesType = {
|
|
211
|
+
newSize: 'large' | 'small';
|
|
212
|
+
origin: 'smartLinkCard' | 'smartLinkEmbed' | 'smartLinkInline' | 'smartLinkPreviewHoverCard' | null;
|
|
213
|
+
previousSize: 'large' | 'small';
|
|
214
|
+
};
|
|
215
|
+
export type SmartLinkRenderSuccessAttributesType = {
|
|
216
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
|
|
217
|
+
definitionId: string | null;
|
|
218
|
+
};
|
|
219
|
+
export type SmartLinkRenderFailedAttributesType = {
|
|
220
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
|
|
221
|
+
error: Record<string, unknown>;
|
|
222
|
+
errorInfo: Record<string, unknown>;
|
|
223
|
+
id: string | null;
|
|
224
|
+
};
|
|
203
225
|
export type AnalyticsEventAttributes = {
|
|
204
226
|
/**
|
|
205
227
|
* Fired when an copy link is clicked */
|
|
@@ -213,6 +235,9 @@ export type AnalyticsEventAttributes = {
|
|
|
213
235
|
/**
|
|
214
236
|
* Fired when an view link is clicked */
|
|
215
237
|
'ui.button.clicked.shortcutGoToLink': ButtonClickedShortcutGoToLinkAttributesType;
|
|
238
|
+
/**
|
|
239
|
+
* fires an event that represents a user clicking on the preview action button */
|
|
240
|
+
'ui.button.clicked.issueStatusUpdate': ButtonClickedIssueStatusUpdateAttributesType;
|
|
216
241
|
/**
|
|
217
242
|
* fired when an ai summary is clicked */
|
|
218
243
|
'ui.button.clicked.aiSummary': ButtonClickedAiSummaryAttributesType;
|
|
@@ -337,5 +362,14 @@ export type AnalyticsEventAttributes = {
|
|
|
337
362
|
'ui.button.clicked.StatusUpdateAction': ButtonClickedStatusUpdateActionAttributesType;
|
|
338
363
|
/** */
|
|
339
364
|
'ui.button.clicked.GetStatusTransitionsAction': ButtonClickedGetStatusTransitionsActionAttributesType;
|
|
365
|
+
/**
|
|
366
|
+
* fires an event that represents a user clicking on the resize button in the embed preview */
|
|
367
|
+
'ui.button.clicked.embedPreviewResize': ButtonClickedEmbedPreviewResizeAttributesType;
|
|
368
|
+
/**
|
|
369
|
+
* fires an event that represents when a Smart Link was rendered successfully (even if the Smart Link errors out) */
|
|
370
|
+
'ui.smartLink.renderSuccess': SmartLinkRenderSuccessAttributesType;
|
|
371
|
+
/**
|
|
372
|
+
* fires an event that represents when a Smart Link renders unsuccessfully. */
|
|
373
|
+
'ui.smartLink.renderFailed': SmartLinkRenderFailedAttributesType;
|
|
340
374
|
};
|
|
341
375
|
export type EventKey = keyof AnalyticsEventAttributes;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type LozengeProps as AtlaskitLozengeProps } from '@atlaskit/lozenge';
|
|
|
4
4
|
import { type RequestAccessMessageKey } from './messages';
|
|
5
5
|
import { type ActionProps } from './view/BlockCard/components/Action';
|
|
6
6
|
import { type AccessContext } from './view/types';
|
|
7
|
+
/** @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15961 Internal documentation for deprecation (no external access)} */
|
|
7
8
|
export type ResolveResponse = JsonLd.Response;
|
|
8
9
|
export type { ProviderProps, CardType } from './state';
|
|
9
10
|
export type { CardProps, CardAppearance, CardPlatform } from './view/Card/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type HoverCardResolvedProps } from './types';
|
|
3
|
-
declare const HoverCardResolvedView: ({ analytics, cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, }: HoverCardResolvedProps) => JSX.Element;
|
|
3
|
+
declare const HoverCardResolvedView: ({ analytics, cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, id, }: HoverCardResolvedProps) => JSX.Element;
|
|
4
4
|
export default HoverCardResolvedView;
|