@atlaskit/smart-card 33.1.0 → 33.2.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 +8 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +1 -20
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +1 -23
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +1 -34
- package/dist/cjs/extractors/flexible/actions/index.js +2 -15
- package/dist/cjs/extractors/flexible/extract-state.js +1 -5
- package/dist/cjs/extractors/flexible/index.js +3 -7
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +18 -190
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +12 -25
- package/dist/cjs/view/CardWithUrl/loader.js +10 -22
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +8 -65
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +10 -26
- package/dist/cjs/view/FlexibleCard/components/utils.js +1 -28
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +0 -21
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/es2019/extractors/flexible/actions/index.js +4 -23
- package/dist/es2019/extractors/flexible/extract-state.js +1 -5
- package/dist/es2019/extractors/flexible/index.js +3 -4
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +2 -172
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +13 -26
- package/dist/es2019/view/CardWithUrl/loader.js +11 -23
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -33
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +11 -32
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +4 -22
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -27
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +0 -25
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +0 -23
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/esm/extractors/flexible/actions/index.js +4 -17
- package/dist/esm/extractors/flexible/extract-state.js +1 -5
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +19 -191
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +13 -26
- package/dist/esm/view/CardWithUrl/loader.js +10 -22
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +10 -67
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/utils.js +0 -27
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/mocks.d.ts +1 -16
- package/dist/types/view/EmbedModal/index.d.ts +0 -2
- package/dist/types/view/EmbedModal/types.d.ts +0 -3
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
- package/dist/types/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/mocks.d.ts +1 -16
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +0 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/package.json +1 -4
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +0 -32
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +0 -47
- package/dist/cjs/extractors/action/extractViewActionProps.js +0 -31
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +0 -27
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +0 -24
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +0 -36
- package/dist/es2019/extractors/action/extractViewActionProps.js +0 -23
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +0 -20
- package/dist/esm/extractors/action/extractDownloadActionProps.js +0 -27
- package/dist/esm/extractors/action/extractPreviewActionProps.js +0 -41
- package/dist/esm/extractors/action/extractViewActionProps.js +0 -26
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +0 -22
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -9,10 +9,8 @@ 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
12
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
14
13
|
import { CardDisplay } from '../../constants';
|
|
15
|
-
import { useSmartLinkAnalytics } from '../../state';
|
|
16
14
|
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
17
15
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
18
16
|
import { useSmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -26,7 +24,6 @@ const HoverCardWithErrorBoundary = props => {
|
|
|
26
24
|
id,
|
|
27
25
|
children
|
|
28
26
|
} = props;
|
|
29
|
-
const analytics = useSmartLinkAnalytics(url, id);
|
|
30
27
|
const analyticsContext = useSmartLinkAnalyticsContext({
|
|
31
28
|
display: CardDisplay.HoverCardPreview,
|
|
32
29
|
id,
|
|
@@ -34,26 +31,17 @@ const HoverCardWithErrorBoundary = props => {
|
|
|
34
31
|
url
|
|
35
32
|
});
|
|
36
33
|
const onError = useCallback((error, info) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} else {
|
|
49
|
-
analytics.ui.renderFailedEvent({
|
|
50
|
-
display: CardDisplay.HoverCardPreview,
|
|
51
|
-
id,
|
|
52
|
-
error,
|
|
53
|
-
errorInfo: info
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, [analytics.ui, analyticsContext, id, fireEvent]);
|
|
34
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
35
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
36
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
37
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
38
|
+
...(analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes),
|
|
39
|
+
display: CardDisplay.HoverCardPreview,
|
|
40
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
41
|
+
error: error,
|
|
42
|
+
errorInfo: info
|
|
43
|
+
});
|
|
44
|
+
}, [analyticsContext, id, fireEvent]);
|
|
57
45
|
return jsx(ErrorBoundary, {
|
|
58
46
|
fallback: children,
|
|
59
47
|
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: "33.
|
|
13
|
+
packageVersion: "33.2.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
1
|
import { extractInvokeCopyLinkAction } from '../../action/extract-invoke-copy-link-action';
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
-
* Replaced with extractCopyLinkClientAction()
|
|
8
|
-
*/
|
|
9
|
-
export var extractCopyLinkAction = function extractCopyLinkAction(data, actionOptions) {
|
|
10
|
-
if (!canShowAction(CardAction.CopyLinkAction, actionOptions)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
var url = extractLink(data);
|
|
14
|
-
if (!url) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
url: url
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
2
|
export var extractCopyLinkClientAction = function extractCopyLinkClientAction(param) {
|
|
22
3
|
var invokeAction = extractInvokeCopyLinkAction(param);
|
|
23
4
|
return invokeAction ? {
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
2
|
-
import { CardAction } from '../../../view/Card/types';
|
|
3
1
|
import { extractInvokeDownloadAction } from '../../action/extract-invoke-download-action';
|
|
4
|
-
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
5
|
-
import { extractDownloadUrl } from '../../common/download/extractDownloadUrl';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
9
|
-
* Replaced with extractDownloadClientAction()
|
|
10
|
-
*/
|
|
11
|
-
export var extractDownloadAction = function extractDownloadAction(data, actionOptions) {
|
|
12
|
-
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
var downloadActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
16
|
-
return action['@type'] === 'DownloadAction';
|
|
17
|
-
});
|
|
18
|
-
if (downloadActionExists) {
|
|
19
|
-
return {
|
|
20
|
-
downloadUrl: extractDownloadUrl(data)
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
};
|
|
25
2
|
export var extractDownloadClientAction = function extractDownloadClientAction(param) {
|
|
26
3
|
var invokeAction = extractInvokeDownloadAction(param);
|
|
27
4
|
return invokeAction ? {
|
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
1
|
import { extractInvokePreviewAction } from '../../action/extract-invoke-preview-action';
|
|
5
|
-
import { extractDownloadUrl } from '../../common/download/extractDownloadUrl';
|
|
6
|
-
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
7
|
-
import { extractIsTrusted } from '../../common/meta/extractIsTrusted';
|
|
8
|
-
import { extractLinkIcon } from '../icon';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
12
|
-
* Replaced with extractPreviewClientAction()
|
|
13
|
-
*/
|
|
14
|
-
export var extractPreviewAction = function extractPreviewAction(response, actionOptions) {
|
|
15
|
-
var _extractPreviewData;
|
|
16
|
-
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
var data = response.data;
|
|
20
|
-
var meta = response.meta;
|
|
21
|
-
var src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
22
|
-
if (src) {
|
|
23
|
-
var _extractProvider;
|
|
24
|
-
return {
|
|
25
|
-
downloadUrl: extractDownloadUrl(data),
|
|
26
|
-
providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
|
|
27
|
-
src: src,
|
|
28
|
-
title: extractTitle(data),
|
|
29
|
-
linkIcon: extractLinkIcon(response),
|
|
30
|
-
url: extractLink(data),
|
|
31
|
-
isSupportTheming: extractIsSupportTheming(meta),
|
|
32
|
-
isTrusted: extractIsTrusted(meta)
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
2
|
export var extractPreviewClientAction = function extractPreviewClientAction(param) {
|
|
37
3
|
var invokeAction = extractInvokePreviewAction(param);
|
|
38
4
|
return invokeAction ? {
|
|
@@ -2,10 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { ActionName, InternalActionName } from '../../../constants';
|
|
3
3
|
import { extractAISummaryAction } from './extract-ai-summary-action';
|
|
4
4
|
import { extractAutomationAction } from './extract-automation-action';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { extractCopyLinkClientAction } from './extract-copy-link-action';
|
|
6
|
+
import { extractDownloadClientAction } from './extract-download-action';
|
|
7
7
|
import extractFollowAction from './extract-follow-action';
|
|
8
|
-
import {
|
|
8
|
+
import { extractPreviewClientAction } from './extract-preview-action';
|
|
9
9
|
import { extractViewRelatedLinksAction } from './extract-view-related-links-action';
|
|
10
10
|
export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
|
|
11
11
|
var actionOptions = _ref.actionOptions,
|
|
@@ -37,17 +37,4 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
37
37
|
return Object.values(action).some(function (value) {
|
|
38
38
|
return Boolean(value);
|
|
39
39
|
}) ? action : undefined;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
44
|
-
* Replaced with extractFlexibleCardActions()
|
|
45
|
-
*/
|
|
46
|
-
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
47
|
-
var data = response.data;
|
|
48
|
-
var action = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response));
|
|
49
|
-
return Object.values(action).some(function (value) {
|
|
50
|
-
return Boolean(value);
|
|
51
|
-
}) ? action : undefined;
|
|
52
|
-
};
|
|
53
|
-
export default extractActions;
|
|
40
|
+
};
|
|
@@ -2,13 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { getExtensionKey } from '../../state/helpers';
|
|
7
6
|
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
8
7
|
import { CardAction } from '../../view/Card/types';
|
|
9
8
|
import { extractInvokePreviewAction } from '../action/extract-invoke-preview-action';
|
|
10
9
|
import { extractLozenge } from '../common/lozenge';
|
|
11
|
-
import { extractPreviewAction } from './actions/extract-preview-action';
|
|
12
10
|
import extractServerAction from './extract-server-action';
|
|
13
11
|
var toInvokeRequest = function toInvokeRequest(extensionKey, resourceIdentifiers, actionType, details) {
|
|
14
12
|
if (!actionType) {
|
|
@@ -39,8 +37,7 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
|
|
|
39
37
|
}
|
|
40
38
|
var read = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataRetrieval = action.dataRetrievalAction) === null || _action$dataRetrieval === void 0 ? void 0 : _action$dataRetrieval.name);
|
|
41
39
|
var url = extractLink(data);
|
|
42
|
-
var
|
|
43
|
-
var invokePreviewAction = response && fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokePreviewAction({
|
|
40
|
+
var invokePreviewAction = response ? extractInvokePreviewAction({
|
|
44
41
|
actionOptions: actionOptions,
|
|
45
42
|
appearance: appearance,
|
|
46
43
|
fireEvent: fireEvent,
|
|
@@ -54,7 +51,6 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
|
|
|
54
51
|
var details = {
|
|
55
52
|
id: id,
|
|
56
53
|
url: url,
|
|
57
|
-
previewData: previewData,
|
|
58
54
|
invokePreviewAction: invokePreviewAction
|
|
59
55
|
};
|
|
60
56
|
var update = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name, details);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["appearance", "fireEvent", "id", "origin", "renderers", "resolve", "actionOptions", "response", "aiSummaryConfig"];
|
|
3
3
|
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractTitle } from '@atlaskit/link-extractors';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { extractSummary } from '../common/primitives';
|
|
6
|
-
import
|
|
5
|
+
import { extractFlexibleCardActions } from './actions';
|
|
7
6
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
8
7
|
import extractPreview from './extract-preview';
|
|
9
8
|
import extractPriority from './extract-priority';
|
|
@@ -30,7 +29,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
30
29
|
var data = response.data;
|
|
31
30
|
var url = extractLink(data);
|
|
32
31
|
return {
|
|
33
|
-
actions:
|
|
32
|
+
actions: extractFlexibleCardActions({
|
|
34
33
|
actionOptions: actionOptions,
|
|
35
34
|
aiSummaryConfig: aiSummaryConfig,
|
|
36
35
|
appearance: appearance,
|
|
@@ -39,7 +38,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
39
38
|
origin: origin,
|
|
40
39
|
response: response,
|
|
41
40
|
url: props.url // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
|
42
|
-
})
|
|
41
|
+
}),
|
|
43
42
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
44
43
|
attachmentCount: extractAttachmentCount(data),
|
|
45
44
|
authorGroup: extractPersonCreatedBy(data),
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
2
|
import { useMemo } from 'react';
|
|
6
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
4
|
import { getUrl } from '@atlaskit/linking-common';
|
|
8
|
-
import {
|
|
5
|
+
import { invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent } from '../../utils/analytics';
|
|
9
6
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
10
|
-
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
11
7
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
12
8
|
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
13
9
|
if (event && event.attributes) {
|
|
@@ -61,174 +57,26 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
61
57
|
};
|
|
62
58
|
}, [defaultId, extractedDefinitionId, extractedExtensionKey, extractedResourceType, extractedSubproduct, extractedProduct, defaultLocation, extractedStatusDetails]);
|
|
63
59
|
|
|
64
|
-
/** Contains all
|
|
65
|
-
var
|
|
60
|
+
/** Contains all operational analytics events */
|
|
61
|
+
var operational = useMemo(function () {
|
|
66
62
|
return {
|
|
67
63
|
/**
|
|
68
|
-
* This fires an event that represents
|
|
69
|
-
* click a button.
|
|
70
|
-
* @param data A partial analytics event payload
|
|
71
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
72
|
-
*/
|
|
73
|
-
buttonClickedEvent: function buttonClickedEvent(data) {
|
|
74
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
75
|
-
action: 'clicked',
|
|
76
|
-
actionSubject: 'button',
|
|
77
|
-
actionSubjectId: data.actionSubjectId,
|
|
78
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
79
|
-
eventType: 'ui'
|
|
80
|
-
}, commonAttributes));
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
84
|
-
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
64
|
+
* This fires an event that represents an action being successfully invoked.
|
|
85
65
|
* @param id The unique ID for this Smart Link.
|
|
86
66
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
87
|
-
* @param actionType The type of
|
|
67
|
+
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
88
68
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
89
|
-
* @returns
|
|
90
69
|
*/
|
|
91
|
-
|
|
70
|
+
invokeSucceededEvent: function invokeSucceededEvent(_ref) {
|
|
92
71
|
var id = _ref.id,
|
|
93
72
|
actionType = _ref.actionType,
|
|
94
73
|
display = _ref.display,
|
|
95
|
-
|
|
74
|
+
extensionKey = _ref.extensionKey,
|
|
96
75
|
definitionId = _ref.definitionId,
|
|
97
76
|
resourceType = _ref.resourceType,
|
|
98
77
|
destinationProduct = _ref.destinationProduct,
|
|
99
78
|
destinationSubproduct = _ref.destinationSubproduct,
|
|
100
79
|
location = _ref.location;
|
|
101
|
-
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
102
|
-
dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
|
|
103
|
-
id: id !== null && id !== void 0 ? id : defaultId,
|
|
104
|
-
actionType: actionType,
|
|
105
|
-
display: display,
|
|
106
|
-
extensionKey: extensionKey,
|
|
107
|
-
definitionId: definitionId,
|
|
108
|
-
resourceType: resourceType,
|
|
109
|
-
destinationProduct: destinationProduct,
|
|
110
|
-
destinationSubproduct: destinationSubproduct,
|
|
111
|
-
location: location
|
|
112
|
-
}), commonAttributes));
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* This fires an event that represents when a user close a modal.
|
|
116
|
-
* @param data A partial analytics event payload
|
|
117
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
118
|
-
*/
|
|
119
|
-
modalClosedEvent: function modalClosedEvent(data) {
|
|
120
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
121
|
-
action: 'closed',
|
|
122
|
-
actionSubject: 'modal',
|
|
123
|
-
actionSubjectId: data.actionSubjectId,
|
|
124
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
125
|
-
eventType: 'ui'
|
|
126
|
-
}, commonAttributes));
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* This fires an event that represents when a Smart Link was rendered successfully.
|
|
130
|
-
* Note: this fires even if the Smart Link request errored out.
|
|
131
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
132
|
-
* @param id The unique ID for this Smart Link.
|
|
133
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
134
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
135
|
-
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
136
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
137
|
-
*/
|
|
138
|
-
renderSuccessEvent: function renderSuccessEvent(_ref2) {
|
|
139
|
-
var display = _ref2.display,
|
|
140
|
-
status = _ref2.status,
|
|
141
|
-
id = _ref2.id,
|
|
142
|
-
extensionKey = _ref2.extensionKey,
|
|
143
|
-
definitionId = _ref2.definitionId,
|
|
144
|
-
resourceType = _ref2.resourceType,
|
|
145
|
-
destinationProduct = _ref2.destinationProduct,
|
|
146
|
-
destinationSubproduct = _ref2.destinationSubproduct,
|
|
147
|
-
location = _ref2.location,
|
|
148
|
-
_ref2$canBeDatasource = _ref2.canBeDatasource,
|
|
149
|
-
canBeDatasource = _ref2$canBeDatasource === void 0 ? false : _ref2$canBeDatasource;
|
|
150
|
-
var experienceId = id ? id : defaultId;
|
|
151
|
-
succeedUfoExperience('smart-link-rendered', experienceId, {
|
|
152
|
-
extensionKey: extensionKey,
|
|
153
|
-
display: display
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// UFO will disregard this if authentication experience has not yet been started
|
|
157
|
-
succeedUfoExperience('smart-link-authenticated', experienceId, {
|
|
158
|
-
display: display
|
|
159
|
-
});
|
|
160
|
-
dispatchAnalytics(applyCommonAttributes(uiRenderSuccessEvent({
|
|
161
|
-
display: display,
|
|
162
|
-
status: status,
|
|
163
|
-
extensionKey: extensionKey,
|
|
164
|
-
definitionId: definitionId,
|
|
165
|
-
resourceType: resourceType,
|
|
166
|
-
destinationProduct: destinationProduct,
|
|
167
|
-
destinationSubproduct: destinationSubproduct,
|
|
168
|
-
location: location,
|
|
169
|
-
canBeDatasource: canBeDatasource
|
|
170
|
-
}), commonAttributes));
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* This fires an event that represents when a Smart Link renders unsuccessfuly.
|
|
174
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
175
|
-
* @param id The unique ID for this Smart Link.
|
|
176
|
-
* @param error: An error representing why the Smart Link render failed.
|
|
177
|
-
* @param errorInfo: Additional details about the error including the stack trace.
|
|
178
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
179
|
-
*/
|
|
180
|
-
renderFailedEvent: function renderFailedEvent(_ref3) {
|
|
181
|
-
var display = _ref3.display,
|
|
182
|
-
id = _ref3.id,
|
|
183
|
-
error = _ref3.error,
|
|
184
|
-
errorInfo = _ref3.errorInfo,
|
|
185
|
-
extensionKey = _ref3.extensionKey,
|
|
186
|
-
definitionId = _ref3.definitionId,
|
|
187
|
-
resourceType = _ref3.resourceType,
|
|
188
|
-
destinationProduct = _ref3.destinationProduct,
|
|
189
|
-
destinationSubproduct = _ref3.destinationSubproduct,
|
|
190
|
-
location = _ref3.location;
|
|
191
|
-
var experienceId = id ? id : defaultId;
|
|
192
|
-
// Start and fail the smart-link-rendered experience. If it has already
|
|
193
|
-
// been started nothing happens.
|
|
194
|
-
startUfoExperience('smart-link-rendered', experienceId);
|
|
195
|
-
failUfoExperience('smart-link-rendered', experienceId);
|
|
196
|
-
failUfoExperience('smart-link-authenticated', experienceId);
|
|
197
|
-
dispatchAnalytics(applyCommonAttributes(uiRenderFailedEvent({
|
|
198
|
-
display: display,
|
|
199
|
-
error: error,
|
|
200
|
-
errorInfo: errorInfo,
|
|
201
|
-
extensionKey: extensionKey,
|
|
202
|
-
definitionId: definitionId,
|
|
203
|
-
resourceType: resourceType,
|
|
204
|
-
destinationProduct: destinationProduct,
|
|
205
|
-
destinationSubproduct: destinationSubproduct,
|
|
206
|
-
location: location
|
|
207
|
-
}), commonAttributes));
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
211
|
-
|
|
212
|
-
/** Contains all operational analytics events */
|
|
213
|
-
var operational = useMemo(function () {
|
|
214
|
-
return {
|
|
215
|
-
/**
|
|
216
|
-
* This fires an event that represents an action being successfully invoked.
|
|
217
|
-
* @param id The unique ID for this Smart Link.
|
|
218
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
219
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
220
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
221
|
-
*/
|
|
222
|
-
invokeSucceededEvent: function invokeSucceededEvent(_ref4) {
|
|
223
|
-
var id = _ref4.id,
|
|
224
|
-
actionType = _ref4.actionType,
|
|
225
|
-
display = _ref4.display,
|
|
226
|
-
extensionKey = _ref4.extensionKey,
|
|
227
|
-
definitionId = _ref4.definitionId,
|
|
228
|
-
resourceType = _ref4.resourceType,
|
|
229
|
-
destinationProduct = _ref4.destinationProduct,
|
|
230
|
-
destinationSubproduct = _ref4.destinationSubproduct,
|
|
231
|
-
location = _ref4.location;
|
|
232
80
|
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
233
81
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
234
82
|
actionType: actionType,
|
|
@@ -249,17 +97,17 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
249
97
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
250
98
|
* @param reason The reason the invocation failed.
|
|
251
99
|
*/
|
|
252
|
-
invokeFailedEvent: function invokeFailedEvent(
|
|
253
|
-
var id =
|
|
254
|
-
actionType =
|
|
255
|
-
display =
|
|
256
|
-
reason =
|
|
257
|
-
extensionKey =
|
|
258
|
-
definitionId =
|
|
259
|
-
resourceType =
|
|
260
|
-
destinationProduct =
|
|
261
|
-
destinationSubproduct =
|
|
262
|
-
location =
|
|
100
|
+
invokeFailedEvent: function invokeFailedEvent(_ref2) {
|
|
101
|
+
var id = _ref2.id,
|
|
102
|
+
actionType = _ref2.actionType,
|
|
103
|
+
display = _ref2.display,
|
|
104
|
+
reason = _ref2.reason,
|
|
105
|
+
extensionKey = _ref2.extensionKey,
|
|
106
|
+
definitionId = _ref2.definitionId,
|
|
107
|
+
resourceType = _ref2.resourceType,
|
|
108
|
+
destinationProduct = _ref2.destinationProduct,
|
|
109
|
+
destinationSubproduct = _ref2.destinationSubproduct,
|
|
110
|
+
location = _ref2.location;
|
|
263
111
|
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
264
112
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
265
113
|
actionType: actionType,
|
|
@@ -275,30 +123,10 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
275
123
|
}
|
|
276
124
|
};
|
|
277
125
|
}, [defaultId, commonAttributes, dispatchAnalytics]);
|
|
278
|
-
|
|
279
|
-
/** Contains all screen analytics events */
|
|
280
|
-
var screen = useMemo(function () {
|
|
281
|
-
return {
|
|
282
|
-
/**
|
|
283
|
-
* This fires an event that represents when a user view a modal.
|
|
284
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
285
|
-
*/
|
|
286
|
-
modalViewedEvent: function modalViewedEvent(data) {
|
|
287
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
288
|
-
action: 'viewed',
|
|
289
|
-
actionSubject: data.name,
|
|
290
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
291
|
-
eventType: 'screen',
|
|
292
|
-
name: data.name
|
|
293
|
-
}, commonAttributes));
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}, [commonAttributes, dispatchAnalytics]);
|
|
297
126
|
return useMemo(function () {
|
|
298
127
|
return {
|
|
299
|
-
ui: ui,
|
|
300
128
|
operational: operational,
|
|
301
129
|
screen: screen
|
|
302
130
|
};
|
|
303
|
-
}, [
|
|
131
|
+
}, [operational]);
|
|
304
132
|
};
|
|
@@ -2,7 +2,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
7
6
|
import * as measure from '../../../utils/performance';
|
|
8
7
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
@@ -12,14 +11,13 @@ var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
|
12
11
|
* Invoke client action such as preview, download and open link
|
|
13
12
|
*/
|
|
14
13
|
var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
15
|
-
var
|
|
16
|
-
fireEventProp = _ref.fireEvent;
|
|
14
|
+
var fireEventProp = _ref.fireEvent;
|
|
17
15
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
18
16
|
defaultFireEvent = _useAnalyticsEvents.fireEvent;
|
|
19
17
|
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
20
18
|
return useCallback( /*#__PURE__*/function () {
|
|
21
19
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
22
|
-
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName,
|
|
20
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
23
21
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
22
|
while (1) switch (_context.prev = _context.next) {
|
|
25
23
|
case 0:
|
|
@@ -37,7 +35,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
// Begin analytics instrumentation.
|
|
40
|
-
if (actionSubjectId
|
|
38
|
+
if (actionSubjectId !== undefined) {
|
|
41
39
|
fireEvent("ui.button.clicked.".concat(actionSubjectId), {
|
|
42
40
|
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
43
41
|
definitionId: definitionId,
|
|
@@ -45,13 +43,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
45
43
|
id: id !== null && id !== void 0 ? id : experienceId,
|
|
46
44
|
resourceType: resourceType
|
|
47
45
|
});
|
|
48
|
-
} else {
|
|
49
|
-
analytics === null || analytics === void 0 || analytics.ui.actionClickedEvent({
|
|
50
|
-
actionType: actionType,
|
|
51
|
-
display: display
|
|
52
|
-
});
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
// Invoke action
|
|
56
48
|
_context.next = 9;
|
|
57
49
|
return actionFn();
|
|
@@ -59,21 +51,14 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
59
51
|
result = _context.sent;
|
|
60
52
|
measure.mark(markName, 'resolved');
|
|
61
53
|
succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
analytics === null || analytics === void 0 || analytics.operational.invokeSucceededEvent({
|
|
73
|
-
actionType: actionType,
|
|
74
|
-
display: display
|
|
75
|
-
});
|
|
76
|
-
}
|
|
54
|
+
fireEvent('operational.smartLinkAction.resolved', {
|
|
55
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
56
|
+
definitionId: definitionId,
|
|
57
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
58
|
+
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(markName, 'resolved')) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null,
|
|
59
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
60
|
+
resourceType: resourceType
|
|
61
|
+
});
|
|
77
62
|
return _context.abrupt("return", result);
|
|
78
63
|
case 16:
|
|
79
64
|
_context.prev = 16;
|
|
@@ -81,23 +66,15 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
81
66
|
measure.mark(markName, 'errored');
|
|
82
67
|
failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
83
68
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
analytics === null || analytics === void 0 || analytics.operational.invokeFailedEvent({
|
|
96
|
-
actionType: actionType,
|
|
97
|
-
display: display,
|
|
98
|
-
reason: reason
|
|
99
|
-
});
|
|
100
|
-
}
|
|
69
|
+
fireEvent('operational.smartLinkAction.unresolved', {
|
|
70
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
71
|
+
definitionId: definitionId,
|
|
72
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
73
|
+
duration: (_measure$getMeasure$d2 = (_measure$getMeasure2 = measure.getMeasure(markName, 'errored')) === null || _measure$getMeasure2 === void 0 ? void 0 : _measure$getMeasure2.duration) !== null && _measure$getMeasure$d2 !== void 0 ? _measure$getMeasure$d2 : null,
|
|
74
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
75
|
+
reason: reason,
|
|
76
|
+
resourceType: resourceType
|
|
77
|
+
});
|
|
101
78
|
case 22:
|
|
102
79
|
case "end":
|
|
103
80
|
return _context.stop();
|
|
@@ -107,6 +84,6 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
107
84
|
return function (_x) {
|
|
108
85
|
return _ref3.apply(this, arguments);
|
|
109
86
|
};
|
|
110
|
-
}(), [
|
|
87
|
+
}(), [fireEvent]);
|
|
111
88
|
};
|
|
112
89
|
export default useInvokeClientAction;
|