@atlaskit/smart-card 33.1.0 → 33.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +1 -20
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +1 -23
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +1 -34
- package/dist/cjs/extractors/flexible/actions/index.js +2 -15
- package/dist/cjs/extractors/flexible/extract-state.js +1 -5
- package/dist/cjs/extractors/flexible/index.js +3 -7
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +18 -190
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +12 -25
- package/dist/cjs/view/CardWithUrl/loader.js +10 -22
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +8 -65
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +10 -26
- package/dist/cjs/view/FlexibleCard/components/utils.js +1 -28
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +0 -21
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/es2019/extractors/flexible/actions/index.js +4 -23
- package/dist/es2019/extractors/flexible/extract-state.js +1 -5
- package/dist/es2019/extractors/flexible/index.js +3 -4
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +2 -172
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +13 -26
- package/dist/es2019/view/CardWithUrl/loader.js +11 -23
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -33
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +11 -32
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +4 -22
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -27
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +0 -25
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +0 -23
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/esm/extractors/flexible/actions/index.js +4 -17
- package/dist/esm/extractors/flexible/extract-state.js +1 -5
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +19 -191
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +13 -26
- package/dist/esm/view/CardWithUrl/loader.js +10 -22
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +10 -67
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/utils.js +0 -27
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/mocks.d.ts +1 -16
- package/dist/types/view/EmbedModal/index.d.ts +0 -2
- package/dist/types/view/EmbedModal/types.d.ts +0 -3
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
- package/dist/types/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/mocks.d.ts +1 -16
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +0 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/package.json +1 -4
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +0 -32
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +0 -47
- package/dist/cjs/extractors/action/extractViewActionProps.js +0 -31
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +0 -27
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +0 -24
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +0 -36
- package/dist/es2019/extractors/action/extractViewActionProps.js +0 -23
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +0 -20
- package/dist/esm/extractors/action/extractDownloadActionProps.js +0 -27
- package/dist/esm/extractors/action/extractPreviewActionProps.js +0 -41
- package/dist/esm/extractors/action/extractViewActionProps.js +0 -26
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +0 -22
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractDownloadActionProps = void 0;
|
|
7
|
-
var _constants = require("../../constants");
|
|
8
|
-
var _utils = require("../../utils");
|
|
9
|
-
var _extractDownloadAction = require("../flexible/actions/extract-download-action");
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
12
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
13
|
-
*/
|
|
14
|
-
var extractDownloadActionProps = exports.extractDownloadActionProps = function extractDownloadActionProps(_ref) {
|
|
15
|
-
var response = _ref.response,
|
|
16
|
-
actionOptions = _ref.actionOptions,
|
|
17
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
18
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
19
|
-
_ref$source = _ref.source,
|
|
20
|
-
source = _ref$source === void 0 ? 'block' : _ref$source;
|
|
21
|
-
var data = (0, _extractDownloadAction.extractDownloadAction)(response.data, actionOptions);
|
|
22
|
-
if (data) {
|
|
23
|
-
return {
|
|
24
|
-
actionType: _constants.ActionName.DownloadAction,
|
|
25
|
-
actionFn: function actionFn() {
|
|
26
|
-
return (0, _utils.downloadUrl)(data.downloadUrl);
|
|
27
|
-
},
|
|
28
|
-
display: source,
|
|
29
|
-
extensionKey: extensionKey
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
};
|
|
@@ -1,47 +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.extractPreviewActionProps = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _constants = require("../../constants");
|
|
10
|
-
var _utils = require("../../view/EmbedModal/utils");
|
|
11
|
-
var _extractPreviewAction = require("../flexible/actions/extract-preview-action");
|
|
12
|
-
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; }
|
|
13
|
-
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; }
|
|
14
|
-
/**
|
|
15
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
16
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
17
|
-
*/
|
|
18
|
-
var extractPreviewActionProps = exports.extractPreviewActionProps = function extractPreviewActionProps(_ref) {
|
|
19
|
-
var response = _ref.response,
|
|
20
|
-
analytics = _ref.analytics,
|
|
21
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
22
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
23
|
-
_ref$source = _ref.source,
|
|
24
|
-
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
25
|
-
actionOptions = _ref.actionOptions,
|
|
26
|
-
origin = _ref.origin;
|
|
27
|
-
var data = (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions);
|
|
28
|
-
if (data !== null && data !== void 0 && data.src) {
|
|
29
|
-
return {
|
|
30
|
-
actionType: _constants.ActionName.PreviewAction,
|
|
31
|
-
actionFn: function actionFn() {
|
|
32
|
-
return (0, _utils.openEmbedModal)(_objectSpread({
|
|
33
|
-
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
34
|
-
showModal: true,
|
|
35
|
-
onClose: function onClose() {},
|
|
36
|
-
analytics: analytics,
|
|
37
|
-
extensionKey: extensionKey,
|
|
38
|
-
origin: origin
|
|
39
|
-
}, data));
|
|
40
|
-
},
|
|
41
|
-
// These values have already been set in analytics context.
|
|
42
|
-
// We only pass these here for ufo experience.
|
|
43
|
-
display: source,
|
|
44
|
-
extensionKey: extensionKey
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractViewActionProps = void 0;
|
|
7
|
-
var _utils = require("../../utils");
|
|
8
|
-
var _extractViewAction = require("../flexible/actions/extract-view-action");
|
|
9
|
-
/**
|
|
10
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
11
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
12
|
-
*/
|
|
13
|
-
var extractViewActionProps = exports.extractViewActionProps = function extractViewActionProps(_ref) {
|
|
14
|
-
var response = _ref.response,
|
|
15
|
-
actionOptions = _ref.actionOptions,
|
|
16
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
17
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
18
|
-
_ref$source = _ref.source,
|
|
19
|
-
source = _ref$source === void 0 ? 'block' : _ref$source;
|
|
20
|
-
var data = (0, _extractViewAction.extractViewAction)(response.data, actionOptions);
|
|
21
|
-
if (data) {
|
|
22
|
-
return {
|
|
23
|
-
actionType: 'ViewAction',
|
|
24
|
-
actionFn: function actionFn() {
|
|
25
|
-
return (0, _utils.openUrl)(data.viewUrl);
|
|
26
|
-
},
|
|
27
|
-
display: source,
|
|
28
|
-
extensionKey: extensionKey
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractViewAction = void 0;
|
|
7
|
-
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
8
|
-
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
9
|
-
var _types = require("../../../view/Card/types");
|
|
10
|
-
var _extractActions = require("../../common/actions/extractActions");
|
|
11
|
-
/**
|
|
12
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
13
|
-
*/
|
|
14
|
-
var extractViewAction = exports.extractViewAction = function extractViewAction(data, actionOptions) {
|
|
15
|
-
if (!(0, _canShowAction.canShowAction)(_types.CardAction.ViewAction, actionOptions)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
var viewActionExists = (0, _extractActions.getActionsFromJsonLd)(data).find(function (action) {
|
|
19
|
-
return action['@type'] === 'ViewAction';
|
|
20
|
-
});
|
|
21
|
-
if (viewActionExists) {
|
|
22
|
-
return {
|
|
23
|
-
viewUrl: (0, _linkExtractors.extractLink)(data)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ActionName } from '../../constants';
|
|
2
|
-
import { downloadUrl } from '../../utils';
|
|
3
|
-
import { extractDownloadAction as extractDownloadActionData } from '../flexible/actions/extract-download-action';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
8
|
-
*/
|
|
9
|
-
export const extractDownloadActionProps = ({
|
|
10
|
-
response,
|
|
11
|
-
actionOptions,
|
|
12
|
-
extensionKey = 'empty-object-provider',
|
|
13
|
-
source = 'block'
|
|
14
|
-
}) => {
|
|
15
|
-
const data = extractDownloadActionData(response.data, actionOptions);
|
|
16
|
-
if (data) {
|
|
17
|
-
return {
|
|
18
|
-
actionType: ActionName.DownloadAction,
|
|
19
|
-
actionFn: () => downloadUrl(data.downloadUrl),
|
|
20
|
-
display: source,
|
|
21
|
-
extensionKey
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ActionName } from '../../constants';
|
|
2
|
-
import { openEmbedModal } from '../../view/EmbedModal/utils';
|
|
3
|
-
import { extractPreviewAction as extractPreviewActionData } from '../flexible/actions/extract-preview-action';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
8
|
-
*/
|
|
9
|
-
export const extractPreviewActionProps = ({
|
|
10
|
-
response,
|
|
11
|
-
analytics,
|
|
12
|
-
extensionKey = 'empty-object-provider',
|
|
13
|
-
source = 'block',
|
|
14
|
-
actionOptions,
|
|
15
|
-
origin
|
|
16
|
-
}) => {
|
|
17
|
-
const data = extractPreviewActionData(response, actionOptions);
|
|
18
|
-
if (data !== null && data !== void 0 && data.src) {
|
|
19
|
-
return {
|
|
20
|
-
actionType: ActionName.PreviewAction,
|
|
21
|
-
actionFn: () => openEmbedModal({
|
|
22
|
-
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
23
|
-
showModal: true,
|
|
24
|
-
onClose: () => {},
|
|
25
|
-
analytics,
|
|
26
|
-
extensionKey,
|
|
27
|
-
origin,
|
|
28
|
-
...data
|
|
29
|
-
}),
|
|
30
|
-
// These values have already been set in analytics context.
|
|
31
|
-
// We only pass these here for ufo experience.
|
|
32
|
-
display: source,
|
|
33
|
-
extensionKey
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { openUrl } from '../../utils';
|
|
2
|
-
import { extractViewAction as extractViewActionData } from '../flexible/actions/extract-view-action';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
7
|
-
*/
|
|
8
|
-
export const extractViewActionProps = ({
|
|
9
|
-
response,
|
|
10
|
-
actionOptions,
|
|
11
|
-
extensionKey = 'empty-object-provider',
|
|
12
|
-
source = 'block'
|
|
13
|
-
}) => {
|
|
14
|
-
const data = extractViewActionData(response.data, actionOptions);
|
|
15
|
-
if (data) {
|
|
16
|
-
return {
|
|
17
|
-
actionType: 'ViewAction',
|
|
18
|
-
actionFn: () => openUrl(data.viewUrl),
|
|
19
|
-
display: source,
|
|
20
|
-
extensionKey
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
|
-
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
8
|
-
*/
|
|
9
|
-
export const extractViewAction = (data, actionOptions) => {
|
|
10
|
-
if (!canShowAction(CardAction.ViewAction, actionOptions)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const viewActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'ViewAction');
|
|
14
|
-
if (viewActionExists) {
|
|
15
|
-
return {
|
|
16
|
-
viewUrl: extractLink(data)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ActionName } from '../../constants';
|
|
2
|
-
import { downloadUrl } from '../../utils';
|
|
3
|
-
import { extractDownloadAction as extractDownloadActionData } from '../flexible/actions/extract-download-action';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
8
|
-
*/
|
|
9
|
-
export var extractDownloadActionProps = function extractDownloadActionProps(_ref) {
|
|
10
|
-
var response = _ref.response,
|
|
11
|
-
actionOptions = _ref.actionOptions,
|
|
12
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
13
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
14
|
-
_ref$source = _ref.source,
|
|
15
|
-
source = _ref$source === void 0 ? 'block' : _ref$source;
|
|
16
|
-
var data = extractDownloadActionData(response.data, actionOptions);
|
|
17
|
-
if (data) {
|
|
18
|
-
return {
|
|
19
|
-
actionType: ActionName.DownloadAction,
|
|
20
|
-
actionFn: function actionFn() {
|
|
21
|
-
return downloadUrl(data.downloadUrl);
|
|
22
|
-
},
|
|
23
|
-
display: source,
|
|
24
|
-
extensionKey: extensionKey
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
import { ActionName } from '../../constants';
|
|
5
|
-
import { openEmbedModal } from '../../view/EmbedModal/utils';
|
|
6
|
-
import { extractPreviewAction as extractPreviewActionData } from '../flexible/actions/extract-preview-action';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
10
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
11
|
-
*/
|
|
12
|
-
export var extractPreviewActionProps = function extractPreviewActionProps(_ref) {
|
|
13
|
-
var response = _ref.response,
|
|
14
|
-
analytics = _ref.analytics,
|
|
15
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
16
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
17
|
-
_ref$source = _ref.source,
|
|
18
|
-
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
19
|
-
actionOptions = _ref.actionOptions,
|
|
20
|
-
origin = _ref.origin;
|
|
21
|
-
var data = extractPreviewActionData(response, actionOptions);
|
|
22
|
-
if (data !== null && data !== void 0 && data.src) {
|
|
23
|
-
return {
|
|
24
|
-
actionType: ActionName.PreviewAction,
|
|
25
|
-
actionFn: function actionFn() {
|
|
26
|
-
return openEmbedModal(_objectSpread({
|
|
27
|
-
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
28
|
-
showModal: true,
|
|
29
|
-
onClose: function onClose() {},
|
|
30
|
-
analytics: analytics,
|
|
31
|
-
extensionKey: extensionKey,
|
|
32
|
-
origin: origin
|
|
33
|
-
}, data));
|
|
34
|
-
},
|
|
35
|
-
// These values have already been set in analytics context.
|
|
36
|
-
// We only pass these here for ufo experience.
|
|
37
|
-
display: source,
|
|
38
|
-
extensionKey: extensionKey
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { openUrl } from '../../utils';
|
|
2
|
-
import { extractViewAction as extractViewActionData } from '../flexible/actions/extract-view-action';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
7
|
-
*/
|
|
8
|
-
export var extractViewActionProps = function extractViewActionProps(_ref) {
|
|
9
|
-
var response = _ref.response,
|
|
10
|
-
actionOptions = _ref.actionOptions,
|
|
11
|
-
_ref$extensionKey = _ref.extensionKey,
|
|
12
|
-
extensionKey = _ref$extensionKey === void 0 ? 'empty-object-provider' : _ref$extensionKey,
|
|
13
|
-
_ref$source = _ref.source,
|
|
14
|
-
source = _ref$source === void 0 ? 'block' : _ref$source;
|
|
15
|
-
var data = extractViewActionData(response.data, actionOptions);
|
|
16
|
-
if (data) {
|
|
17
|
-
return {
|
|
18
|
-
actionType: 'ViewAction',
|
|
19
|
-
actionFn: function actionFn() {
|
|
20
|
-
return openUrl(data.viewUrl);
|
|
21
|
-
},
|
|
22
|
-
display: source,
|
|
23
|
-
extensionKey: extensionKey
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
|
-
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
8
|
-
*/
|
|
9
|
-
export var extractViewAction = function extractViewAction(data, actionOptions) {
|
|
10
|
-
if (!canShowAction(CardAction.ViewAction, actionOptions)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
var viewActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
14
|
-
return action['@type'] === 'ViewAction';
|
|
15
|
-
});
|
|
16
|
-
if (viewActionExists) {
|
|
17
|
-
return {
|
|
18
|
-
viewUrl: extractLink(data)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractDownloadActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractPreviewActionProps: ({ response, analytics, extensionKey, source, actionOptions, origin, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type JsonLd } from 'json-ld-types';
|
|
2
|
-
import { type ViewActionData } from '../../../state/flexible-ui-context/types';
|
|
3
|
-
import { type CardActionOptions } from '../../../view/Card/types';
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewAction: (data: JsonLd.Data.BaseData, actionOptions?: CardActionOptions) => ViewActionData | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractDownloadActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractPreviewActionProps: ({ response, analytics, extensionKey, source, actionOptions, origin, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type JsonLd } from 'json-ld-types';
|
|
2
|
-
import { type ViewActionData } from '../../../state/flexible-ui-context/types';
|
|
3
|
-
import { type CardActionOptions } from '../../../view/Card/types';
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewAction: (data: JsonLd.Data.BaseData, actionOptions?: CardActionOptions) => ViewActionData | undefined;
|