@atlaskit/smart-card 26.51.0 → 26.52.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 +12 -0
- package/dist/cjs/extractors/flexible/actions/index.js +5 -2
- package/dist/cjs/extractors/flexible/index.js +1 -5
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +0 -1
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +76 -0
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +8 -9
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +9 -8
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +0 -13
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +41 -26
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +0 -8
- package/dist/cjs/view/HoverCard/components/ContentContainer.js +1 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +1 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/index.js +6 -2
- package/dist/es2019/extractors/flexible/index.js +1 -5
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +47 -0
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +7 -5
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +1 -7
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +0 -14
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +43 -22
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +0 -8
- package/dist/es2019/view/HoverCard/components/ContentContainer.js +1 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +1 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/index.js +5 -2
- package/dist/esm/extractors/flexible/index.js +1 -5
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +0 -1
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +66 -0
- package/dist/esm/view/FlexibleCard/components/actions/download-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +9 -7
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +1 -7
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +0 -13
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +41 -26
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +0 -8
- package/dist/esm/view/HoverCard/components/ContentContainer.js +1 -0
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +1 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/__fixtures__/dropbox-file.d.ts +3 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +2 -12
- package/dist/types/view/FlexibleCard/components/actions/download-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/download-action/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/actions/follow-action/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -7
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +11 -2
- package/dist/types-ts4.5/__fixtures__/dropbox-file.d.ts +3 -0
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +2 -12
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/download-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/download-action/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +11 -2
- package/package.json +4 -4
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +0 -72
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +0 -47
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +0 -65
- package/dist/types/view/FlexibleCard/components/actions/action/download-action/index.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/actions/action/download-action/types.d.ts +0 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/download-action/index.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/download-action/types.d.ts +0 -5
- /package/dist/cjs/view/FlexibleCard/components/actions/{action/download-action → download-action}/types.js +0 -0
- /package/dist/es2019/view/FlexibleCard/components/actions/{action/download-action → download-action}/types.js +0 -0
- /package/dist/{esm/view/FlexibleCard/components/actions/action/download-action → es2019/view/FlexibleCard/components/actions/follow-action}/types.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ActionProps } from './action/types';
|
|
3
3
|
import { ViewActionProps } from './action/view-action/types';
|
|
4
|
-
import { DownloadActionProps } from './action/download-action/types';
|
|
5
4
|
export { default as FollowAction } from './follow-action';
|
|
6
5
|
export { default as PreviewAction } from './preview-action';
|
|
6
|
+
export { default as DownloadAction } from './download-action';
|
|
7
7
|
/**
|
|
8
8
|
* Creates a DeleteAction component. Accepts default ActionProps, but defaults
|
|
9
9
|
* the icon to a cross icon.
|
|
@@ -22,12 +22,6 @@ export declare const EditAction: import("react").FC<ActionProps>;
|
|
|
22
22
|
* @see Action
|
|
23
23
|
*/
|
|
24
24
|
export declare const ViewAction: import("react").FC<ViewActionProps>;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a DownloadAction component. Accepts default DownloadActionProps, and defaults
|
|
27
|
-
* to the text 'Download' inside the button.
|
|
28
|
-
* @see Action
|
|
29
|
-
*/
|
|
30
|
-
export declare const DownloadAction: import("react").FC<DownloadActionProps>;
|
|
31
25
|
/**
|
|
32
26
|
* Creates a CustomAction component. Accepts default ActionProps. Required to provide
|
|
33
27
|
* your own icon or text.
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { AISummaryBlockProps } from '../types';
|
|
3
|
-
|
|
3
|
+
import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
|
|
4
|
+
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, testId, }: {
|
|
5
|
+
showErrorIndicator: boolean;
|
|
6
|
+
error?: "NETWORK_ERROR" | "NO_ANSWER" | "RATE_LIMIT" | "NO_AGENT" | "PLUGIN_ERRORED" | "OPENAI_RATE_LIMIT_USER_ABUSE" | "ACCEPTABLE_USE_VIOLATIONS" | "AI_DISABLED" | "UNEXPECTED" | undefined;
|
|
7
|
+
} & Pick<AISummaryBlockProps, "testId">) => JSX.Element | null;
|
|
8
|
+
export declare const AISummaryBlockStatusIndicator: ({ showStatusIndicator, metadata, status, testId, }: {
|
|
9
|
+
showStatusIndicator: boolean;
|
|
10
|
+
status: AISummaryStatus;
|
|
11
|
+
} & Pick<AISummaryBlockProps, "metadata" | "testId">) => JSX.Element;
|
|
12
|
+
declare const AISummaryBlockResolvedView: (props: AISummaryBlockProps) => JSX.Element;
|
|
4
13
|
export default AISummaryBlockResolvedView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JsonLd } from 'json-ld-types';
|
|
2
2
|
import type { FlexibleUiActions } from '../../../state/flexible-ui-context/types';
|
|
3
3
|
import type { CardActionOptions } from '../../../view/Card/types';
|
|
4
|
-
declare const extractActions: (response: JsonLd.Response, actionOptions?: CardActionOptions) => FlexibleUiActions | undefined;
|
|
4
|
+
declare const extractActions: (response: JsonLd.Response, data: JsonLd.Data.BaseData, actionOptions?: CardActionOptions, id?: string) => FlexibleUiActions | undefined;
|
|
5
5
|
export default extractActions;
|
|
@@ -52,12 +52,6 @@ export type FlexibleUiDataContext = {
|
|
|
52
52
|
* @see DueOn
|
|
53
53
|
*/
|
|
54
54
|
dueOn?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Contains data needed to perform follow action.
|
|
57
|
-
* @type PreviewActionData
|
|
58
|
-
* @see FollowAction
|
|
59
|
-
*/
|
|
60
|
-
followAction?: ServerActionProp<boolean>;
|
|
61
55
|
/**
|
|
62
56
|
* Contains the number of views of the linked resource.
|
|
63
57
|
* @type number
|
|
@@ -112,12 +106,6 @@ export type FlexibleUiDataContext = {
|
|
|
112
106
|
* @see ViewAction
|
|
113
107
|
*/
|
|
114
108
|
viewAction?: ViewActionData;
|
|
115
|
-
/**
|
|
116
|
-
* Contains data needed to show a download action.
|
|
117
|
-
* @type DownloadActionData
|
|
118
|
-
* @see DownloadAction
|
|
119
|
-
*/
|
|
120
|
-
downloadAction?: DownloadActionData;
|
|
121
109
|
/**
|
|
122
110
|
* Contains the information about the latest commit in the repository
|
|
123
111
|
*/
|
|
@@ -254,6 +242,8 @@ export type Media = {
|
|
|
254
242
|
};
|
|
255
243
|
export type FlexibleUiActions = {
|
|
256
244
|
[ActionName.PreviewAction]?: PreviewActionData;
|
|
245
|
+
[ActionName.DownloadAction]?: DownloadActionData;
|
|
246
|
+
[ActionName.FollowAction]?: ServerActionProp<boolean>;
|
|
257
247
|
};
|
|
258
248
|
export type PreviewActionData = {
|
|
259
249
|
downloadUrl?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
declare const FollowAction: React.FC<
|
|
2
|
+
import { FollowActionProps } from './types';
|
|
3
|
+
declare const FollowAction: React.FC<FollowActionProps>;
|
|
4
4
|
export default FollowAction;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ActionProps } from './action/types';
|
|
3
3
|
import { ViewActionProps } from './action/view-action/types';
|
|
4
|
-
import { DownloadActionProps } from './action/download-action/types';
|
|
5
4
|
export { default as FollowAction } from './follow-action';
|
|
6
5
|
export { default as PreviewAction } from './preview-action';
|
|
6
|
+
export { default as DownloadAction } from './download-action';
|
|
7
7
|
/**
|
|
8
8
|
* Creates a DeleteAction component. Accepts default ActionProps, but defaults
|
|
9
9
|
* the icon to a cross icon.
|
|
@@ -22,12 +22,6 @@ export declare const EditAction: import("react").FC<ActionProps>;
|
|
|
22
22
|
* @see Action
|
|
23
23
|
*/
|
|
24
24
|
export declare const ViewAction: import("react").FC<ViewActionProps>;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a DownloadAction component. Accepts default DownloadActionProps, and defaults
|
|
27
|
-
* to the text 'Download' inside the button.
|
|
28
|
-
* @see Action
|
|
29
|
-
*/
|
|
30
|
-
export declare const DownloadAction: import("react").FC<DownloadActionProps>;
|
|
31
25
|
/**
|
|
32
26
|
* Creates a CustomAction component. Accepts default ActionProps. Required to provide
|
|
33
27
|
* your own icon or text.
|
package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { AISummaryBlockProps } from '../types';
|
|
3
|
-
|
|
3
|
+
import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
|
|
4
|
+
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, testId, }: {
|
|
5
|
+
showErrorIndicator: boolean;
|
|
6
|
+
error?: "NETWORK_ERROR" | "NO_ANSWER" | "RATE_LIMIT" | "NO_AGENT" | "PLUGIN_ERRORED" | "OPENAI_RATE_LIMIT_USER_ABUSE" | "ACCEPTABLE_USE_VIOLATIONS" | "AI_DISABLED" | "UNEXPECTED" | undefined;
|
|
7
|
+
} & Pick<AISummaryBlockProps, "testId">) => JSX.Element | null;
|
|
8
|
+
export declare const AISummaryBlockStatusIndicator: ({ showStatusIndicator, metadata, status, testId, }: {
|
|
9
|
+
showStatusIndicator: boolean;
|
|
10
|
+
status: AISummaryStatus;
|
|
11
|
+
} & Pick<AISummaryBlockProps, "metadata" | "testId">) => JSX.Element;
|
|
12
|
+
declare const AISummaryBlockResolvedView: (props: AISummaryBlockProps) => JSX.Element;
|
|
4
13
|
export default AISummaryBlockResolvedView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.52.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
33
33
|
"@atlaskit/avatar": "^21.5.0",
|
|
34
34
|
"@atlaskit/avatar-group": "^9.5.0",
|
|
35
|
-
"@atlaskit/badge": "^15.
|
|
35
|
+
"@atlaskit/badge": "^15.3.0",
|
|
36
36
|
"@atlaskit/button": "^17.8.0",
|
|
37
37
|
"@atlaskit/dropdown-menu": "^12.8.0",
|
|
38
38
|
"@atlaskit/icon": "^22.1.0",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
53
53
|
"@atlaskit/popup": "^1.14.0",
|
|
54
|
-
"@atlaskit/primitives": "^5.
|
|
54
|
+
"@atlaskit/primitives": "^5.5.0",
|
|
55
55
|
"@atlaskit/spinner": "^16.0.0",
|
|
56
56
|
"@atlaskit/theme": "^12.7.0",
|
|
57
|
-
"@atlaskit/tokens": "^1.
|
|
57
|
+
"@atlaskit/tokens": "^1.43.0",
|
|
58
58
|
"@atlaskit/tooltip": "^18.1.0",
|
|
59
59
|
"@atlaskit/ufo": "^0.2.0",
|
|
60
60
|
"@babel/runtime": "^7.0.0",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
var _index = _interopRequireDefault(require("../index"));
|
|
14
|
-
var _utils = require("../../../../../../utils");
|
|
15
|
-
var _constants = require("../../../../../../constants");
|
|
16
|
-
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
17
|
-
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
18
|
-
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; }
|
|
19
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
20
|
-
var DownloadAction = function DownloadAction(props) {
|
|
21
|
-
var appearance = props.appearance,
|
|
22
|
-
asDropDownItem = props.asDropDownItem,
|
|
23
|
-
downloadUrl = props.downloadUrl,
|
|
24
|
-
_onClick = props.onClick,
|
|
25
|
-
testId = props.testId,
|
|
26
|
-
url = props.url;
|
|
27
|
-
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
28
|
-
var invoke = (0, _useInvokeClientAction.default)({
|
|
29
|
-
analytics: analytics
|
|
30
|
-
});
|
|
31
|
-
if (downloadUrl && url) {
|
|
32
|
-
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
-
onClick: function onClick() {
|
|
34
|
-
invoke({
|
|
35
|
-
actionType: _constants.ActionName.DownloadAction,
|
|
36
|
-
actionFn: function () {
|
|
37
|
-
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
return _context.abrupt("return", (0, _utils.downloadUrl)(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 (_onClick) {
|
|
59
|
-
_onClick();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, action, {
|
|
64
|
-
appearance: appearance,
|
|
65
|
-
asDropDownItem: asDropDownItem,
|
|
66
|
-
testId: testId
|
|
67
|
-
}));
|
|
68
|
-
} else {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var _default = exports.default = DownloadAction;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Action from '../index';
|
|
4
|
-
import { downloadUrl as download } from '../../../../../../utils';
|
|
5
|
-
import { ActionName } from '../../../../../../constants';
|
|
6
|
-
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
7
|
-
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
8
|
-
const DownloadAction = props => {
|
|
9
|
-
const {
|
|
10
|
-
appearance,
|
|
11
|
-
asDropDownItem,
|
|
12
|
-
downloadUrl,
|
|
13
|
-
onClick,
|
|
14
|
-
testId,
|
|
15
|
-
url
|
|
16
|
-
} = props;
|
|
17
|
-
const analytics = useFlexibleUiAnalyticsContext();
|
|
18
|
-
const invoke = useInvokeClientAction({
|
|
19
|
-
analytics
|
|
20
|
-
});
|
|
21
|
-
if (downloadUrl && url) {
|
|
22
|
-
const action = {
|
|
23
|
-
...props,
|
|
24
|
-
onClick: () => {
|
|
25
|
-
invoke({
|
|
26
|
-
actionType: ActionName.DownloadAction,
|
|
27
|
-
actionFn: async () => download(downloadUrl),
|
|
28
|
-
// These values have already been set in analytics context.
|
|
29
|
-
// We only pass these here for ufo experience.
|
|
30
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
31
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
32
|
-
});
|
|
33
|
-
if (onClick) {
|
|
34
|
-
onClick();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
39
|
-
appearance: appearance,
|
|
40
|
-
asDropDownItem: asDropDownItem,
|
|
41
|
-
testId: testId
|
|
42
|
-
}));
|
|
43
|
-
} else {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export default DownloadAction;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
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; }
|
|
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; }
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import Action from '../index';
|
|
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';
|
|
13
|
-
var DownloadAction = function DownloadAction(props) {
|
|
14
|
-
var appearance = props.appearance,
|
|
15
|
-
asDropDownItem = props.asDropDownItem,
|
|
16
|
-
downloadUrl = props.downloadUrl,
|
|
17
|
-
_onClick = props.onClick,
|
|
18
|
-
testId = props.testId,
|
|
19
|
-
url = props.url;
|
|
20
|
-
var analytics = useFlexibleUiAnalyticsContext();
|
|
21
|
-
var invoke = useInvokeClientAction({
|
|
22
|
-
analytics: analytics
|
|
23
|
-
});
|
|
24
|
-
if (downloadUrl && url) {
|
|
25
|
-
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
26
|
-
onClick: function onClick() {
|
|
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
|
-
});
|
|
51
|
-
if (_onClick) {
|
|
52
|
-
_onClick();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
57
|
-
appearance: appearance,
|
|
58
|
-
asDropDownItem: asDropDownItem,
|
|
59
|
-
testId: testId
|
|
60
|
-
}));
|
|
61
|
-
} else {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
export default DownloadAction;
|
|
File without changes
|
|
File without changes
|