@atlaskit/smart-card 32.4.0 → 32.5.1
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 +24 -0
- package/analytics.spec.yaml +100 -0
- package/dist/cjs/state/actions/index.js +35 -11
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +5 -1
- package/dist/cjs/utils/analytics/analytics.js +21 -1
- package/dist/cjs/utils/analytics/index.js +3 -0
- package/dist/cjs/view/CardWithUrl/component.js +32 -10
- package/dist/cjs/view/CardWithUrl/loader.js +19 -6
- package/dist/cjs/view/LinkUrl/index.js +12 -5
- package/dist/es2019/state/actions/index.js +35 -11
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -1
- package/dist/es2019/utils/analytics/analytics.js +21 -1
- package/dist/es2019/utils/analytics/index.js +4 -0
- package/dist/es2019/view/CardWithUrl/component.js +32 -10
- package/dist/es2019/view/CardWithUrl/loader.js +20 -6
- package/dist/es2019/view/LinkUrl/index.js +9 -3
- package/dist/esm/state/actions/index.js +35 -11
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +5 -1
- package/dist/esm/utils/analytics/analytics.js +21 -1
- package/dist/esm/utils/analytics/index.js +4 -0
- package/dist/esm/view/CardWithUrl/component.js +32 -10
- package/dist/esm/view/CardWithUrl/loader.js +19 -6
- package/dist/esm/view/LinkUrl/index.js +11 -4
- package/dist/types/common/analytics/generated/analytics.types.d.ts +38 -1
- package/dist/types/state/analytics/useLinkClicked.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +5 -1
- package/dist/types/utils/analytics/analytics.d.ts +15 -0
- package/dist/types/utils/analytics/click.d.ts +3 -8
- package/dist/types/utils/analytics/index.d.ts +3 -0
- package/dist/types/utils/analytics/types.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-footer-block/icons/info/index.d.ts +2 -2
- package/dist/types/view/LinkUrl/index.d.ts +4 -0
- package/dist/types/view/LinkUrl/types.d.ts +1 -0
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +38 -1
- package/dist/types-ts4.5/state/analytics/useLinkClicked.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +5 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +15 -0
- package/dist/types-ts4.5/utils/analytics/click.d.ts +3 -8
- package/dist/types-ts4.5/utils/analytics/index.d.ts +3 -0
- package/dist/types-ts4.5/utils/analytics/types.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-footer-block/icons/info/index.d.ts +2 -2
- package/dist/types-ts4.5/view/LinkUrl/index.d.ts +4 -0
- package/dist/types-ts4.5/view/LinkUrl/types.d.ts +1 -0
- package/package.json +13 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
4
5
|
import { CardDisplay } from '../../constants';
|
|
5
6
|
import { useSmartLink } from '../../state';
|
|
@@ -116,18 +117,39 @@ function Component({
|
|
|
116
117
|
useEffect(() => {
|
|
117
118
|
measure.mark(id, state.status);
|
|
118
119
|
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
119
|
-
var _state$error;
|
|
120
120
|
measure.create(id, state.status);
|
|
121
|
-
analytics
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
122
|
+
var _state$error;
|
|
123
|
+
if (state.status === 'resolved') {
|
|
124
|
+
var _measure$getMeasure$d, _measure$getMeasure;
|
|
125
|
+
fireEvent('operational.smartLink.resolved', {
|
|
126
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
127
|
+
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
|
|
128
|
+
});
|
|
129
|
+
} else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError') {
|
|
130
|
+
fireEvent('operational.smartLink.unresolved', {
|
|
131
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
132
|
+
reason: state.status,
|
|
133
|
+
error: state.error === undefined ? null : {
|
|
134
|
+
name: state.error.name,
|
|
135
|
+
kind: state.error.kind,
|
|
136
|
+
type: state.error.type
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
var _state$error2;
|
|
142
|
+
analytics.operational.instrument({
|
|
143
|
+
id,
|
|
144
|
+
status: state.status,
|
|
145
|
+
definitionId,
|
|
146
|
+
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : (_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.extensionKey,
|
|
147
|
+
resourceType,
|
|
148
|
+
error: state.error
|
|
149
|
+
});
|
|
150
|
+
}
|
|
129
151
|
}
|
|
130
|
-
}, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational]);
|
|
152
|
+
}, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational, fireEvent]);
|
|
131
153
|
|
|
132
154
|
// NB: once the smart-card has rendered into an end state, we capture
|
|
133
155
|
// this as a successful render. These can be one of:
|
|
@@ -2,6 +2,8 @@ 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';
|
|
6
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
7
|
import { useSmartLinkAnalytics } from '../../state/analytics';
|
|
6
8
|
import { importWithRetry } from '../../utils';
|
|
7
9
|
import { isFlexibleUiCard } from '../../utils/flexible';
|
|
@@ -10,6 +12,9 @@ import { LoadingCardLink } from './component-lazy/LoadingCardLink';
|
|
|
10
12
|
export const LazyCardWithUrlContent = /*#__PURE__*/lazy(() => importWithRetry(() => import( /* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */'./component-lazy/index')));
|
|
11
13
|
export function CardWithURLRenderer(props) {
|
|
12
14
|
const [id] = useState(() => props.id ? props.id : uuid());
|
|
15
|
+
const {
|
|
16
|
+
fireEvent
|
|
17
|
+
} = useAnalyticsEvents();
|
|
13
18
|
useEffect(() => {
|
|
14
19
|
// ComponentWillUnmount
|
|
15
20
|
return () => {
|
|
@@ -60,11 +65,20 @@ export function CardWithURLRenderer(props) {
|
|
|
60
65
|
// to the reliability of the smart-card front-end components.
|
|
61
66
|
// Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
|
|
62
67
|
if (error.name === 'ChunkLoadError') {
|
|
63
|
-
analytics
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
69
|
+
fireEvent('operational.smartLink.chunkLoadFailed', {
|
|
70
|
+
display: appearance,
|
|
71
|
+
error: error,
|
|
72
|
+
errorInfo: errorInfo,
|
|
73
|
+
definitionId: null
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
analytics.operational.chunkloadFailedEvent({
|
|
77
|
+
display: appearance,
|
|
78
|
+
error,
|
|
79
|
+
errorInfo
|
|
80
|
+
});
|
|
81
|
+
}
|
|
68
82
|
} else if (error.name !== 'APIError') {
|
|
69
83
|
analytics.ui.renderFailedEvent({
|
|
70
84
|
display: isFlexibleUi ? 'flexible' : appearance,
|
|
@@ -78,7 +92,7 @@ export function CardWithURLRenderer(props) {
|
|
|
78
92
|
url: url !== null && url !== void 0 ? url : '',
|
|
79
93
|
err: error
|
|
80
94
|
});
|
|
81
|
-
}, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi]);
|
|
95
|
+
}, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi, fireEvent]);
|
|
82
96
|
if (!url) {
|
|
83
97
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
84
98
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { di } from 'react-magnetic-di';
|
|
3
4
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
5
|
+
import AKLink from '@atlaskit/link';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
7
|
import { withLinkClickedEvent } from '../../utils/analytics/click';
|
|
5
8
|
import { LinkAnalyticsContext } from '../../utils/analytics/LinkAnalyticsContext';
|
|
6
9
|
import LinkWarningModal from './LinkWarningModal';
|
|
7
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
8
11
|
const PACKAGE_DATA = {
|
|
9
12
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "32.
|
|
13
|
+
packageVersion: "32.5.1",
|
|
11
14
|
componentName: 'linkUrl'
|
|
12
15
|
};
|
|
13
|
-
const
|
|
16
|
+
const Anchor = withLinkClickedEvent('a');
|
|
17
|
+
export const LinkComponent = withLinkClickedEvent(AKLink);
|
|
14
18
|
const LinkUrl = ({
|
|
15
19
|
href,
|
|
16
20
|
children,
|
|
17
21
|
checkSafety = true,
|
|
18
22
|
onClick,
|
|
19
23
|
testId = 'link-with-safety',
|
|
24
|
+
isLinkComponent = false,
|
|
20
25
|
...props
|
|
21
26
|
}) => {
|
|
22
27
|
const {
|
|
@@ -24,12 +29,13 @@ const LinkUrl = ({
|
|
|
24
29
|
showSafetyWarningModal,
|
|
25
30
|
...linkWarningModalProps
|
|
26
31
|
} = useLinkWarningModal();
|
|
32
|
+
const Link = isLinkComponent && fg('platform_editor_hyperlink_underline') ? LinkComponent : Anchor;
|
|
27
33
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkAnalyticsContext, {
|
|
28
34
|
url: href,
|
|
29
35
|
display: "url"
|
|
30
36
|
}, /*#__PURE__*/React.createElement(Link, _extends({
|
|
31
37
|
"data-testid": testId,
|
|
32
|
-
href: href,
|
|
38
|
+
href: href || '',
|
|
33
39
|
onClick: e => {
|
|
34
40
|
if (!checkSafety) {
|
|
35
41
|
onClick && onClick(e);
|
|
@@ -4,8 +4,10 @@ import { useCallback, useMemo } from 'react';
|
|
|
4
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
5
5
|
import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
|
|
6
6
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
8
9
|
import { SmartLinkStatus } from '../../constants';
|
|
10
|
+
import { startUfoExperience } from '../analytics';
|
|
9
11
|
import { getByDefinitionId, getDefinitionId, getExtensionKey, getServices } from '../helpers';
|
|
10
12
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
11
13
|
import useResolve from '../hooks/use-resolve';
|
|
@@ -119,19 +121,41 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
119
121
|
fireEvent('track.applicationAccount.connected', {
|
|
120
122
|
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
121
123
|
});
|
|
122
|
-
analytics
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
125
|
+
startUfoExperience('smart-link-authenticated', id, {
|
|
126
|
+
extensionKey: extensionKey,
|
|
127
|
+
status: 'success'
|
|
128
|
+
});
|
|
129
|
+
fireEvent('operational.smartLink.connectSucceeded', {
|
|
130
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
analytics.operational.connectSucceededEvent({
|
|
134
|
+
id: id,
|
|
135
|
+
definitionId: definitionId,
|
|
136
|
+
extensionKey: extensionKey
|
|
137
|
+
});
|
|
138
|
+
}
|
|
127
139
|
reload();
|
|
128
140
|
}, function (err) {
|
|
129
|
-
analytics
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
141
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
142
|
+
var _err$type;
|
|
143
|
+
startUfoExperience('smart-link-authenticated', id, {
|
|
144
|
+
extensionKey: extensionKey,
|
|
145
|
+
status: err.type
|
|
146
|
+
});
|
|
147
|
+
fireEvent('operational.smartLink.connectFailed', {
|
|
148
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
149
|
+
reason: (_err$type = err.type) !== null && _err$type !== void 0 ? _err$type : null
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
analytics.operational.connectFailedEvent({
|
|
153
|
+
id: id,
|
|
154
|
+
definitionId: definitionId,
|
|
155
|
+
extensionKey: extensionKey,
|
|
156
|
+
reason: err.type
|
|
157
|
+
});
|
|
158
|
+
}
|
|
135
159
|
if (err.type === 'auth_window_closed') {
|
|
136
160
|
analytics.ui.closedAuthEvent({
|
|
137
161
|
display: appearance,
|
|
@@ -511,6 +511,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
511
511
|
* @param id The unique ID for this Smart Link.
|
|
512
512
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
513
513
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
514
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
514
515
|
*/
|
|
515
516
|
connectSucceededEvent: function connectSucceededEvent(_ref13) {
|
|
516
517
|
var id = _ref13.id,
|
|
@@ -541,6 +542,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
541
542
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
542
543
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
543
544
|
* @param reason The reason why the Smart Link connect account failed.
|
|
545
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
544
546
|
*/
|
|
545
547
|
connectFailedEvent: function connectFailedEvent(_ref14) {
|
|
546
548
|
var id = _ref14.id,
|
|
@@ -575,6 +577,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
575
577
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
576
578
|
* @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
|
|
577
579
|
* @param error An error representing why the Smart Link request failed.
|
|
580
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
578
581
|
*/
|
|
579
582
|
instrument: function instrument(_ref15) {
|
|
580
583
|
var id = _ref15.id,
|
|
@@ -602,11 +605,12 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
602
605
|
}
|
|
603
606
|
},
|
|
604
607
|
/**
|
|
605
|
-
* This fires an event that represents when a Smart Link renders
|
|
608
|
+
* This fires an event that represents when a Smart Link renders unsuccessfully.
|
|
606
609
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
607
610
|
* @param id The unique ID for this Smart Link.
|
|
608
611
|
* @param error: An error representing why the Smart Link render failed.
|
|
609
612
|
* @param errorInfo: Additional details about the error including the stack trace.
|
|
613
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
610
614
|
*/
|
|
611
615
|
chunkloadFailedEvent: function chunkloadFailedEvent(_ref16) {
|
|
612
616
|
var display = _ref16.display,
|
|
@@ -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.
|
|
13
|
+
packageVersion: "32.5.1"
|
|
14
14
|
};
|
|
15
15
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
16
16
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -57,6 +57,10 @@ export var fireSmartLinkEvent = function fireSmartLinkEvent(payload, createAnaly
|
|
|
57
57
|
createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
63
|
+
*/
|
|
60
64
|
export var resolvedEvent = function resolvedEvent(props) {
|
|
61
65
|
return {
|
|
62
66
|
action: 'resolved',
|
|
@@ -65,6 +69,10 @@ export var resolvedEvent = function resolvedEvent(props) {
|
|
|
65
69
|
attributes: _objectSpread(_objectSpread({}, props), context)
|
|
66
70
|
};
|
|
67
71
|
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
75
|
+
*/
|
|
68
76
|
export var unresolvedEvent = function unresolvedEvent(_ref) {
|
|
69
77
|
var id = _ref.id,
|
|
70
78
|
definitionId = _ref.definitionId,
|
|
@@ -159,6 +167,10 @@ export var invokeFailedEvent = function invokeFailedEvent(_ref3) {
|
|
|
159
167
|
})
|
|
160
168
|
};
|
|
161
169
|
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
173
|
+
*/
|
|
162
174
|
export var connectSucceededEvent = function connectSucceededEvent(_ref4) {
|
|
163
175
|
var definitionId = _ref4.definitionId,
|
|
164
176
|
extensionKey = _ref4.extensionKey,
|
|
@@ -178,6 +190,10 @@ export var connectSucceededEvent = function connectSucceededEvent(_ref4) {
|
|
|
178
190
|
})
|
|
179
191
|
};
|
|
180
192
|
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
196
|
+
*/
|
|
181
197
|
export var connectFailedEvent = function connectFailedEvent(_ref5) {
|
|
182
198
|
var definitionId = _ref5.definitionId,
|
|
183
199
|
extensionKey = _ref5.extensionKey,
|
|
@@ -461,6 +477,10 @@ export var uiLearnMoreLinkClickedEvent = function uiLearnMoreLinkClickedEvent()
|
|
|
461
477
|
attributes: _objectSpread({}, context)
|
|
462
478
|
};
|
|
463
479
|
};
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
483
|
+
*/
|
|
464
484
|
export var chunkloadFailedEvent = function chunkloadFailedEvent(_ref16) {
|
|
465
485
|
var display = _ref16.display,
|
|
466
486
|
error = _ref16.error,
|
|
@@ -4,6 +4,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getMeasure } from '../performance';
|
|
5
5
|
import { resolvedEvent, unresolvedEvent } from './analytics';
|
|
6
6
|
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, chunkloadFailedEvent, connectSucceededEvent, connectFailedEvent, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from './analytics';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
10
|
+
*/
|
|
7
11
|
export var instrumentEvent = function instrumentEvent(_ref) {
|
|
8
12
|
var id = _ref.id,
|
|
9
13
|
status = _ref.status,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
4
5
|
import { CardDisplay } from '../../constants';
|
|
5
6
|
import { useSmartLink } from '../../state';
|
|
@@ -118,18 +119,39 @@ function Component(_ref) {
|
|
|
118
119
|
useEffect(function () {
|
|
119
120
|
measure.mark(id, state.status);
|
|
120
121
|
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
121
|
-
var _state$error;
|
|
122
122
|
measure.create(id, state.status);
|
|
123
|
-
analytics
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
124
|
+
var _state$error;
|
|
125
|
+
if (state.status === 'resolved') {
|
|
126
|
+
var _measure$getMeasure$d, _measure$getMeasure;
|
|
127
|
+
fireEvent('operational.smartLink.resolved', {
|
|
128
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
129
|
+
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
|
|
130
|
+
});
|
|
131
|
+
} else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError') {
|
|
132
|
+
fireEvent('operational.smartLink.unresolved', {
|
|
133
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
134
|
+
reason: state.status,
|
|
135
|
+
error: state.error === undefined ? null : {
|
|
136
|
+
name: state.error.name,
|
|
137
|
+
kind: state.error.kind,
|
|
138
|
+
type: state.error.type
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
var _state$error2;
|
|
144
|
+
analytics.operational.instrument({
|
|
145
|
+
id: id,
|
|
146
|
+
status: state.status,
|
|
147
|
+
definitionId: definitionId,
|
|
148
|
+
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : (_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.extensionKey,
|
|
149
|
+
resourceType: resourceType,
|
|
150
|
+
error: state.error
|
|
151
|
+
});
|
|
152
|
+
}
|
|
131
153
|
}
|
|
132
|
-
}, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational]);
|
|
154
|
+
}, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational, fireEvent]);
|
|
133
155
|
|
|
134
156
|
// NB: once the smart-card has rendered into an end state, we capture
|
|
135
157
|
// this as a successful render. These can be one of:
|
|
@@ -3,6 +3,8 @@ 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';
|
|
7
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
6
8
|
import { useSmartLinkAnalytics } from '../../state/analytics';
|
|
7
9
|
import { importWithRetry } from '../../utils';
|
|
8
10
|
import { isFlexibleUiCard } from '../../utils/flexible';
|
|
@@ -19,6 +21,8 @@ export function CardWithURLRenderer(props) {
|
|
|
19
21
|
}),
|
|
20
22
|
_useState2 = _slicedToArray(_useState, 1),
|
|
21
23
|
id = _useState2[0];
|
|
24
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
25
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
22
26
|
useEffect(function () {
|
|
23
27
|
// ComponentWillUnmount
|
|
24
28
|
return function () {
|
|
@@ -65,11 +69,20 @@ export function CardWithURLRenderer(props) {
|
|
|
65
69
|
// to the reliability of the smart-card front-end components.
|
|
66
70
|
// Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
|
|
67
71
|
if (error.name === 'ChunkLoadError') {
|
|
68
|
-
analytics
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
if (fg('platform_smart-card-migrate-operational-analytics')) {
|
|
73
|
+
fireEvent('operational.smartLink.chunkLoadFailed', {
|
|
74
|
+
display: appearance,
|
|
75
|
+
error: error,
|
|
76
|
+
errorInfo: errorInfo,
|
|
77
|
+
definitionId: null
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
analytics.operational.chunkloadFailedEvent({
|
|
81
|
+
display: appearance,
|
|
82
|
+
error: error,
|
|
83
|
+
errorInfo: errorInfo
|
|
84
|
+
});
|
|
85
|
+
}
|
|
73
86
|
} else if (error.name !== 'APIError') {
|
|
74
87
|
analytics.ui.renderFailedEvent({
|
|
75
88
|
display: isFlexibleUi ? 'flexible' : appearance,
|
|
@@ -83,7 +96,7 @@ export function CardWithURLRenderer(props) {
|
|
|
83
96
|
url: url !== null && url !== void 0 ? url : '',
|
|
84
97
|
err: error
|
|
85
98
|
});
|
|
86
|
-
}, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi]);
|
|
99
|
+
}, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi, fireEvent]);
|
|
87
100
|
if (!url) {
|
|
88
101
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
89
102
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
3
|
+
var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLinkComponent"],
|
|
4
4
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { di } from 'react-magnetic-di';
|
|
6
7
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
8
|
+
import AKLink from '@atlaskit/link';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
10
|
import { withLinkClickedEvent } from '../../utils/analytics/click';
|
|
8
11
|
import { LinkAnalyticsContext } from '../../utils/analytics/LinkAnalyticsContext';
|
|
9
12
|
import LinkWarningModal from './LinkWarningModal';
|
|
10
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
14
|
var PACKAGE_DATA = {
|
|
12
15
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.
|
|
16
|
+
packageVersion: "32.5.1",
|
|
14
17
|
componentName: 'linkUrl'
|
|
15
18
|
};
|
|
16
|
-
var
|
|
19
|
+
var Anchor = withLinkClickedEvent('a');
|
|
20
|
+
export var LinkComponent = withLinkClickedEvent(AKLink);
|
|
17
21
|
var LinkUrl = function LinkUrl(_ref) {
|
|
18
22
|
var href = _ref.href,
|
|
19
23
|
children = _ref.children,
|
|
@@ -22,17 +26,20 @@ var LinkUrl = function LinkUrl(_ref) {
|
|
|
22
26
|
_onClick = _ref.onClick,
|
|
23
27
|
_ref$testId = _ref.testId,
|
|
24
28
|
testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
|
|
29
|
+
_ref$isLinkComponent = _ref.isLinkComponent,
|
|
30
|
+
isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
|
|
25
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
32
|
var _useLinkWarningModal = useLinkWarningModal(),
|
|
27
33
|
isLinkSafe = _useLinkWarningModal.isLinkSafe,
|
|
28
34
|
showSafetyWarningModal = _useLinkWarningModal.showSafetyWarningModal,
|
|
29
35
|
linkWarningModalProps = _objectWithoutProperties(_useLinkWarningModal, _excluded2);
|
|
36
|
+
var Link = isLinkComponent && fg('platform_editor_hyperlink_underline') ? LinkComponent : Anchor;
|
|
30
37
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkAnalyticsContext, {
|
|
31
38
|
url: href,
|
|
32
39
|
display: "url"
|
|
33
40
|
}, /*#__PURE__*/React.createElement(Link, _extends({
|
|
34
41
|
"data-testid": testId,
|
|
35
|
-
href: href,
|
|
42
|
+
href: href || '',
|
|
36
43
|
onClick: function onClick(e) {
|
|
37
44
|
if (!checkSafety) {
|
|
38
45
|
_onClick && _onClick(e);
|
|
@@ -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::519effabaa6c383d7fa35374469faada>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataContextType = {
|
|
@@ -93,6 +93,28 @@ export type SmartLinkQuickActionFailedAttributesType = {
|
|
|
93
93
|
export type ConsentModalViewedAttributesType = {
|
|
94
94
|
definitionId: string | null;
|
|
95
95
|
};
|
|
96
|
+
export type SmartLinkConnectSucceededAttributesType = {
|
|
97
|
+
definitionId: string | null;
|
|
98
|
+
};
|
|
99
|
+
export type SmartLinkConnectFailedAttributesType = {
|
|
100
|
+
reason: string | null;
|
|
101
|
+
definitionId: string | null;
|
|
102
|
+
};
|
|
103
|
+
export type SmartLinkResolvedAttributesType = {
|
|
104
|
+
definitionId: string | null;
|
|
105
|
+
duration: number | null;
|
|
106
|
+
};
|
|
107
|
+
export type SmartLinkUnresolvedAttributesType = {
|
|
108
|
+
definitionId: string | null;
|
|
109
|
+
error: Record<string, unknown> | null;
|
|
110
|
+
reason: string;
|
|
111
|
+
};
|
|
112
|
+
export type SmartLinkChunkLoadFailedAttributesType = {
|
|
113
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
|
|
114
|
+
definitionId: string | null;
|
|
115
|
+
error: Record<string, unknown>;
|
|
116
|
+
errorInfo: Record<string, unknown>;
|
|
117
|
+
};
|
|
96
118
|
export type AnalyticsEventAttributes = {
|
|
97
119
|
/**
|
|
98
120
|
* fired when an ai summary is clicked */
|
|
@@ -157,5 +179,20 @@ export type AnalyticsEventAttributes = {
|
|
|
157
179
|
/**
|
|
158
180
|
* fires an event which represents the connect account page being opened. */
|
|
159
181
|
'screen.consentModal.viewed': ConsentModalViewedAttributesType;
|
|
182
|
+
/**
|
|
183
|
+
* fires an event that represents an account successfully being connected via a Smart Link. */
|
|
184
|
+
'operational.smartLink.connectSucceeded': SmartLinkConnectSucceededAttributesType;
|
|
185
|
+
/**
|
|
186
|
+
* fires an event that represents an account unsuccessfully being connected. */
|
|
187
|
+
'operational.smartLink.connectFailed': SmartLinkConnectFailedAttributesType;
|
|
188
|
+
/**
|
|
189
|
+
* fires an event which represents a Smart Link request succeeding. */
|
|
190
|
+
'operational.smartLink.resolved': SmartLinkResolvedAttributesType;
|
|
191
|
+
/**
|
|
192
|
+
* fires an event which represents a Smart Link request failing. */
|
|
193
|
+
'operational.smartLink.unresolved': SmartLinkUnresolvedAttributesType;
|
|
194
|
+
/**
|
|
195
|
+
* fires an event that represents when a Smart Link renders unsuccessfully. */
|
|
196
|
+
'operational.smartLink.chunkLoadFailed': SmartLinkChunkLoadFailedAttributesType;
|
|
160
197
|
};
|
|
161
198
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -4,5 +4,5 @@ export declare enum ClickButton {
|
|
|
4
4
|
Middle = 1,
|
|
5
5
|
Right = 2
|
|
6
6
|
}
|
|
7
|
-
export declare const useLinkClicked: <T extends import("react").
|
|
7
|
+
export declare const useLinkClicked: <T extends (e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void>(handler?: T, predicate?: ((event: React.MouseEvent) => boolean) | undefined) => (...args: Parameters<T>) => void;
|
|
8
8
|
export declare const useMouseDownEvent: <T extends import("react").MouseEventHandler<Element>>(onMouseDown?: T) => (...args: Parameters<T>) => void;
|
|
@@ -164,6 +164,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
|
|
|
164
164
|
* @param id The unique ID for this Smart Link.
|
|
165
165
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
166
166
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
167
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
167
168
|
*/
|
|
168
169
|
connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectSucceededEventProps) => void;
|
|
169
170
|
/**
|
|
@@ -172,6 +173,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
|
|
|
172
173
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
173
174
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
174
175
|
* @param reason The reason why the Smart Link connect account failed.
|
|
176
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
175
177
|
*/
|
|
176
178
|
connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: ConnectFailedEventProps) => void;
|
|
177
179
|
/**
|
|
@@ -182,14 +184,16 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
|
|
|
182
184
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
183
185
|
* @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
|
|
184
186
|
* @param error An error representing why the Smart Link request failed.
|
|
187
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
185
188
|
*/
|
|
186
189
|
instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: InstrumentEventProps) => void;
|
|
187
190
|
/**
|
|
188
|
-
* This fires an event that represents when a Smart Link renders
|
|
191
|
+
* This fires an event that represents when a Smart Link renders unsuccessfully.
|
|
189
192
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
190
193
|
* @param id The unique ID for this Smart Link.
|
|
191
194
|
* @param error: An error representing why the Smart Link render failed.
|
|
192
195
|
* @param errorInfo: Additional details about the error including the stack trace.
|
|
196
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
193
197
|
*/
|
|
194
198
|
chunkloadFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
|
|
195
199
|
};
|
|
@@ -22,11 +22,23 @@ export declare class SmartLinkEvents {
|
|
|
22
22
|
insertSmartLink(url: string, type: CardInnerAppearance, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
|
|
23
23
|
}
|
|
24
24
|
export declare const fireSmartLinkEvent: (payload: AnalyticsPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
27
|
+
*/
|
|
25
28
|
export declare const resolvedEvent: (props: ResolvedEventProps) => AnalyticsPayload;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
31
|
+
*/
|
|
26
32
|
export declare const unresolvedEvent: ({ id, definitionId, extensionKey, resourceType, destinationSubproduct, destinationProduct, error, status, location, }: UnresolvedEventProps) => AnalyticsPayload;
|
|
27
33
|
export declare const invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => AnalyticsPayload;
|
|
28
34
|
export declare const invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => AnalyticsPayload;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
37
|
+
*/
|
|
29
38
|
export declare const connectSucceededEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: ConnectSucceededEventProps) => AnalyticsPayload;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
41
|
+
*/
|
|
30
42
|
export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
|
|
31
43
|
export declare const uiAuthEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, display, }: UiAuthEventProps) => AnalyticsPayload;
|
|
32
44
|
export declare const uiAuthAlternateAccountEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, display, }: UiAuthAlternateAccountEventProps) => AnalyticsPayload;
|
|
@@ -39,6 +51,9 @@ export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey
|
|
|
39
51
|
export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
|
|
40
52
|
export declare const uiHoverCardOpenLinkClickedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: UiHoverCardOpenLinkClickedEventProps) => AnalyticsPayload;
|
|
41
53
|
export declare const uiLearnMoreLinkClickedEvent: () => AnalyticsPayload;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
|
|
56
|
+
*/
|
|
42
57
|
export declare const chunkloadFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
|
|
43
58
|
export declare const uiSmartLinkStatusLozengeButtonClicked: () => AnalyticsPayload;
|
|
44
59
|
export declare const uiSmartLinkStatusListItemButtonClicked: () => AnalyticsPayload;
|