@atlaskit/smart-card 26.2.1 → 26.3.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/extractors/block/index.js +5 -4
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +4 -2
- package/dist/cjs/messages.js +6 -0
- package/dist/cjs/state/actions/index.js +27 -11
- package/dist/cjs/state/hooks/use-invoke/index.js +8 -28
- package/dist/cjs/state/hooks/use-resolve/index.js +28 -12
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +47 -0
- package/dist/cjs/utils/analytics/analytics.js +13 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +4 -2
- package/dist/cjs/view/BlockCard/index.js +3 -1
- package/dist/cjs/view/CardWithUrl/component.js +13 -3
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +7 -1
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/index.js +38 -30
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.js +31 -0
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +21 -2
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +26 -3
- package/dist/es2019/extractors/block/index.js +5 -4
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +4 -2
- package/dist/es2019/messages.js +6 -0
- package/dist/es2019/state/actions/index.js +32 -12
- package/dist/es2019/state/hooks/use-invoke/index.js +4 -23
- package/dist/es2019/state/hooks/use-resolve/index.js +28 -12
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +35 -0
- package/dist/es2019/utils/analytics/analytics.js +10 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +17 -13
- package/dist/es2019/view/BlockCard/index.js +3 -1
- package/dist/es2019/view/CardWithUrl/component.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +7 -1
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/index.js +14 -6
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.js +21 -0
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +1 -0
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +21 -2
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +36 -11
- package/dist/esm/extractors/block/index.js +5 -4
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +4 -2
- package/dist/esm/messages.js +6 -0
- package/dist/esm/state/actions/index.js +27 -11
- package/dist/esm/state/hooks/use-invoke/index.js +8 -28
- package/dist/esm/state/hooks/use-resolve/index.js +28 -12
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +36 -0
- package/dist/esm/utils/analytics/analytics.js +10 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +4 -2
- package/dist/esm/view/BlockCard/index.js +3 -1
- package/dist/esm/view/CardWithUrl/component.js +11 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +7 -1
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/index.js +38 -30
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.js +21 -0
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +21 -2
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +26 -3
- package/dist/types/extractors/block/index.d.ts +2 -2
- package/dist/types/extractors/block/types.d.ts +1 -0
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +6 -3
- package/dist/types/state/flexible-ui-context/index.d.ts +10 -6
- package/dist/types/state/hooks/use-invoke/index.d.ts +1 -7
- package/dist/types/state/hooks/useSmartLink.d.ts +5 -3
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +9 -0
- package/dist/types/utils/analytics/analytics.d.ts +11 -3
- package/dist/types/utils/mocks.d.ts +5 -3
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +2 -1
- package/dist/types/view/BlockCard/views/ResolvedView.d.ts +2 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.d.ts +21 -0
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/block/index.d.ts +2 -2
- package/dist/types-ts4.5/extractors/block/types.d.ts +1 -0
- package/dist/types-ts4.5/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +6 -3
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +10 -6
- package/dist/types-ts4.5/state/hooks/use-invoke/index.d.ts +1 -7
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +5 -3
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +9 -0
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +11 -3
- package/dist/types-ts4.5/utils/mocks.d.ts +5 -3
- package/dist/types-ts4.5/view/BlockCard/actions/PreviewAction.d.ts +2 -1
- package/dist/types-ts4.5/view/BlockCard/views/ResolvedView.d.ts +2 -0
- package/dist/types-ts4.5/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.d.ts +21 -0
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/package.json +11 -3
- package/report.api.md +21 -3
- package/tmp/api-report-tmp.d.ts +21 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
+
import { getResolvedAttributes, getUrlAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
7
|
+
import { isFlexibleUiCard } from '../flexible';
|
|
8
|
+
import { CardDisplay } from '../../constants';
|
|
9
|
+
import { useSmartCardState as useSmartLinkState } from '../../state/store';
|
|
10
|
+
export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref) {
|
|
11
|
+
var children = _ref.children,
|
|
12
|
+
url = _ref.url,
|
|
13
|
+
appearance = _ref.appearance,
|
|
14
|
+
id = _ref.id;
|
|
15
|
+
var _useSmartLinkState = useSmartLinkState(url),
|
|
16
|
+
details = _useSmartLinkState.details,
|
|
17
|
+
status = _useSmartLinkState.status;
|
|
18
|
+
var resolvedAttributes = getResolvedAttributes({
|
|
19
|
+
url: url
|
|
20
|
+
}, details, status);
|
|
21
|
+
var _getUrlAttributes = getUrlAttributes(url),
|
|
22
|
+
urlHash = _getUrlAttributes.urlHash;
|
|
23
|
+
var isFlexibleUi = useMemo(function () {
|
|
24
|
+
return isFlexibleUiCard(children);
|
|
25
|
+
}, [children]);
|
|
26
|
+
var display = isFlexibleUi ? CardDisplay.Flexible : appearance;
|
|
27
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
28
|
+
data: {
|
|
29
|
+
attributes: _objectSpread(_objectSpread({}, resolvedAttributes), {}, {
|
|
30
|
+
urlHash: urlHash,
|
|
31
|
+
display: display,
|
|
32
|
+
id: id
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
|
@@ -16,6 +16,16 @@ export var context = {
|
|
|
16
16
|
packageName: packageName,
|
|
17
17
|
packageVersion: packageVersion
|
|
18
18
|
};
|
|
19
|
+
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
20
|
+
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
21
|
+
return TrackQuickActionType;
|
|
22
|
+
}({});
|
|
23
|
+
export var TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActionFailureReason) {
|
|
24
|
+
TrackQuickActionFailureReason["PermissionError"] = "PermissionError";
|
|
25
|
+
TrackQuickActionFailureReason["ValidationError"] = "ValidationError";
|
|
26
|
+
TrackQuickActionFailureReason["UnknownError"] = "UnknownError";
|
|
27
|
+
return TrackQuickActionFailureReason;
|
|
28
|
+
}({});
|
|
19
29
|
var uiActionSubjectIds = {
|
|
20
30
|
DownloadAction: 'downloadDocument',
|
|
21
31
|
PreviewAction: 'invokePreviewScreen',
|
package/dist/esm/version.json
CHANGED
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
5
|
var _excluded = ["popupMountPointId", "onClose"],
|
|
6
|
-
_excluded2 = ["details"];
|
|
6
|
+
_excluded2 = ["details", "enableImprovedPreviewAction"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -70,10 +70,12 @@ function _previewFunction() {
|
|
|
70
70
|
}
|
|
71
71
|
export default (function (_ref2) {
|
|
72
72
|
var details = _ref2.details,
|
|
73
|
+
enableImprovedPreviewAction = _ref2.enableImprovedPreviewAction,
|
|
73
74
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
75
|
+
var previewText = enableImprovedPreviewAction ? messages.preview_improved : messages.preview;
|
|
74
76
|
return {
|
|
75
77
|
id: 'preview-content',
|
|
76
|
-
text: /*#__PURE__*/React.createElement(FormattedMessage,
|
|
78
|
+
text: /*#__PURE__*/React.createElement(FormattedMessage, previewText),
|
|
77
79
|
promise: function promise(props) {
|
|
78
80
|
return previewFunction(_objectSpread(_objectSpread({
|
|
79
81
|
popupMountPointId: 'twp-editor-preview-iframe',
|
|
@@ -24,6 +24,7 @@ import FlexibleForbiddenView from './views/flexible/FlexibleForbiddenView';
|
|
|
24
24
|
import { tokens } from '../../utils/token';
|
|
25
25
|
import { css, jsx } from '@emotion/react';
|
|
26
26
|
import { handleClickCommon } from './utils/handlers';
|
|
27
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
27
28
|
export { default as PreviewAction } from './actions/PreviewAction';
|
|
28
29
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
29
30
|
var flexibleBlockCardElevationStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: 2px;\n"])), tokens.elevation);
|
|
@@ -58,6 +59,7 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
58
59
|
handleInvoke: handleInvoke,
|
|
59
60
|
extensionKey: extensionKey
|
|
60
61
|
};
|
|
62
|
+
var enableImprovedPreviewAction = Boolean(useFeatureFlag('enableImprovedPreviewAction'));
|
|
61
63
|
if (enableFlexibleBlockCard) {
|
|
62
64
|
var ui = {
|
|
63
65
|
hideElevation: true
|
|
@@ -140,7 +142,7 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
140
142
|
isSelected: isSelected
|
|
141
143
|
});
|
|
142
144
|
case 'resolved':
|
|
143
|
-
var resolvedViewProps = extractBlockProps(data, meta, extractorOpts, renderers, platform);
|
|
145
|
+
var resolvedViewProps = extractBlockProps(data, meta, extractorOpts, renderers, platform, enableImprovedPreviewAction);
|
|
144
146
|
if (onResolve) {
|
|
145
147
|
onResolve({
|
|
146
148
|
title: resolvedViewProps.title,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { isSpecialEvent } from '../../utils';
|
|
5
6
|
import * as measure from '../../utils/performance';
|
|
6
7
|
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
|
|
@@ -12,7 +13,8 @@ import { isFlexibleUiCard } from '../../utils/flexible';
|
|
|
12
13
|
import FlexibleCard from '../FlexibleCard';
|
|
13
14
|
import { CardDisplay } from '../../constants';
|
|
14
15
|
import { fireLinkClickedEvent } from '../../utils/analytics/click';
|
|
15
|
-
|
|
16
|
+
import { SmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
17
|
+
function Component(_ref) {
|
|
16
18
|
var id = _ref.id,
|
|
17
19
|
url = _ref.url,
|
|
18
20
|
isSelected = _ref.isSelected,
|
|
@@ -258,4 +260,11 @@ export function CardWithUrlContent(_ref) {
|
|
|
258
260
|
onIframeFocus: onIframeFocus
|
|
259
261
|
});
|
|
260
262
|
}
|
|
261
|
-
}
|
|
263
|
+
}
|
|
264
|
+
export var CardWithUrlContent = function CardWithUrlContent(props) {
|
|
265
|
+
return getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? /*#__PURE__*/React.createElement(SmartLinkAnalyticsContext, {
|
|
266
|
+
url: props.url,
|
|
267
|
+
appearance: props.appearance,
|
|
268
|
+
id: props.id
|
|
269
|
+
}, /*#__PURE__*/React.createElement(Component, props)) : /*#__PURE__*/React.createElement(Component, props);
|
|
270
|
+
};
|
|
@@ -7,6 +7,9 @@ import Action from '../index';
|
|
|
7
7
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
8
8
|
import { useSmartLinkAnalytics } from '../../../../../../state';
|
|
9
9
|
import { openPreviewModal } from '../../../../../EmbedModal/utils';
|
|
10
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
11
|
+
import { messages } from '../../../../../../messages';
|
|
12
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
10
13
|
var PreviewAction = function PreviewAction(props) {
|
|
11
14
|
var appearance = props.appearance,
|
|
12
15
|
asDropDownItem = props.asDropDownItem,
|
|
@@ -21,6 +24,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
21
24
|
isSupportTheming = props.isSupportTheming;
|
|
22
25
|
var defaultAnalytics = useSmartLinkAnalytics(url, function () {});
|
|
23
26
|
var analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
|
|
27
|
+
var enableImprovedPreviewAction = Boolean(useFeatureFlag('enableImprovedPreviewAction'));
|
|
28
|
+
var previewText = enableImprovedPreviewAction ? messages.preview_improved : messages.preview;
|
|
24
29
|
if (src && url) {
|
|
25
30
|
var embedModal = function embedModal() {
|
|
26
31
|
return openPreviewModal({
|
|
@@ -39,7 +44,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
39
44
|
if (_onClick) {
|
|
40
45
|
_onClick();
|
|
41
46
|
}
|
|
42
|
-
}
|
|
47
|
+
},
|
|
48
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, previewText)
|
|
43
49
|
});
|
|
44
50
|
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
45
51
|
appearance: appearance,
|
|
@@ -47,7 +47,7 @@ var actionMappings = (_actionMappings = {}, _defineProperty(_actionMappings, Act
|
|
|
47
47
|
testId: 'smart-action-preview-action',
|
|
48
48
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview),
|
|
49
49
|
icon: /*#__PURE__*/React.createElement(VidFullScreenOnIcon, {
|
|
50
|
-
label: "
|
|
50
|
+
label: "Open preview"
|
|
51
51
|
}),
|
|
52
52
|
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview)
|
|
53
53
|
}
|
|
@@ -17,6 +17,8 @@ import createStatusUpdateRequest from '../../../../../utils/actions/create-statu
|
|
|
17
17
|
import useResolve from '../../../../../state/hooks/use-resolve';
|
|
18
18
|
import { LozengeActionErrorMessages } from './lozenge-action-error/types';
|
|
19
19
|
import { useFlexibleUiAnalyticsContext } from '../../../../../state/flexible-ui-context';
|
|
20
|
+
import { TrackQuickActionType } from '../../../../../utils/analytics/analytics';
|
|
21
|
+
import { permissionLoadErrorAnalyticsPayload, unknownLoadErrorAnalyticsPayload, unknownUpdateErrorAnalyticsPayload, validationUpdateErrorAnalyticsPayload } from './lozenge-action-analytics';
|
|
20
22
|
var validateItems = function validateItems() {
|
|
21
23
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
22
24
|
var text = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -65,11 +67,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
65
67
|
var reload = useResolve();
|
|
66
68
|
//TODO EDM-6583 Replace usage of useFlexibleUiAnalyticsContext with linking platform analytics context from find team.
|
|
67
69
|
var analytics = useFlexibleUiAnalyticsContext();
|
|
68
|
-
var invoke = useInvoke(
|
|
69
|
-
started: analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted,
|
|
70
|
-
success: analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess,
|
|
71
|
-
failed: analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed
|
|
72
|
-
});
|
|
70
|
+
var invoke = useInvoke();
|
|
73
71
|
useEffect(function () {
|
|
74
72
|
setSelected({
|
|
75
73
|
text: text,
|
|
@@ -88,47 +86,52 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
88
86
|
case 0:
|
|
89
87
|
setIsOpen(args.isOpen);
|
|
90
88
|
if (!args.isOpen) {
|
|
91
|
-
_context.next =
|
|
89
|
+
_context.next = 24;
|
|
92
90
|
break;
|
|
93
91
|
}
|
|
94
92
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionClickedEvent();
|
|
93
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
94
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
95
|
+
});
|
|
95
96
|
if (!(!isLoaded && action !== null && action !== void 0 && action.read)) {
|
|
96
|
-
_context.next =
|
|
97
|
+
_context.next = 24;
|
|
97
98
|
break;
|
|
98
99
|
}
|
|
99
|
-
_context.prev =
|
|
100
|
+
_context.prev = 5;
|
|
100
101
|
setIsLoading(true);
|
|
101
|
-
_context.next =
|
|
102
|
+
_context.next = 9;
|
|
102
103
|
return invoke(action.read, extractLozengeActionItems);
|
|
103
|
-
case
|
|
104
|
+
case 9:
|
|
104
105
|
responseItems = _context.sent;
|
|
105
106
|
validItems = typeof text === 'string' ? validateItems(responseItems, text) : responseItems;
|
|
106
107
|
setItems(validItems);
|
|
107
108
|
setIsLoaded(true);
|
|
108
109
|
if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
|
|
110
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(permissionLoadErrorAnalyticsPayload);
|
|
109
111
|
setErrorMessage(LozengeActionErrorMessages.noData);
|
|
110
112
|
setIsLoaded(false);
|
|
111
113
|
}
|
|
112
|
-
_context.next =
|
|
114
|
+
_context.next = 21;
|
|
113
115
|
break;
|
|
114
|
-
case
|
|
115
|
-
_context.prev =
|
|
116
|
-
_context.t0 = _context["catch"](
|
|
116
|
+
case 16:
|
|
117
|
+
_context.prev = 16;
|
|
118
|
+
_context.t0 = _context["catch"](5);
|
|
117
119
|
setErrorMessage(LozengeActionErrorMessages.unknown);
|
|
118
120
|
setIsLoaded(false);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownLoadErrorAnalyticsPayload);
|
|
122
|
+
case 21:
|
|
123
|
+
_context.prev = 21;
|
|
121
124
|
setIsLoading(false);
|
|
122
|
-
return _context.finish(
|
|
123
|
-
case
|
|
125
|
+
return _context.finish(21);
|
|
126
|
+
case 24:
|
|
124
127
|
if (!args.isOpen) {
|
|
125
128
|
setErrorMessage(undefined);
|
|
126
129
|
}
|
|
127
|
-
case
|
|
130
|
+
case 25:
|
|
128
131
|
case "end":
|
|
129
132
|
return _context.stop();
|
|
130
133
|
}
|
|
131
|
-
}, _callee, null, [[
|
|
134
|
+
}, _callee, null, [[5, 16, 21, 24]]);
|
|
132
135
|
}));
|
|
133
136
|
return function (_x) {
|
|
134
137
|
return _ref3.apply(this, arguments);
|
|
@@ -151,7 +154,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
151
154
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionListItemClickedEvent();
|
|
152
155
|
updateAction = action === null || action === void 0 ? void 0 : action.update;
|
|
153
156
|
if (!(updateAction && id)) {
|
|
154
|
-
_context2.next =
|
|
157
|
+
_context2.next = 17;
|
|
155
158
|
break;
|
|
156
159
|
}
|
|
157
160
|
setIsLoading(true);
|
|
@@ -167,34 +170,39 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
167
170
|
setIsLoaded(false);
|
|
168
171
|
setIsOpen(false);
|
|
169
172
|
setItems([]);
|
|
173
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
174
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
175
|
+
});
|
|
170
176
|
if (!url) {
|
|
171
|
-
_context2.next =
|
|
177
|
+
_context2.next = 17;
|
|
172
178
|
break;
|
|
173
179
|
}
|
|
174
|
-
_context2.next =
|
|
180
|
+
_context2.next = 17;
|
|
175
181
|
return reload(url, true, undefined, linkId);
|
|
176
|
-
case
|
|
177
|
-
_context2.next =
|
|
182
|
+
case 17:
|
|
183
|
+
_context2.next = 23;
|
|
178
184
|
break;
|
|
179
|
-
case
|
|
180
|
-
_context2.prev =
|
|
185
|
+
case 19:
|
|
186
|
+
_context2.prev = 19;
|
|
181
187
|
_context2.t0 = _context2["catch"](0);
|
|
182
188
|
setIsLoading(false);
|
|
183
189
|
if (isInvokeCustomError(_context2.t0)) {
|
|
184
190
|
setErrorMessage(_context2.t0.message);
|
|
191
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(validationUpdateErrorAnalyticsPayload);
|
|
185
192
|
} else {
|
|
186
193
|
setErrorMessage(LozengeActionErrorMessages.updateFailed);
|
|
194
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownUpdateErrorAnalyticsPayload);
|
|
187
195
|
}
|
|
188
|
-
case
|
|
196
|
+
case 23:
|
|
189
197
|
case "end":
|
|
190
198
|
return _context2.stop();
|
|
191
199
|
}
|
|
192
|
-
}, _callee2, null, [[0,
|
|
200
|
+
}, _callee2, null, [[0, 19]]);
|
|
193
201
|
}));
|
|
194
202
|
return function (_x2, _x3, _x4) {
|
|
195
203
|
return _ref4.apply(this, arguments);
|
|
196
204
|
};
|
|
197
|
-
}(), [action === null || action === void 0 ? void 0 : action.update, analytics
|
|
205
|
+
}(), [action === null || action === void 0 ? void 0 : action.update, analytics, invoke, linkId, reload, url]);
|
|
198
206
|
var dropdownItemGroup = useMemo(function () {
|
|
199
207
|
if (errorMessage) {
|
|
200
208
|
return jsx(LozengeActionError, {
|
package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-analytics.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TrackQuickActionFailureReason, TrackQuickActionType } from '../../../../../utils/analytics/analytics';
|
|
2
|
+
export var unknownLoadErrorAnalyticsPayload = {
|
|
3
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate,
|
|
4
|
+
reason: TrackQuickActionFailureReason.UnknownError,
|
|
5
|
+
step: 'load'
|
|
6
|
+
};
|
|
7
|
+
export var permissionLoadErrorAnalyticsPayload = {
|
|
8
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate,
|
|
9
|
+
reason: TrackQuickActionFailureReason.PermissionError,
|
|
10
|
+
step: 'load'
|
|
11
|
+
};
|
|
12
|
+
export var unknownUpdateErrorAnalyticsPayload = {
|
|
13
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate,
|
|
14
|
+
reason: TrackQuickActionFailureReason.UnknownError,
|
|
15
|
+
step: 'update'
|
|
16
|
+
};
|
|
17
|
+
export var validationUpdateErrorAnalyticsPayload = {
|
|
18
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate,
|
|
19
|
+
reason: TrackQuickActionFailureReason.ValidationError,
|
|
20
|
+
step: 'update'
|
|
21
|
+
};
|
package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getTruncateStyles } from '../../../utils';
|
|
|
6
6
|
export var dropdownItemGroupStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n button {\n width: 220px;\n\n &:hover {\n background-color: inherit;\n cursor: default;\n }\n }\n"])));
|
|
7
7
|
var sharedBlockStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 0.5rem;\n line-height: 1rem;\n min-width: 0;\n overflow: hidden;\n flex-direction: row;\n align-items: center;\n"])));
|
|
8
8
|
export var contentStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n\n margin-top: ", ";\n align-items: flex-start;\n\n > span,\n > div {\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: ", ";\n }\n"])), sharedBlockStyles, "var(--ds-space-025, 2px)", "var(--ds-text, ".concat(N800, ")"));
|
|
9
|
-
export var linkStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n\n font-size: 0.875rem;\n margin-top: 10px;\n margin-left: ", ";\n margin-bottom: ", ";\n"])), sharedBlockStyles, "var(--ds-space-400, 32px)", "var(--ds-space-025, 2px)");
|
|
9
|
+
export var linkStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n\n cursor: pointer;\n font-size: 0.875rem;\n margin-top: 10px;\n margin-left: ", ";\n margin-bottom: ", ";\n"])), sharedBlockStyles, "var(--ds-space-400, 32px)", "var(--ds-space-025, 2px)");
|
|
10
10
|
export var textStyles = function textStyles(maxLines) {
|
|
11
11
|
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n line-height: 1rem;\n white-space: normal;\n ", ";\n"])), getTruncateStyles(maxLines));
|
|
12
12
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import Popup from '@atlaskit/popup';
|
|
5
6
|
import { jsx } from '@emotion/react';
|
|
6
7
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
@@ -10,9 +11,11 @@ import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
|
10
11
|
import HoverCardContent from '../components/HoverCardContent';
|
|
11
12
|
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
12
13
|
import { CardDisplay } from '../../../constants';
|
|
14
|
+
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
13
15
|
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
14
16
|
var children = _ref.children,
|
|
15
17
|
url = _ref.url,
|
|
18
|
+
id = _ref.id,
|
|
16
19
|
analyticsHandler = _ref.analyticsHandler,
|
|
17
20
|
analytics = _ref.analytics,
|
|
18
21
|
_ref$canOpen = _ref.canOpen,
|
|
@@ -122,7 +125,23 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
122
125
|
}, [closeOnChildClick, hideCard]);
|
|
123
126
|
var content = useCallback(function (_ref2) {
|
|
124
127
|
var update = _ref2.update;
|
|
125
|
-
return jsx(
|
|
128
|
+
return getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? jsx(SmartLinkAnalyticsContext, {
|
|
129
|
+
url: url,
|
|
130
|
+
appearance: CardDisplay.HoverCardPreview,
|
|
131
|
+
id: id
|
|
132
|
+
}, jsx(HoverCardContent, {
|
|
133
|
+
onMouseEnter: initShowCard,
|
|
134
|
+
onMouseLeave: initHideCard,
|
|
135
|
+
analytics: analytics,
|
|
136
|
+
cardActions: filteredActions,
|
|
137
|
+
cardState: linkState,
|
|
138
|
+
onActionClick: onActionClick,
|
|
139
|
+
onResolve: update,
|
|
140
|
+
renderers: renderers,
|
|
141
|
+
showServerActions: showServerActions,
|
|
142
|
+
url: url,
|
|
143
|
+
id: id
|
|
144
|
+
})) : jsx(HoverCardContent, {
|
|
126
145
|
onMouseEnter: initShowCard,
|
|
127
146
|
onMouseLeave: initHideCard,
|
|
128
147
|
analytics: analytics,
|
|
@@ -134,7 +153,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
134
153
|
showServerActions: showServerActions,
|
|
135
154
|
url: url
|
|
136
155
|
});
|
|
137
|
-
}, [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url]);
|
|
156
|
+
}, [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
|
|
138
157
|
var trigger = useCallback(function (triggerProps) {
|
|
139
158
|
return jsx("span", {
|
|
140
159
|
ref: parentSpan
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1
4
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
5
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
3
6
|
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
@@ -8,8 +11,27 @@ import FlexibleCard from '../../../../FlexibleCard';
|
|
|
8
11
|
import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
|
|
9
12
|
import SnippetOrPreview from '../../SnippetOrPreview';
|
|
10
13
|
import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
|
|
11
|
-
|
|
14
|
+
import { messages } from '../../../../../messages';
|
|
15
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
16
|
+
export var toFooterActions = function toFooterActions(cardActions, onActionClick, enableImprovedPreviewAction) {
|
|
17
|
+
var appearance = enableImprovedPreviewAction ? {
|
|
18
|
+
appearance: 'primary'
|
|
19
|
+
} : undefined;
|
|
20
|
+
var previewText = enableImprovedPreviewAction ? messages.preview_improved : messages.preview;
|
|
12
21
|
return cardActions.map(function (action) {
|
|
22
|
+
if (action.id === 'preview-content') {
|
|
23
|
+
return _objectSpread({
|
|
24
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, previewText),
|
|
25
|
+
name: ActionName.CustomAction,
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
if (onActionClick) {
|
|
28
|
+
onActionClick(action.id);
|
|
29
|
+
}
|
|
30
|
+
return action.invoke();
|
|
31
|
+
},
|
|
32
|
+
testId: action.id
|
|
33
|
+
}, appearance);
|
|
34
|
+
}
|
|
13
35
|
return {
|
|
14
36
|
content: action.text,
|
|
15
37
|
name: ActionName.CustomAction,
|
|
@@ -37,6 +59,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
37
59
|
onActionClick = _ref.onActionClick,
|
|
38
60
|
extensionKey = _ref.extensionKey;
|
|
39
61
|
var showActionableElement = useFeatureFlag('enableActionableElement');
|
|
62
|
+
var enableImprovedPreviewAction = useFeatureFlag('enableImprovedPreviewAction');
|
|
40
63
|
useEffect(function () {
|
|
41
64
|
// Since this hover view is only rendered on resolved status,
|
|
42
65
|
// there is no need to check for statuses.
|
|
@@ -46,8 +69,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
46
69
|
});
|
|
47
70
|
}, [analytics.ui, cardState.status]);
|
|
48
71
|
var footerActions = useMemo(function () {
|
|
49
|
-
return toFooterActions(cardActions, onActionClick);
|
|
50
|
-
}, [cardActions, onActionClick]);
|
|
72
|
+
return toFooterActions(cardActions, onActionClick, Boolean(enableImprovedPreviewAction));
|
|
73
|
+
}, [cardActions, onActionClick, enableImprovedPreviewAction]);
|
|
51
74
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
52
75
|
var _useMemo = useMemo(function () {
|
|
53
76
|
var types = data ? extractType(data) : undefined;
|
|
@@ -5,6 +5,6 @@ import { ExtractBlockOpts } from './types';
|
|
|
5
5
|
import { CardPlatform } from '../../view/Card';
|
|
6
6
|
import { BlockCardResolvedViewProps } from '../../view/BlockCard';
|
|
7
7
|
import { ActionProps } from '../../view/BlockCard/components/Action';
|
|
8
|
-
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts, platform?: CardPlatform, meta?: JsonLd.Meta.BaseMeta) => ActionProps[];
|
|
8
|
+
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts, platform?: CardPlatform, meta?: JsonLd.Meta.BaseMeta, enableImprovedPreviewAction?: boolean) => ActionProps[];
|
|
9
9
|
export declare const extractBlockUsers: (jsonLd: JsonLd.Data.BaseData) => LinkPerson[] | undefined;
|
|
10
|
-
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta, opts?: ExtractBlockOpts, renderers?: CardProviderRenderers, platform?: CardPlatform) => BlockCardResolvedViewProps;
|
|
10
|
+
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta, opts?: ExtractBlockOpts, renderers?: CardProviderRenderers, platform?: CardPlatform, enableImprovedPreviewAction?: boolean) => BlockCardResolvedViewProps;
|
|
@@ -2,7 +2,7 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
import { CardPlatform } from '../../../view/Card/types';
|
|
3
3
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
4
4
|
import { ExtractBlockOpts } from '../../block/types';
|
|
5
|
-
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, meta, }: ExtractBlockOpts & {
|
|
5
|
+
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, meta, enableImprovedPreviewAction, }: ExtractBlockOpts & {
|
|
6
6
|
viewProps: BlockCardResolvedViewProps;
|
|
7
7
|
jsonLd: JsonLd.Data.BaseData;
|
|
8
8
|
platform?: JsonLd.Primitives.Platforms | undefined;
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageDescriptor } from 'react-intl-next';
|
|
2
2
|
export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
|
|
3
|
-
export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
|
|
3
|
+
export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
|
|
4
4
|
type Messages = {
|
|
5
5
|
[K in MessageKey]: MessageDescriptor;
|
|
6
6
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnalyticsHandler, AnalyticsName, AnalyticsPayload } from '../../utils/types';
|
|
2
2
|
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps } from '../../utils/analytics/types';
|
|
3
|
+
import { TrackQuickActionFailureReason, TrackQuickActionType } from '../../utils/analytics/analytics';
|
|
3
4
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
4
5
|
/**
|
|
5
6
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
@@ -249,19 +250,21 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
|
|
|
249
250
|
* This fires a tracking event before an action invoke api call is made
|
|
250
251
|
*/
|
|
251
252
|
smartLinkQuickActionStarted: (props: {
|
|
252
|
-
smartLinkActionType: SmartLinkActionType;
|
|
253
|
+
smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
|
|
253
254
|
}) => void;
|
|
254
255
|
/**
|
|
255
256
|
* This fires a tracking event after an action invoke api call is successful
|
|
256
257
|
*/
|
|
257
258
|
smartLinkQuickActionSuccess: (props: {
|
|
258
|
-
smartLinkActionType: SmartLinkActionType;
|
|
259
|
+
smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
|
|
259
260
|
}) => void;
|
|
260
261
|
/**
|
|
261
262
|
* This fires a tracking event after an action invoke api call has failed
|
|
262
263
|
*/
|
|
263
264
|
smartLinkQuickActionFailed: (props: {
|
|
264
|
-
smartLinkActionType: SmartLinkActionType;
|
|
265
|
+
smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
|
|
266
|
+
reason?: TrackQuickActionFailureReason;
|
|
267
|
+
step?: string;
|
|
265
268
|
}) => void;
|
|
266
269
|
};
|
|
267
270
|
screen: {
|
|
@@ -51,13 +51,15 @@ export declare const FlexibleUiAnalyticsContext: import("react").Context<{
|
|
|
51
51
|
[key: string]: any;
|
|
52
52
|
}) => void;
|
|
53
53
|
smartLinkQuickActionStarted: (props: {
|
|
54
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
54
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
55
55
|
}) => void;
|
|
56
56
|
smartLinkQuickActionSuccess: (props: {
|
|
57
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
57
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
58
58
|
}) => void;
|
|
59
59
|
smartLinkQuickActionFailed: (props: {
|
|
60
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
60
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
61
|
+
reason?: import("../../utils/analytics/analytics").TrackQuickActionFailureReason | undefined;
|
|
62
|
+
step?: string | undefined;
|
|
61
63
|
}) => void;
|
|
62
64
|
};
|
|
63
65
|
screen: {
|
|
@@ -107,13 +109,15 @@ export declare const useFlexibleUiAnalyticsContext: () => {
|
|
|
107
109
|
[key: string]: any;
|
|
108
110
|
}) => void;
|
|
109
111
|
smartLinkQuickActionStarted: (props: {
|
|
110
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
112
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
111
113
|
}) => void;
|
|
112
114
|
smartLinkQuickActionSuccess: (props: {
|
|
113
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
115
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
114
116
|
}) => void;
|
|
115
117
|
smartLinkQuickActionFailed: (props: {
|
|
116
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
118
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
119
|
+
reason?: import("../../utils/analytics/analytics").TrackQuickActionFailureReason | undefined;
|
|
120
|
+
step?: string | undefined;
|
|
117
121
|
}) => void;
|
|
118
122
|
};
|
|
119
123
|
screen: {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
|
|
2
|
-
|
|
3
|
-
type InvokeRequestTracker = {
|
|
4
|
-
started?: AnalyticsFacade['track']['smartLinkQuickActionStarted'];
|
|
5
|
-
success?: AnalyticsFacade['track']['smartLinkQuickActionSuccess'];
|
|
6
|
-
failed?: AnalyticsFacade['track']['smartLinkQuickActionFailed'];
|
|
7
|
-
};
|
|
8
|
-
declare const useInvoke: ({ failed, started, success }?: InvokeRequestTracker) => (req: InvokeRequest, cb?: Function) => Promise<any>;
|
|
2
|
+
declare const useInvoke: () => (req: InvokeRequest, cb?: Function) => Promise<any>;
|
|
9
3
|
export default useInvoke;
|
|
@@ -54,13 +54,15 @@ dispatchAnalytics?: AnalyticsHandler): {
|
|
|
54
54
|
[key: string]: any;
|
|
55
55
|
}) => void;
|
|
56
56
|
smartLinkQuickActionStarted: (props: {
|
|
57
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
57
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
58
58
|
}) => void;
|
|
59
59
|
smartLinkQuickActionSuccess: (props: {
|
|
60
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
60
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
61
61
|
}) => void;
|
|
62
62
|
smartLinkQuickActionFailed: (props: {
|
|
63
|
-
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType;
|
|
63
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../utils/analytics/analytics").TrackQuickActionType;
|
|
64
|
+
reason?: import("../../utils/analytics/analytics").TrackQuickActionFailureReason | undefined;
|
|
65
|
+
step?: string | undefined;
|
|
64
66
|
}) => void;
|
|
65
67
|
};
|
|
66
68
|
screen: {
|