@atlaskit/smart-card 26.23.2 → 26.25.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 +20 -0
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/extractors/block/index.js +1 -1
- package/dist/cjs/extractors/common/actions/extractActions.js +3 -31
- package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +53 -0
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/messages.js +10 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -45
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +2 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +43 -0
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +40 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +10 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +22 -1
- package/dist/cjs/view/FlexibleCard/components/utils.js +9 -20
- package/dist/cjs/view/FlexibleCard/index.js +14 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/cjs/view/HoverCard/styled.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/extractors/block/index.js +2 -2
- package/dist/es2019/extractors/common/actions/extractActions.js +2 -23
- package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
- package/dist/es2019/extractors/flexible/index.js +3 -0
- package/dist/es2019/messages.js +10 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +14 -8
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -42
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
- package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +18 -7
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
- package/dist/es2019/view/FlexibleCard/components/utils.js +3 -17
- package/dist/es2019/view/FlexibleCard/index.js +11 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/es2019/view/HoverCard/styled.js +3 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/esm/constants.js +1 -0
- package/dist/esm/extractors/block/index.js +2 -2
- package/dist/esm/extractors/common/actions/extractActions.js +2 -30
- package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
- package/dist/esm/extractors/flexible/index.js +3 -0
- package/dist/esm/messages.js +10 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -46
- package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
- package/dist/esm/view/EmbedCard/components/styled.js +2 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
- package/dist/esm/view/FlexibleCard/components/utils.js +9 -20
- package/dist/esm/view/FlexibleCard/index.js +14 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/esm/view/HoverCard/styled.js +2 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -1
- package/dist/types/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
- package/dist/types/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types/state/flexible-ui-context/types.d.ts +17 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -3
- package/dist/types/utils/analytics/types.d.ts +3 -3
- package/dist/types/utils/mocks.d.ts +3 -3
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
- package/dist/types/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types/view/FlexibleCard/types.d.ts +2 -3
- package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
- package/dist/types-ts4.5/constants.d.ts +1 -0
- package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -1
- package/dist/types-ts4.5/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +17 -0
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +3 -3
- package/dist/types-ts4.5/utils/analytics/types.d.ts +3 -3
- package/dist/types-ts4.5/utils/mocks.d.ts +3 -3
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -3
- package/package.json +2 -2
- package/report.api.md +9 -6
- package/tmp/api-report-tmp.d.ts +9 -7
|
@@ -66,7 +66,7 @@ export const getTransitionStyles = snippetHeight => css`
|
|
|
66
66
|
height: ${snippetHeight}px;
|
|
67
67
|
`;
|
|
68
68
|
export const popupContainerStyles = css`
|
|
69
|
-
border-radius: ${"var(--ds-border-radius-
|
|
69
|
+
border-radius: ${"var(--ds-border-radius-200, 8px)"};
|
|
70
70
|
background-color: ${themed({
|
|
71
71
|
light: "var(--ds-surface-raised, white)",
|
|
72
72
|
dark: "var(--ds-surface-raised, #262B31)"
|
|
@@ -78,8 +78,8 @@ export const popupContainerStyles = css`
|
|
|
78
78
|
`;
|
|
79
79
|
export const getPreviewBlockStyles = snippetHeight => css`
|
|
80
80
|
height: ${snippetHeight}px;
|
|
81
|
-
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-
|
|
82
|
-
border-top-right-radius: ${"var(--ds-border-radius-
|
|
81
|
+
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
|
|
82
|
+
border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
|
|
83
83
|
margin-bottom: ${blockGap};
|
|
84
84
|
}` : ``}
|
|
85
85
|
`;
|
|
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
const PACKAGE_DATA = {
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "26.
|
|
11
|
+
packageVersion: "26.25.0",
|
|
12
12
|
componentName: 'linkUrl'
|
|
13
13
|
};
|
|
14
14
|
const Link = withLinkClickedEvent('a');
|
|
@@ -67,7 +67,7 @@ const baseWrapperStyle = props => `
|
|
|
67
67
|
${props.withoutBackground ? `padding-left: 0; margin-left:-2px;` : ''}
|
|
68
68
|
display: inline;
|
|
69
69
|
box-decoration-break: clone;
|
|
70
|
-
border-radius: ${"var(--ds-border-radius-100,
|
|
70
|
+
border-radius: ${"var(--ds-border-radius-100, 4px)"};
|
|
71
71
|
color: ${themed({
|
|
72
72
|
light: `var(--ds-link, ${B400})`,
|
|
73
73
|
dark: "var(--ds-link, #4794FF)"
|
|
@@ -10,7 +10,7 @@ export const IconStyledButton = styled.span`
|
|
|
10
10
|
text-align: initial;
|
|
11
11
|
display: inline;
|
|
12
12
|
vertical-align: baseline;
|
|
13
|
-
border-radius: ${"var(--ds-border-radius-100,
|
|
13
|
+
border-radius: ${"var(--ds-border-radius-100, 4px)"};
|
|
14
14
|
border-top-left-radius: 0px;
|
|
15
15
|
border-bottom-left-radius: 0px;
|
|
16
16
|
padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"};
|
package/dist/esm/constants.js
CHANGED
|
@@ -143,6 +143,7 @@ export var ElementName = /*#__PURE__*/function (ElementName) {
|
|
|
143
143
|
export var ActionName = /*#__PURE__*/function (ActionName) {
|
|
144
144
|
ActionName["DeleteAction"] = "DeleteAction";
|
|
145
145
|
ActionName["EditAction"] = "EditAction";
|
|
146
|
+
ActionName["FollowAction"] = "FollowAction";
|
|
146
147
|
ActionName["PreviewAction"] = "PreviewAction";
|
|
147
148
|
ActionName["ViewAction"] = "ViewAction";
|
|
148
149
|
ActionName["DownloadAction"] = "DownloadAction";
|
|
@@ -8,7 +8,7 @@ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount
|
|
|
8
8
|
import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/link-extractors';
|
|
9
9
|
import { extractByline } from '../common/byline/extractByline';
|
|
10
10
|
import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
|
|
11
|
-
import {
|
|
11
|
+
import { extractClientActions } from '../common/actions/extractActions';
|
|
12
12
|
import { extractPreviewAction } from '../common/actions/extractPreviewAction';
|
|
13
13
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
14
14
|
var extractBlockIcon = function extractBlockIcon(jsonLd) {
|
|
@@ -31,7 +31,7 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
31
31
|
export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
32
32
|
if (opts) {
|
|
33
33
|
var handleInvoke = opts.handleInvoke;
|
|
34
|
-
var actions =
|
|
34
|
+
var actions = extractClientActions(jsonLd, handleInvoke);
|
|
35
35
|
var previewAction = extractPreviewAction(_objectSpread(_objectSpread({}, opts), {}, {
|
|
36
36
|
viewProps: props,
|
|
37
37
|
jsonLd: jsonLd,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
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; }
|
|
4
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; }
|
|
@@ -37,27 +36,6 @@ var getClientActionProps = function getClientActionProps(jsonLd, action, handler
|
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
};
|
|
40
|
-
var getServerActionProps = function getServerActionProps(jsonLd, action, handler) {
|
|
41
|
-
var id = action['@id'] || action['@type'];
|
|
42
|
-
var data = {
|
|
43
|
-
type: 'server',
|
|
44
|
-
key: action.identifier,
|
|
45
|
-
action: {
|
|
46
|
-
type: action['@type'],
|
|
47
|
-
payload: {
|
|
48
|
-
id: id,
|
|
49
|
-
context: jsonLd.context
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return {
|
|
54
|
-
id: id,
|
|
55
|
-
text: action.name,
|
|
56
|
-
promise: function promise() {
|
|
57
|
-
return handler(data);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
39
|
export var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
62
40
|
var actions = jsonLd && jsonLd['schema:potentialAction'];
|
|
63
41
|
if (!actions) {
|
|
@@ -68,17 +46,11 @@ export var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
|
68
46
|
}
|
|
69
47
|
return actions;
|
|
70
48
|
};
|
|
71
|
-
export function
|
|
49
|
+
export function extractClientActions(jsonLd, handler) {
|
|
72
50
|
var actions = getActionsFromJsonLd(jsonLd);
|
|
73
51
|
var clientActions = actions.filter(isClientAction);
|
|
74
|
-
var serverActions = actions.filter(function (action) {
|
|
75
|
-
return !isClientAction(action);
|
|
76
|
-
});
|
|
77
52
|
var clientActionImpls = clientActions.map(function (action) {
|
|
78
53
|
return getClientActionProps(jsonLd, action, handler);
|
|
79
54
|
});
|
|
80
|
-
|
|
81
|
-
return getServerActionProps(jsonLd, action, handler);
|
|
82
|
-
});
|
|
83
|
-
return [].concat(_toConsumableArray(clientActionImpls), _toConsumableArray(serverActionImpls));
|
|
55
|
+
return clientActionImpls;
|
|
84
56
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
3
|
+
import { getExtensionKey } from '../../../state/helpers';
|
|
4
|
+
import extractServerAction from '../extract-server-action';
|
|
5
|
+
var extractFollowAction = function extractFollowAction(response, showServerActions, id) {
|
|
6
|
+
var _action$dataUpdateAct;
|
|
7
|
+
if (!showServerActions) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var extensionKey = getExtensionKey(response);
|
|
11
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
12
|
+
var actions = extractServerAction(data);
|
|
13
|
+
if (!extensionKey || actions.length === 0) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var action = actions.find(function (item) {
|
|
17
|
+
if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
|
|
18
|
+
var _dataUpdateAction;
|
|
19
|
+
var actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
|
|
20
|
+
return actionName === SmartLinkActionType.FollowEntityAction || actionName === SmartLinkActionType.UnfollowEntityAction;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
});
|
|
24
|
+
if (!action || !action.resourceIdentifiers) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
var url = extractLink(data);
|
|
28
|
+
var reload = url ? {
|
|
29
|
+
id: id,
|
|
30
|
+
url: url
|
|
31
|
+
} : undefined;
|
|
32
|
+
var actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
|
|
33
|
+
return {
|
|
34
|
+
action: {
|
|
35
|
+
action: {
|
|
36
|
+
actionType: actionType,
|
|
37
|
+
resourceIdentifiers: action.resourceIdentifiers
|
|
38
|
+
},
|
|
39
|
+
providerKey: extensionKey,
|
|
40
|
+
reload: reload
|
|
41
|
+
},
|
|
42
|
+
value: actionType === SmartLinkActionType.FollowEntityAction
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default extractFollowAction;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { extractSummary } from '../common/primitives';
|
|
3
|
+
import extractFollowAction from './actions/extract-follow-action';
|
|
2
4
|
import { extractLinkIcon } from './icon';
|
|
3
5
|
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy, extractAssignedTo, extractSubTasksProgress, extractStoryPoints, extractReadTime, extractSentOn, extractPersonAssignedToAsArray } from './utils';
|
|
4
6
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
@@ -38,6 +40,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
38
40
|
assignedTo: extractAssignedTo(data),
|
|
39
41
|
createdOn: extractDateCreated(data),
|
|
40
42
|
dueOn: extractDueOn(data),
|
|
43
|
+
followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
|
|
41
44
|
previewAction: extractPreviewAction(response),
|
|
42
45
|
viewAction: extractViewAction(data),
|
|
43
46
|
downloadAction: extractDownloadAction(data),
|
package/dist/esm/messages.js
CHANGED
|
@@ -140,6 +140,11 @@ export var messages = defineMessages({
|
|
|
140
140
|
defaultMessage: 'Edit',
|
|
141
141
|
description: 'Allow a user to edit a link'
|
|
142
142
|
},
|
|
143
|
+
follow: {
|
|
144
|
+
id: 'fabric.linking.follow',
|
|
145
|
+
defaultMessage: 'Follow',
|
|
146
|
+
description: 'Click to follow a project.'
|
|
147
|
+
},
|
|
143
148
|
forbidden_description: {
|
|
144
149
|
id: 'fabric.linking.forbidden_description',
|
|
145
150
|
defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
|
|
@@ -425,6 +430,11 @@ export var messages = defineMessages({
|
|
|
425
430
|
defaultMessage: 'Unassigned',
|
|
426
431
|
description: 'Shown as a tooltip text for a default unassigned fallback avatar'
|
|
427
432
|
},
|
|
433
|
+
unfollow: {
|
|
434
|
+
id: 'fabric.linking.unfollow',
|
|
435
|
+
defaultMessage: 'Unfollow',
|
|
436
|
+
description: 'Click to unfollow a project.'
|
|
437
|
+
},
|
|
428
438
|
unlink_account: {
|
|
429
439
|
id: 'fabric.linking.unlink_account',
|
|
430
440
|
defaultMessage: 'Unlink Account',
|
|
@@ -247,11 +247,11 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
247
247
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
248
248
|
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
249
249
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
250
|
-
* @param invokeType
|
|
250
|
+
* @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
251
251
|
* @returns
|
|
252
252
|
*/
|
|
253
253
|
actionClickedEvent: function actionClickedEvent(_ref6) {
|
|
254
|
-
var
|
|
254
|
+
var id = _ref6.id,
|
|
255
255
|
actionType = _ref6.actionType,
|
|
256
256
|
display = _ref6.display,
|
|
257
257
|
invokeType = _ref6.invokeType,
|
|
@@ -262,14 +262,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
262
262
|
destinationSubproduct = _ref6.destinationSubproduct,
|
|
263
263
|
location = _ref6.location;
|
|
264
264
|
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
265
|
-
startUfoExperience('smart-link-action-invocation', experienceId, {
|
|
266
|
-
actionType: actionType,
|
|
267
|
-
display: display,
|
|
268
|
-
extensionKey: extensionKey,
|
|
269
|
-
invokeType: invokeType
|
|
270
|
-
});
|
|
271
265
|
dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
|
|
272
|
-
id: defaultId,
|
|
266
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
273
267
|
actionType: actionType,
|
|
274
268
|
display: display,
|
|
275
269
|
extensionKey: extensionKey,
|
|
@@ -527,7 +521,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
527
521
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
528
522
|
*/
|
|
529
523
|
invokeSucceededEvent: function invokeSucceededEvent(_ref13) {
|
|
530
|
-
var
|
|
524
|
+
var id = _ref13.id,
|
|
531
525
|
actionType = _ref13.actionType,
|
|
532
526
|
display = _ref13.display,
|
|
533
527
|
extensionKey = _ref13.extensionKey,
|
|
@@ -536,9 +530,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
536
530
|
destinationProduct = _ref13.destinationProduct,
|
|
537
531
|
destinationSubproduct = _ref13.destinationSubproduct,
|
|
538
532
|
location = _ref13.location;
|
|
539
|
-
succeedUfoExperience('smart-link-action-invocation', experienceId);
|
|
540
533
|
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
541
|
-
id: defaultId,
|
|
534
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
542
535
|
actionType: actionType,
|
|
543
536
|
display: display,
|
|
544
537
|
extensionKey: extensionKey,
|
|
@@ -558,7 +551,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
558
551
|
* @param reason The reason the invocation failed.
|
|
559
552
|
*/
|
|
560
553
|
invokeFailedEvent: function invokeFailedEvent(_ref14) {
|
|
561
|
-
var
|
|
554
|
+
var id = _ref14.id,
|
|
562
555
|
actionType = _ref14.actionType,
|
|
563
556
|
display = _ref14.display,
|
|
564
557
|
reason = _ref14.reason,
|
|
@@ -568,9 +561,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
568
561
|
destinationProduct = _ref14.destinationProduct,
|
|
569
562
|
destinationSubproduct = _ref14.destinationSubproduct,
|
|
570
563
|
location = _ref14.location;
|
|
571
|
-
failUfoExperience('smart-link-action-invocation', experienceId);
|
|
572
564
|
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
573
|
-
id: defaultId,
|
|
565
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
574
566
|
actionType: actionType,
|
|
575
567
|
display: display,
|
|
576
568
|
reason: reason,
|
|
@@ -3,6 +3,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
5
|
import * as measure from '../../../utils/performance';
|
|
6
|
+
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
7
|
+
var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Invoke client action such as preview, download and open link
|
|
8
11
|
*/
|
|
@@ -19,45 +22,48 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
19
22
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
20
23
|
measure.mark(markName, 'pending');
|
|
21
24
|
_context.prev = 4;
|
|
22
|
-
// Begin
|
|
23
|
-
|
|
24
|
-
id: experienceId,
|
|
25
|
-
extensionKey: extensionKey,
|
|
25
|
+
// Begin UFO experience
|
|
26
|
+
startUfoExperience(ACTION_EXPERIENCE_NAME, experienceId, {
|
|
26
27
|
actionType: actionType,
|
|
27
28
|
display: display,
|
|
29
|
+
extensionKey: extensionKey,
|
|
28
30
|
invokeType: 'client'
|
|
29
31
|
});
|
|
30
32
|
|
|
33
|
+
// Begin analytics instrumentation.
|
|
34
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
|
|
35
|
+
actionType: actionType,
|
|
36
|
+
display: display
|
|
37
|
+
});
|
|
38
|
+
|
|
31
39
|
// Invoke action
|
|
32
|
-
_context.next =
|
|
40
|
+
_context.next = 9;
|
|
33
41
|
return actionFn();
|
|
34
|
-
case
|
|
42
|
+
case 9:
|
|
35
43
|
result = _context.sent;
|
|
36
44
|
measure.mark(markName, 'resolved');
|
|
45
|
+
succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
37
46
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeSucceededEvent({
|
|
38
|
-
id: experienceId,
|
|
39
|
-
extensionKey: extensionKey,
|
|
40
47
|
actionType: actionType,
|
|
41
48
|
display: display
|
|
42
49
|
});
|
|
43
50
|
return _context.abrupt("return", result);
|
|
44
|
-
case
|
|
45
|
-
_context.prev =
|
|
51
|
+
case 16:
|
|
52
|
+
_context.prev = 16;
|
|
46
53
|
_context.t0 = _context["catch"](4);
|
|
47
54
|
measure.mark(markName, 'errored');
|
|
55
|
+
failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
48
56
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
49
57
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeFailedEvent({
|
|
50
|
-
id: experienceId,
|
|
51
|
-
extensionKey: extensionKey,
|
|
52
58
|
actionType: actionType,
|
|
53
59
|
display: display,
|
|
54
60
|
reason: reason
|
|
55
61
|
});
|
|
56
|
-
case
|
|
62
|
+
case 22:
|
|
57
63
|
case "end":
|
|
58
64
|
return _context.stop();
|
|
59
65
|
}
|
|
60
|
-
}, _callee, null, [[4,
|
|
66
|
+
}, _callee, null, [[4, 16]]);
|
|
61
67
|
}));
|
|
62
68
|
return function (_x) {
|
|
63
69
|
return _ref3.apply(this, arguments);
|
|
@@ -13,7 +13,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
13
13
|
export var context = {
|
|
14
14
|
componentName: 'smart-cards',
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "26.
|
|
16
|
+
packageVersion: "26.25.0"
|
|
17
17
|
};
|
|
18
18
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
19
19
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -32,6 +32,7 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
|
|
|
32
32
|
return onAuthorize ? [RetryAction(onAuthorize)] : [];
|
|
33
33
|
}, [onAuthorize]);
|
|
34
34
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
35
|
+
appearance: "block",
|
|
35
36
|
cardState: cardState,
|
|
36
37
|
onAuthorize: onAuthorize,
|
|
37
38
|
onClick: onClick,
|
|
@@ -5,8 +5,7 @@ import FlexibleCard from '../../../FlexibleCard';
|
|
|
5
5
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
6
6
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
7
7
|
import { metadataBlockCss, footerBlockCss } from './styled';
|
|
8
|
-
import { ActionName,
|
|
9
|
-
import uuid from 'uuid';
|
|
8
|
+
import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
|
|
10
9
|
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
11
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
@@ -36,11 +35,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
36
35
|
useEffect(function () {
|
|
37
36
|
setIsPreviewBlockErrored(false);
|
|
38
37
|
}, [url, cardState]);
|
|
39
|
-
var _useState3 = useState(function () {
|
|
40
|
-
return id ? id : uuid();
|
|
41
|
-
}),
|
|
42
|
-
_useState4 = _slicedToArray(_useState3, 1),
|
|
43
|
-
analyticsId = _useState4[0];
|
|
44
38
|
var _ref2 = getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? getSimulatedBetterMetadata(cardState.details) : getSimulatedMetadata(cardState.details),
|
|
45
39
|
titleMetadata = _ref2.titleMetadata,
|
|
46
40
|
topMetadata = _ref2.topMetadata,
|
|
@@ -87,49 +81,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
87
81
|
}, {
|
|
88
82
|
actions: [{
|
|
89
83
|
name: ActionName.PreviewAction,
|
|
90
|
-
hideIcon: true
|
|
91
|
-
onClick: function onClick() {
|
|
92
|
-
analytics.ui.actionClickedEvent({
|
|
93
|
-
id: analyticsId,
|
|
94
|
-
actionType: 'PreviewAction',
|
|
95
|
-
display: CardDisplay.Block
|
|
96
|
-
});
|
|
97
|
-
analytics.operational.invokeSucceededEvent({
|
|
98
|
-
id: analyticsId,
|
|
99
|
-
actionType: 'PreviewAction',
|
|
100
|
-
display: CardDisplay.Block
|
|
101
|
-
});
|
|
102
|
-
}
|
|
84
|
+
hideIcon: true
|
|
103
85
|
}, {
|
|
104
86
|
name: ActionName.ViewAction,
|
|
105
|
-
hideIcon: true
|
|
106
|
-
onClick: function onClick() {
|
|
107
|
-
analytics.ui.actionClickedEvent({
|
|
108
|
-
id: analyticsId,
|
|
109
|
-
actionType: 'ViewAction',
|
|
110
|
-
display: CardDisplay.Block
|
|
111
|
-
});
|
|
112
|
-
analytics.operational.invokeSucceededEvent({
|
|
113
|
-
id: analyticsId,
|
|
114
|
-
actionType: 'ViewAction',
|
|
115
|
-
display: CardDisplay.Block
|
|
116
|
-
});
|
|
117
|
-
}
|
|
87
|
+
hideIcon: true
|
|
118
88
|
}, {
|
|
119
89
|
name: ActionName.DownloadAction,
|
|
120
|
-
hideIcon: true
|
|
121
|
-
onClick: function onClick() {
|
|
122
|
-
analytics.ui.actionClickedEvent({
|
|
123
|
-
id: analyticsId,
|
|
124
|
-
actionType: 'DownloadAction',
|
|
125
|
-
display: CardDisplay.Block
|
|
126
|
-
});
|
|
127
|
-
analytics.operational.invokeSucceededEvent({
|
|
128
|
-
id: analyticsId,
|
|
129
|
-
actionType: 'DownloadAction',
|
|
130
|
-
display: CardDisplay.Block
|
|
131
|
-
});
|
|
132
|
-
}
|
|
90
|
+
hideIcon: true
|
|
133
91
|
}]
|
|
134
92
|
})));
|
|
135
93
|
};
|
|
@@ -8,7 +8,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
9
9
|
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
|
|
10
10
|
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
11
|
-
export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n"])));
|
|
11
|
+
export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
|
|
12
12
|
var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
|
|
13
|
-
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-
|
|
13
|
+
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border-input, ".concat(N40, ")"));
|
|
14
14
|
export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
@@ -10,8 +10,8 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
10
10
|
export var className = 'media-card-frame';
|
|
11
11
|
export var borderRadius = "\n border-radius: ".concat(akBorderRadius(), "px;\n");
|
|
12
12
|
var BACKGROUND_COLOR_DARK = '#262B31';
|
|
13
|
-
var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-
|
|
14
|
-
var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-
|
|
13
|
+
var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n");
|
|
14
|
+
var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-100, 4px)", ";\n");
|
|
15
15
|
export var ellipsis = function ellipsis() {
|
|
16
16
|
var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
17
17
|
var unit = typeof maxWidth === 'number' ? 'px' : '';
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
5
|
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
6
|
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
7
|
import React from 'react';
|
|
6
8
|
import Action from '../index';
|
|
7
9
|
import { downloadUrl as download } from '../../../../../../utils';
|
|
10
|
+
import { ActionName } from '../../../../../../constants';
|
|
11
|
+
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
12
|
+
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
8
13
|
var DownloadAction = function DownloadAction(props) {
|
|
9
14
|
var appearance = props.appearance,
|
|
10
15
|
asDropDownItem = props.asDropDownItem,
|
|
@@ -12,10 +17,37 @@ var DownloadAction = function DownloadAction(props) {
|
|
|
12
17
|
_onClick = props.onClick,
|
|
13
18
|
testId = props.testId,
|
|
14
19
|
url = props.url;
|
|
20
|
+
var analytics = useFlexibleUiAnalyticsContext();
|
|
21
|
+
var invoke = useInvokeClientAction({
|
|
22
|
+
analytics: analytics
|
|
23
|
+
});
|
|
15
24
|
if (downloadUrl && url) {
|
|
16
25
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
17
26
|
onClick: function onClick() {
|
|
18
|
-
|
|
27
|
+
invoke({
|
|
28
|
+
actionType: ActionName.DownloadAction,
|
|
29
|
+
actionFn: function () {
|
|
30
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
31
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
32
|
+
while (1) switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
return _context.abrupt("return", download(downloadUrl));
|
|
35
|
+
case 1:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
41
|
+
function actionFn() {
|
|
42
|
+
return _actionFn.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
return actionFn;
|
|
45
|
+
}(),
|
|
46
|
+
// These values have already been set in analytics context.
|
|
47
|
+
// We only pass these here for ufo experience.
|
|
48
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
49
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
50
|
+
});
|
|
19
51
|
if (_onClick) {
|
|
20
52
|
_onClick();
|
|
21
53
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
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
5
|
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; }
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
import React from 'react';
|
|
6
8
|
import Action from '../index';
|
|
7
9
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
8
|
-
import { useSmartLinkAnalytics } from '../../../../../../state';
|
|
9
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
11
|
import { messages } from '../../../../../../messages';
|
|
11
12
|
import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
|
|
13
|
+
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
14
|
+
import { ActionName } from '../../../../../../constants';
|
|
12
15
|
var PreviewAction = function PreviewAction(props) {
|
|
13
16
|
var appearance = props.appearance,
|
|
14
17
|
asDropDownItem = props.asDropDownItem,
|
|
@@ -21,23 +24,46 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
21
24
|
providerName = props.providerName,
|
|
22
25
|
downloadUrl = props.downloadUrl,
|
|
23
26
|
isSupportTheming = props.isSupportTheming;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
27
|
+
var analytics = useFlexibleUiAnalyticsContext();
|
|
28
|
+
var invoke = useInvokeClientAction({
|
|
29
|
+
analytics: analytics
|
|
30
|
+
});
|
|
26
31
|
if (src && url) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
var actionFn = /*#__PURE__*/function () {
|
|
33
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
return _context.abrupt("return", openEmbedModalWithFlexibleUiIcon({
|
|
38
|
+
download: downloadUrl,
|
|
39
|
+
title: title,
|
|
40
|
+
providerName: providerName,
|
|
41
|
+
isSupportTheming: isSupportTheming,
|
|
42
|
+
analytics: analytics,
|
|
43
|
+
linkIcon: linkIcon,
|
|
44
|
+
src: src,
|
|
45
|
+
url: url
|
|
46
|
+
}));
|
|
47
|
+
case 1:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee);
|
|
52
|
+
}));
|
|
53
|
+
return function actionFn() {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
|
38
57
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
39
58
|
onClick: function onClick() {
|
|
40
|
-
|
|
59
|
+
invoke({
|
|
60
|
+
actionType: ActionName.PreviewAction,
|
|
61
|
+
actionFn: actionFn,
|
|
62
|
+
// These values have already been set in analytics context.
|
|
63
|
+
// We only pass these here for ufo experience.
|
|
64
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
65
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
66
|
+
});
|
|
41
67
|
if (_onClick) {
|
|
42
68
|
_onClick();
|
|
43
69
|
}
|
|
@@ -34,14 +34,14 @@ var ServerAction = function ServerAction(_ref) {
|
|
|
34
34
|
_context.next = 6;
|
|
35
35
|
return invoke(request);
|
|
36
36
|
case 6:
|
|
37
|
-
setIsLoading(false);
|
|
38
37
|
if (!(action.reload && action.reload.url)) {
|
|
39
|
-
_context.next =
|
|
38
|
+
_context.next = 9;
|
|
40
39
|
break;
|
|
41
40
|
}
|
|
42
|
-
_context.next =
|
|
41
|
+
_context.next = 9;
|
|
43
42
|
return reload(action.reload.url, true, undefined, action.reload.id);
|
|
44
|
-
case
|
|
43
|
+
case 9:
|
|
44
|
+
setIsLoading(false);
|
|
45
45
|
if (onClick) {
|
|
46
46
|
onClick();
|
|
47
47
|
}
|