@atlaskit/smart-card 33.1.0 → 33.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 +16 -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/actions/index.js +2 -4
- package/dist/cjs/state/analytics/index.js +1 -8
- package/dist/cjs/state/flexible-ui-context/index.js +1 -10
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks/useSmartLink.js +1 -4
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/cjs/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/cjs/state/index.js +1 -8
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +2 -144
- package/dist/cjs/utils/analytics/index.js +0 -30
- package/dist/cjs/utils/analytics/types.js +1 -5
- package/dist/cjs/utils/mocks.js +1 -23
- package/dist/cjs/view/BlockCard/index.js +1 -3
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/cjs/view/CardWithUrl/component.js +13 -33
- package/dist/cjs/view/CardWithUrl/loader.js +10 -22
- package/dist/cjs/view/EmbedCard/index.js +0 -4
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +9 -68
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +27 -67
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +5 -44
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +5 -51
- 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/FlexibleCard/index.js +3 -17
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/InlineCard/index.js +1 -3
- 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/actions/index.js +2 -4
- package/dist/es2019/state/analytics/index.js +1 -2
- package/dist/es2019/state/flexible-ui-context/index.js +0 -7
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks/useSmartLink.js +1 -4
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/es2019/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/es2019/state/index.js +1 -2
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +2 -145
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/utils/analytics/types.js +0 -1
- package/dist/es2019/utils/mocks.js +1 -23
- package/dist/es2019/view/BlockCard/index.js +1 -3
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +1 -3
- package/dist/es2019/view/CardWithUrl/component.js +14 -34
- package/dist/es2019/view/CardWithUrl/loader.js +11 -23
- package/dist/es2019/view/EmbedCard/index.js +0 -4
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +1 -3
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -35
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +13 -37
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +6 -27
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -32
- 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/FlexibleCard/index.js +3 -15
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +2 -4
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/InlineCard/index.js +0 -2
- 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/actions/index.js +2 -4
- package/dist/esm/state/analytics/index.js +1 -2
- package/dist/esm/state/flexible-ui-context/index.js +0 -9
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks/useSmartLink.js +1 -4
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/esm/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/esm/state/index.js +1 -2
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -143
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/utils/analytics/types.js +0 -1
- package/dist/esm/utils/mocks.js +0 -22
- package/dist/esm/view/BlockCard/index.js +1 -3
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/esm/view/CardWithUrl/component.js +14 -34
- package/dist/esm/view/CardWithUrl/loader.js +10 -22
- package/dist/esm/view/EmbedCard/index.js +0 -4
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +11 -70
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +28 -68
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +6 -45
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -52
- 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/FlexibleCard/index.js +4 -18
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/InlineCard/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/actions/types.d.ts +0 -2
- 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/actions/index.d.ts +1 -2
- package/dist/types/state/analytics/index.d.ts +0 -2
- package/dist/types/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -25
- 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/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types/state/index.d.ts +0 -1
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +0 -6
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +0 -42
- package/dist/types/utils/mocks.d.ts +0 -22
- package/dist/types/view/BlockCard/index.d.ts +1 -1
- package/dist/types/view/BlockCard/types.d.ts +0 -2
- package/dist/types/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types/view/EmbedModal/components/analytics/types.d.ts +0 -2
- 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/FlexibleCard/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +0 -6
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types/view/HoverCard/types.d.ts +0 -3
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types/view/InlineCard/index.d.ts +1 -1
- package/dist/types/view/InlineCard/types.d.ts +0 -2
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +0 -6
- package/dist/types-ts4.5/extractors/common/actions/types.d.ts +0 -2
- 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/actions/index.d.ts +1 -2
- package/dist/types-ts4.5/state/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -25
- 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/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types-ts4.5/state/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -6
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -42
- package/dist/types-ts4.5/utils/mocks.d.ts +0 -22
- package/dist/types-ts4.5/view/BlockCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/BlockCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/components/analytics/types.d.ts +0 -2
- 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/FlexibleCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.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/HoverCardContent.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +0 -6
- 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/cjs/state/analytics/useSmartLinkAnalytics.js +0 -311
- 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/es2019/state/analytics/useSmartLinkAnalytics.js +0 -296
- 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/esm/state/analytics/useSmartLinkAnalytics.js +0 -304
- 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/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types/utils/analytics/__mocks__/analytics.d.ts +0 -2
- 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/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types-ts4.5/utils/analytics/__mocks__/analytics.d.ts +0 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -10,10 +10,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
import React, { useCallback, useState } from 'react';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import LinkIcon from '@atlaskit/icon/core/migration/link';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { ActionName } from '../../../../../constants';
|
|
15
14
|
import { messages } from '../../../../../messages';
|
|
16
|
-
import {
|
|
15
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
17
16
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
18
17
|
import Action from '../action';
|
|
19
18
|
var CopyLinkAction = function CopyLinkAction(_ref) {
|
|
@@ -21,79 +20,40 @@ var CopyLinkAction = function CopyLinkAction(_ref) {
|
|
|
21
20
|
var onClickCallback = _ref.onClick,
|
|
22
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
22
|
var context = useFlexibleUiContext();
|
|
24
|
-
var
|
|
25
|
-
var invoke = useInvokeClientAction({
|
|
26
|
-
analytics: analytics
|
|
27
|
-
});
|
|
23
|
+
var invoke = useInvokeClientAction({});
|
|
28
24
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.CopyLinkAction];
|
|
29
25
|
var _useState = useState(messages.copy_url_to_clipboard),
|
|
30
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
27
|
tooltipMessage = _useState2[0],
|
|
32
28
|
setTooltipMessage = _useState2[1];
|
|
33
29
|
var onClick = useCallback(function () {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
if (data && data.url) {
|
|
63
|
-
invoke({
|
|
64
|
-
actionType: ActionName.CopyLinkAction,
|
|
65
|
-
actionFn: function () {
|
|
66
|
-
var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
67
|
-
var _data$url;
|
|
68
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
69
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
70
|
-
case 0:
|
|
71
|
-
_context2.next = 2;
|
|
72
|
-
return navigator.clipboard.writeText((_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : '');
|
|
73
|
-
case 2:
|
|
74
|
-
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
75
|
-
case 3:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee2);
|
|
80
|
-
}));
|
|
81
|
-
function actionFn() {
|
|
82
|
-
return _actionFn2.apply(this, arguments);
|
|
83
|
-
}
|
|
84
|
-
return actionFn;
|
|
85
|
-
}(),
|
|
86
|
-
// These values have already been set in analytics context.
|
|
87
|
-
// We only pass these here for ufo experience.
|
|
88
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
89
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (onClickCallback) {
|
|
93
|
-
onClickCallback();
|
|
94
|
-
}
|
|
30
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
31
|
+
invoke(_objectSpread(_objectSpread({}, data.invokeAction), {}, {
|
|
32
|
+
actionFn: function () {
|
|
33
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
34
|
+
var _data$invokeAction;
|
|
35
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
_context.next = 2;
|
|
39
|
+
return (_data$invokeAction = data.invokeAction) === null || _data$invokeAction === void 0 ? void 0 : _data$invokeAction.actionFn();
|
|
40
|
+
case 2:
|
|
41
|
+
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
42
|
+
case 3:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
function actionFn() {
|
|
49
|
+
return _actionFn.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
return actionFn;
|
|
52
|
+
}()
|
|
53
|
+
}));
|
|
54
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
95
55
|
}
|
|
96
|
-
}, [
|
|
56
|
+
}, [data, invoke, onClickCallback]);
|
|
97
57
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
98
58
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_url_to_clipboard),
|
|
99
59
|
icon: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
@@ -1,66 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
3
|
var _excluded = ["onClick"];
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
4
|
import React, { useCallback } from 'react';
|
|
7
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
6
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
7
|
import { ActionName } from '../../../../../constants';
|
|
11
8
|
import { messages } from '../../../../../messages';
|
|
12
|
-
import {
|
|
9
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
13
10
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
14
|
-
import { downloadUrl as download } from '../../../../../utils';
|
|
15
11
|
import Action from '../action';
|
|
16
12
|
var DownloadAction = function DownloadAction(_ref) {
|
|
17
13
|
var _context$actions;
|
|
18
14
|
var onClickCallback = _ref.onClick,
|
|
19
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
16
|
var context = useFlexibleUiContext();
|
|
21
|
-
var
|
|
22
|
-
var invoke = useInvokeClientAction({
|
|
23
|
-
analytics: analytics
|
|
24
|
-
});
|
|
17
|
+
var invoke = useInvokeClientAction({});
|
|
25
18
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.DownloadAction];
|
|
26
19
|
var onClick = useCallback(function () {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
if (data !== null && data !== void 0 && data.downloadUrl) {
|
|
34
|
-
invoke({
|
|
35
|
-
actionType: ActionName.DownloadAction,
|
|
36
|
-
actionFn: function () {
|
|
37
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
return _context.abrupt("return", download(data === null || data === void 0 ? void 0 : data.downloadUrl));
|
|
42
|
-
case 1:
|
|
43
|
-
case "end":
|
|
44
|
-
return _context.stop();
|
|
45
|
-
}
|
|
46
|
-
}, _callee);
|
|
47
|
-
}));
|
|
48
|
-
function actionFn() {
|
|
49
|
-
return _actionFn.apply(this, arguments);
|
|
50
|
-
}
|
|
51
|
-
return actionFn;
|
|
52
|
-
}(),
|
|
53
|
-
// These values have already been set in analytics context.
|
|
54
|
-
// We only pass these here for ufo experience.
|
|
55
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
56
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
57
|
-
});
|
|
58
|
-
if (onClickCallback) {
|
|
59
|
-
onClickCallback();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
20
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
21
|
+
invoke(data.invokeAction);
|
|
22
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
62
23
|
}
|
|
63
|
-
}, [
|
|
24
|
+
}, [data, invoke, onClickCallback]);
|
|
64
25
|
var isStackItem = props.as === 'stack-item';
|
|
65
26
|
var label = isStackItem ? messages.download_file : messages.download;
|
|
66
27
|
var tooltipMessage = isStackItem ? messages.download_description : messages.download;
|
|
@@ -1,73 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
3
|
var _excluded = ["onClick"];
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
4
|
import React, { useCallback } from 'react';
|
|
10
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
6
|
import MediaServicesActualSizeIcon from '@atlaskit/icon/core/migration/grow-diagonal--media-services-actual-size';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
7
|
import { ActionName } from '../../../../../constants';
|
|
14
8
|
import { messages } from '../../../../../messages';
|
|
15
|
-
import {
|
|
9
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
16
10
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
17
|
-
import { openEmbedModalWithFlexibleUiIcon } from '../../utils';
|
|
18
11
|
import Action from '../action';
|
|
19
12
|
var PreviewAction = function PreviewAction(_ref) {
|
|
20
13
|
var _context$actions;
|
|
21
14
|
var onClickCallback = _ref.onClick,
|
|
22
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
16
|
var context = useFlexibleUiContext();
|
|
24
|
-
var
|
|
25
|
-
var invoke = useInvokeClientAction({
|
|
26
|
-
analytics: analytics
|
|
27
|
-
});
|
|
17
|
+
var invoke = useInvokeClientAction({});
|
|
28
18
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
|
|
29
19
|
var onClick = useCallback(function () {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
if (data) {
|
|
37
|
-
invoke({
|
|
38
|
-
actionType: ActionName.PreviewAction,
|
|
39
|
-
actionFn: function () {
|
|
40
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
41
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) switch (_context.prev = _context.next) {
|
|
43
|
-
case 0:
|
|
44
|
-
return _context.abrupt("return", openEmbedModalWithFlexibleUiIcon(_objectSpread({
|
|
45
|
-
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
46
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey,
|
|
47
|
-
analytics: analytics
|
|
48
|
-
}, data)));
|
|
49
|
-
case 1:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee);
|
|
54
|
-
}));
|
|
55
|
-
function actionFn() {
|
|
56
|
-
return _actionFn.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
return actionFn;
|
|
59
|
-
}(),
|
|
60
|
-
// These values have already been set in analytics context.
|
|
61
|
-
// We only pass these here for ufo experience.
|
|
62
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
63
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (onClickCallback) {
|
|
67
|
-
onClickCallback();
|
|
68
|
-
}
|
|
20
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
21
|
+
invoke(data.invokeAction);
|
|
22
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
69
23
|
}
|
|
70
|
-
}, [
|
|
24
|
+
}, [data, invoke, onClickCallback]);
|
|
71
25
|
var isStackItem = props.as === 'stack-item';
|
|
72
26
|
var tooltipMessage = isStackItem ? messages.preview_description : messages.preview_improved;
|
|
73
27
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
@@ -79,7 +79,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
79
79
|
var _ref2 = (action === null || action === void 0 || (_action$update = action.update) === null || _action$update === void 0 ? void 0 : _action$update.details) || {},
|
|
80
80
|
url = _ref2.url,
|
|
81
81
|
linkId = _ref2.id,
|
|
82
|
-
|
|
82
|
+
invokePreviewAction = _ref2.invokePreviewAction;
|
|
83
83
|
var handleOpenChange = useCallback( /*#__PURE__*/function () {
|
|
84
84
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(args) {
|
|
85
85
|
var responseItems, validItems;
|
|
@@ -212,7 +212,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
212
212
|
errorMessage: errorMessage,
|
|
213
213
|
testId: testId,
|
|
214
214
|
url: url,
|
|
215
|
-
|
|
215
|
+
invokePreviewAction: invokePreviewAction
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
if (items && items.length > 0) {
|
|
@@ -222,7 +222,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
222
222
|
onClick: handleItemClick
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
}, [errorMessage, handleItemClick, items,
|
|
225
|
+
}, [errorMessage, handleItemClick, items, invokePreviewAction, testId, url]);
|
|
226
226
|
return jsx(DropdownMenu, {
|
|
227
227
|
isLoading: isLoading,
|
|
228
228
|
isOpen: isOpen,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
-
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
1
|
/**
|
|
5
2
|
* @jsxRuntime classic
|
|
6
3
|
* @jsx jsx
|
|
@@ -12,14 +9,11 @@ import { jsx } from '@emotion/react';
|
|
|
12
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
13
10
|
import { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
14
11
|
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
12
|
import { R50, R500 } from '@atlaskit/theme/colors';
|
|
17
13
|
import { useAnalyticsEvents } from '../../../../../../../common/analytics/generated/use-analytics-events';
|
|
18
14
|
import { messages } from '../../../../../../../messages';
|
|
19
|
-
import { useFlexibleUiAnalyticsContext } from '../../../../../../../state/flexible-ui-context';
|
|
20
15
|
import useInvokeClientAction from '../../../../../../../state/hooks/use-invoke-client-action';
|
|
21
|
-
import
|
|
22
|
-
import { getFormattedMessage, openEmbedModalWithFlexibleUiIcon } from '../../../../utils';
|
|
16
|
+
import { getFormattedMessage } from '../../../../utils';
|
|
23
17
|
import { contentStyles, dropdownItemGroupStyles, linkStyles, textStyles } from './styled';
|
|
24
18
|
var MAX_LINE_NUMBER = 8;
|
|
25
19
|
var LozengeActionError = function LozengeActionError(_ref) {
|
|
@@ -27,33 +21,19 @@ var LozengeActionError = function LozengeActionError(_ref) {
|
|
|
27
21
|
testId = _ref.testId,
|
|
28
22
|
_ref$maxLineNumber = _ref.maxLineNumber,
|
|
29
23
|
maxLineNumber = _ref$maxLineNumber === void 0 ? MAX_LINE_NUMBER : _ref$maxLineNumber,
|
|
30
|
-
invokePreviewAction = _ref.invokePreviewAction
|
|
31
|
-
url = _ref.url,
|
|
32
|
-
previewData = _ref.previewData;
|
|
24
|
+
invokePreviewAction = _ref.invokePreviewAction;
|
|
33
25
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
34
26
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
35
|
-
var reload = useResolve();
|
|
36
|
-
var analytics = useFlexibleUiAnalyticsContext();
|
|
37
27
|
var invoke = useInvokeClientAction({});
|
|
38
|
-
var isPreviewAvailable =
|
|
39
|
-
var handlePreviewClose = useCallback(function () {
|
|
40
|
-
if (url) {
|
|
41
|
-
reload(url, true);
|
|
42
|
-
}
|
|
43
|
-
}, [reload, url]);
|
|
28
|
+
var isPreviewAvailable = invokePreviewAction !== undefined;
|
|
44
29
|
var handlePreviewOpen = useCallback(function () {
|
|
45
30
|
if (isPreviewAvailable) {
|
|
46
31
|
fireEvent('ui.button.clicked.smartLinkStatusOpenPreview', {});
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
return openEmbedModalWithFlexibleUiIcon(_objectSpread(_objectSpread({}, previewData), {}, {
|
|
51
|
-
analytics: analytics,
|
|
52
|
-
onClose: handlePreviewClose
|
|
53
|
-
}));
|
|
32
|
+
if (invokePreviewAction) {
|
|
33
|
+
invoke(invokePreviewAction);
|
|
54
34
|
}
|
|
55
35
|
}
|
|
56
|
-
}, [
|
|
36
|
+
}, [isPreviewAvailable, invoke, invokePreviewAction, fireEvent]);
|
|
57
37
|
var content = useMemo(function () {
|
|
58
38
|
return jsx(Fragment, null, jsx("div", {
|
|
59
39
|
css: contentStyles
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
var _excluded = ["linkIcon"];
|
|
6
4
|
var _templateObject;
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
5
|
import React from 'react';
|
|
10
6
|
|
|
11
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -13,8 +9,6 @@ import { css } from '@emotion/react';
|
|
|
13
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
14
10
|
import Loadable from 'react-loadable';
|
|
15
11
|
import { SmartLinkSize } from '../../../constants';
|
|
16
|
-
import { openEmbedModal } from '../../EmbedModal/utils';
|
|
17
|
-
import Icon from './elements/icon';
|
|
18
12
|
export var sizeToButtonSpacing = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, SmartLinkSize.Small, 'none'), SmartLinkSize.Medium, 'compact'), SmartLinkSize.Large, 'compact'), SmartLinkSize.XLarge, 'default');
|
|
19
13
|
export var getFormattedMessage = function getFormattedMessage(message) {
|
|
20
14
|
if (message) {
|
|
@@ -193,25 +187,4 @@ export var getTruncateStyles = function getTruncateStyles(maxLines) {
|
|
|
193
187
|
};
|
|
194
188
|
export var hasWhiteSpace = function hasWhiteSpace(str) {
|
|
195
189
|
return str.search(/\s/) >= 0;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
200
|
-
*/
|
|
201
|
-
export var openEmbedModalWithFlexibleUiIcon = function openEmbedModalWithFlexibleUiIcon(_ref) {
|
|
202
|
-
var linkIcon = _ref.linkIcon,
|
|
203
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
204
|
-
var icon = {
|
|
205
|
-
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
206
|
-
size: SmartLinkSize.Large
|
|
207
|
-
})),
|
|
208
|
-
isFlexibleUi: true
|
|
209
|
-
};
|
|
210
|
-
return openEmbedModal(_objectSpread(_objectSpread({}, props), {}, {
|
|
211
|
-
icon: icon,
|
|
212
|
-
// Flex should not send origin as block card. It should be able to support
|
|
213
|
-
// its internal parent components like hover card, block card and
|
|
214
|
-
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
215
|
-
origin: 'smartLinkCard'
|
|
216
|
-
}));
|
|
217
190
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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 React, { useEffect, useMemo } from 'react';
|
|
6
3
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
7
4
|
import { SmartLinkStatus } from '../../constants';
|
|
8
|
-
import {
|
|
5
|
+
import { FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
9
6
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
10
7
|
import useResolve from '../../state/hooks/use-resolve';
|
|
11
8
|
import Container from './components/container';
|
|
@@ -18,9 +15,7 @@ import { getContextByStatus, getRetryOptions } from './utils';
|
|
|
18
15
|
* @see Container
|
|
19
16
|
*/
|
|
20
17
|
var FlexibleCard = function FlexibleCard(_ref) {
|
|
21
|
-
var
|
|
22
|
-
var analytics = _ref.analytics,
|
|
23
|
-
_ref$appearance = _ref.appearance,
|
|
18
|
+
var _ref$appearance = _ref.appearance,
|
|
24
19
|
appearance = _ref$appearance === void 0 ? 'flexible' : _ref$appearance,
|
|
25
20
|
cardState = _ref.cardState,
|
|
26
21
|
children = _ref.children,
|
|
@@ -62,13 +57,6 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
62
57
|
var retry = getRetryOptions(url, status, details, onAuthorize);
|
|
63
58
|
var _ref2 = context || {},
|
|
64
59
|
title = _ref2.title;
|
|
65
|
-
var analyticsContext = useMemo(function () {
|
|
66
|
-
var _details$meta;
|
|
67
|
-
return analytics ? _objectSpread(_objectSpread({}, analytics), {}, {
|
|
68
|
-
display: appearance,
|
|
69
|
-
extensionKey: details === null || details === void 0 || (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.key
|
|
70
|
-
}) : undefined;
|
|
71
|
-
}, [analytics, appearance, details === null || details === void 0 || (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.key]);
|
|
72
60
|
useEffect(function () {
|
|
73
61
|
switch (status) {
|
|
74
62
|
case SmartLinkStatus.Resolved:
|
|
@@ -93,9 +81,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
93
81
|
break;
|
|
94
82
|
}
|
|
95
83
|
}, [onError, onResolve, status, title, url]);
|
|
96
|
-
return /*#__PURE__*/React.createElement(
|
|
97
|
-
value: analyticsContext
|
|
98
|
-
}, /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
84
|
+
return /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
99
85
|
value: ui
|
|
100
86
|
}, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
|
|
101
87
|
value: context
|
|
@@ -108,6 +94,6 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
108
94
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
109
95
|
actionOptions: actionOptions,
|
|
110
96
|
status: status
|
|
111
|
-
}), children)))
|
|
97
|
+
}), children)));
|
|
112
98
|
};
|
|
113
99
|
export default FlexibleCard;
|
|
@@ -13,7 +13,6 @@ import { jsx } from '@emotion/react';
|
|
|
13
13
|
import Popup from '@atlaskit/popup';
|
|
14
14
|
import { ActionName, CardDisplay } from '../../../constants';
|
|
15
15
|
import { useSmartCardActions } from '../../../state/actions';
|
|
16
|
-
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
17
16
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
18
17
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
19
18
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -55,8 +54,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
55
54
|
var parentSpan = useRef(null);
|
|
56
55
|
var renderers = useSmartLinkRenderers();
|
|
57
56
|
var linkState = useLinkState(url);
|
|
58
|
-
var
|
|
59
|
-
var _useSmartCardActions = useSmartCardActions(id, url, analytics),
|
|
57
|
+
var _useSmartCardActions = useSmartCardActions(id, url),
|
|
60
58
|
loadMetadata = _useSmartCardActions.loadMetadata;
|
|
61
59
|
var setMousePosition = useCallback(function (event) {
|
|
62
60
|
if (isOpen && canOpen) {
|
|
@@ -10,7 +10,6 @@ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytic
|
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
11
11
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
12
12
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
13
|
-
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
14
13
|
import { getDefinitionId, getExtensionKey, getServices } from '../../../state/helpers';
|
|
15
14
|
import { useSmartCardState } from '../../../state/store';
|
|
16
15
|
import { isSpecialEvent } from '../../../utils';
|
|
@@ -28,7 +27,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
28
27
|
var _linkState$status, _cardState$details;
|
|
29
28
|
var _ref$id = _ref.id,
|
|
30
29
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
31
|
-
_analytics = _ref.analytics,
|
|
32
30
|
cardState = _ref.cardState,
|
|
33
31
|
onActionClick = _ref.onActionClick,
|
|
34
32
|
onResolve = _ref.onResolve,
|
|
@@ -41,8 +39,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
41
39
|
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
42
40
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
43
41
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
44
|
-
var defaultAnalytics = useSmartLinkAnalytics(url, id);
|
|
45
|
-
var analytics = _analytics !== null && _analytics !== void 0 ? _analytics : defaultAnalytics;
|
|
46
42
|
var extensionKey = useMemo(function () {
|
|
47
43
|
return getExtensionKey(cardState.details);
|
|
48
44
|
}, [cardState.details]);
|
|
@@ -126,8 +122,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
126
122
|
actionOptions: actionOptions,
|
|
127
123
|
ui: flexibleUiOptions,
|
|
128
124
|
url: url,
|
|
129
|
-
children: null
|
|
130
|
-
analytics: analytics
|
|
125
|
+
children: null
|
|
131
126
|
};
|
|
132
127
|
var onClickStopPropagation = useCallback(function (e) {
|
|
133
128
|
return e.stopPropagation();
|
|
@@ -141,7 +136,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
141
136
|
}
|
|
142
137
|
if (cardState.status === 'unauthorized' && services !== null && services !== void 0 && services.length) {
|
|
143
138
|
return jsx(HoverCardUnauthorisedView, {
|
|
144
|
-
analytics: analytics,
|
|
145
139
|
extensionKey: extensionKey,
|
|
146
140
|
id: id,
|
|
147
141
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -155,7 +149,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
155
149
|
}
|
|
156
150
|
if (cardState.status === 'resolved') {
|
|
157
151
|
return jsx(HoverCardResolvedView, {
|
|
158
|
-
analytics: analytics,
|
|
159
152
|
cardState: cardState,
|
|
160
153
|
extensionKey: extensionKey,
|
|
161
154
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
6
5
|
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
7
|
-
import { getCanBeDatasource, getDefinitionId } from '../../../../../state/helpers';
|
|
8
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
9
7
|
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
10
8
|
import { getMetadata } from '../../../utils';
|
|
@@ -12,8 +10,7 @@ import ImagePreview from '../../ImagePreview';
|
|
|
12
10
|
import { hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
13
11
|
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
14
12
|
var _cardState$details;
|
|
15
|
-
var
|
|
16
|
-
cardState = _ref.cardState,
|
|
13
|
+
var cardState = _ref.cardState,
|
|
17
14
|
extensionKey = _ref.extensionKey,
|
|
18
15
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
19
16
|
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
@@ -22,36 +19,22 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
22
19
|
id = _ref.id;
|
|
23
20
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
24
21
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
25
|
-
var definitionId = React.useMemo(function () {
|
|
26
|
-
return getDefinitionId(cardState.details);
|
|
27
|
-
}, [cardState.details]);
|
|
28
|
-
var canBeDatasource = React.useMemo(function () {
|
|
29
|
-
return getCanBeDatasource(cardState.details);
|
|
30
|
-
}, [cardState.details]);
|
|
31
22
|
useEffect(function () {
|
|
32
23
|
// Since this hover view is only rendered on resolved status,
|
|
33
24
|
// there is no need to check for statuses.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
25
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
26
|
+
extensionKey: extensionKey,
|
|
27
|
+
display: CardDisplay.HoverCardPreview
|
|
28
|
+
});
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
analytics.ui.renderSuccessEvent({
|
|
49
|
-
display: CardDisplay.HoverCardPreview,
|
|
50
|
-
status: cardState.status,
|
|
51
|
-
canBeDatasource: canBeDatasource
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, [analytics.ui, cardState.status, canBeDatasource, fireEvent, definitionId, extensionKey, id]);
|
|
30
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
31
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
32
|
+
display: CardDisplay.HoverCardPreview
|
|
33
|
+
});
|
|
34
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
35
|
+
display: CardDisplay.HoverCardPreview
|
|
36
|
+
});
|
|
37
|
+
}, [extensionKey, fireEvent, id]);
|
|
55
38
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
56
39
|
var _useMemo = useMemo(function () {
|
|
57
40
|
return getMetadata(extensionKey, data);
|
|
@@ -15,8 +15,7 @@ import { LinkIcon } from '../../../../FlexibleCard/components/elements';
|
|
|
15
15
|
import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
|
|
16
16
|
var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
17
17
|
var _cardState$details, _extractProvider;
|
|
18
|
-
var
|
|
19
|
-
_ref$id = _ref.id,
|
|
18
|
+
var _ref$id = _ref.id,
|
|
20
19
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
21
20
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
22
21
|
_ref$testId = _ref.testId,
|
|
@@ -26,7 +25,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
26
25
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
27
26
|
var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
28
27
|
var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
29
|
-
var _useSmartCardActions = useSmartCardActions(id, url
|
|
28
|
+
var _useSmartCardActions = useSmartCardActions(id, url),
|
|
30
29
|
authorize = _useSmartCardActions.authorize;
|
|
31
30
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
32
31
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
@@ -61,8 +60,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
61
60
|
testId: "".concat(testId, "-content")
|
|
62
61
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
63
62
|
providerName: providerName,
|
|
64
|
-
isProductIntegrationSupported: isProductIntegrationSupported
|
|
65
|
-
analytics: analytics
|
|
63
|
+
isProductIntegrationSupported: isProductIntegrationSupported
|
|
66
64
|
}))), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
67
65
|
overrideCss: connectButtonStyles,
|
|
68
66
|
testId: "".concat(testId, "-button")
|