@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`dc3345f4b47`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dc3345f4b47) - Refactor flexible card to use client action hook. (Minor due to the change to the deprecated hook.)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`2c8b781fd3a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c8b781fd3a) - cleanup: remove server actions from actions extractor
|
|
12
|
+
|
|
13
|
+
## 26.24.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`cb6f1d7a319`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb6f1d7a319) - Add Follow/Unfollow action to flexible smart links (behind feature flag)
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`93888ff40ba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/93888ff40ba) - [ux] Style updates for refreshed smart cards behind a feature flag. If this update is successful it will be available in a later release.
|
|
22
|
+
|
|
3
23
|
## 26.23.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -151,6 +151,7 @@ exports.ElementName = ElementName;
|
|
|
151
151
|
var ActionName = /*#__PURE__*/function (ActionName) {
|
|
152
152
|
ActionName["DeleteAction"] = "DeleteAction";
|
|
153
153
|
ActionName["EditAction"] = "EditAction";
|
|
154
|
+
ActionName["FollowAction"] = "FollowAction";
|
|
154
155
|
ActionName["PreviewAction"] = "PreviewAction";
|
|
155
156
|
ActionName["ViewAction"] = "ViewAction";
|
|
156
157
|
ActionName["DownloadAction"] = "DownloadAction";
|
|
@@ -38,7 +38,7 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
38
38
|
var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
39
39
|
if (opts) {
|
|
40
40
|
var handleInvoke = opts.handleInvoke;
|
|
41
|
-
var actions = (0, _extractActions.
|
|
41
|
+
var actions = (0, _extractActions.extractClientActions)(jsonLd, handleInvoke);
|
|
42
42
|
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(_objectSpread(_objectSpread({}, opts), {}, {
|
|
43
43
|
viewProps: props,
|
|
44
44
|
jsonLd: jsonLd,
|
|
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.extractClientActions = extractClientActions;
|
|
8
8
|
exports.getActionsFromJsonLd = void 0;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _ViewAction = require("../../../view/BlockCard/actions/ViewAction");
|
|
12
11
|
var _DownloadAction = require("../../../view/BlockCard/actions/DownloadAction");
|
|
@@ -45,27 +44,6 @@ var getClientActionProps = function getClientActionProps(jsonLd, action, handler
|
|
|
45
44
|
}
|
|
46
45
|
});
|
|
47
46
|
};
|
|
48
|
-
var getServerActionProps = function getServerActionProps(jsonLd, action, handler) {
|
|
49
|
-
var id = action['@id'] || action['@type'];
|
|
50
|
-
var data = {
|
|
51
|
-
type: 'server',
|
|
52
|
-
key: action.identifier,
|
|
53
|
-
action: {
|
|
54
|
-
type: action['@type'],
|
|
55
|
-
payload: {
|
|
56
|
-
id: id,
|
|
57
|
-
context: jsonLd.context
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
id: id,
|
|
63
|
-
text: action.name,
|
|
64
|
-
promise: function promise() {
|
|
65
|
-
return handler(data);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
47
|
var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
70
48
|
var actions = jsonLd && jsonLd['schema:potentialAction'];
|
|
71
49
|
if (!actions) {
|
|
@@ -77,17 +55,11 @@ var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
|
77
55
|
return actions;
|
|
78
56
|
};
|
|
79
57
|
exports.getActionsFromJsonLd = getActionsFromJsonLd;
|
|
80
|
-
function
|
|
58
|
+
function extractClientActions(jsonLd, handler) {
|
|
81
59
|
var actions = getActionsFromJsonLd(jsonLd);
|
|
82
60
|
var clientActions = actions.filter(isClientAction);
|
|
83
|
-
var serverActions = actions.filter(function (action) {
|
|
84
|
-
return !isClientAction(action);
|
|
85
|
-
});
|
|
86
61
|
var clientActionImpls = clientActions.map(function (action) {
|
|
87
62
|
return getClientActionProps(jsonLd, action, handler);
|
|
88
63
|
});
|
|
89
|
-
|
|
90
|
-
return getServerActionProps(jsonLd, action, handler);
|
|
91
|
-
});
|
|
92
|
-
return [].concat((0, _toConsumableArray2.default)(clientActionImpls), (0, _toConsumableArray2.default)(serverActionImpls));
|
|
64
|
+
return clientActionImpls;
|
|
93
65
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 _linkExtractors = require("@atlaskit/link-extractors");
|
|
9
|
+
var _linkingTypes = require("@atlaskit/linking-types");
|
|
10
|
+
var _helpers = require("../../../state/helpers");
|
|
11
|
+
var _extractServerAction = _interopRequireDefault(require("../extract-server-action"));
|
|
12
|
+
var extractFollowAction = function extractFollowAction(response, showServerActions, id) {
|
|
13
|
+
var _action$dataUpdateAct;
|
|
14
|
+
if (!showServerActions) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var extensionKey = (0, _helpers.getExtensionKey)(response);
|
|
18
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
19
|
+
var actions = (0, _extractServerAction.default)(data);
|
|
20
|
+
if (!extensionKey || actions.length === 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
var action = actions.find(function (item) {
|
|
24
|
+
if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
|
|
25
|
+
var _dataUpdateAction;
|
|
26
|
+
var actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
|
|
27
|
+
return actionName === _linkingTypes.SmartLinkActionType.FollowEntityAction || actionName === _linkingTypes.SmartLinkActionType.UnfollowEntityAction;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
if (!action || !action.resourceIdentifiers) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var url = (0, _linkExtractors.extractLink)(data);
|
|
35
|
+
var reload = url ? {
|
|
36
|
+
id: id,
|
|
37
|
+
url: url
|
|
38
|
+
} : undefined;
|
|
39
|
+
var actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
|
|
40
|
+
return {
|
|
41
|
+
action: {
|
|
42
|
+
action: {
|
|
43
|
+
actionType: actionType,
|
|
44
|
+
resourceIdentifiers: action.resourceIdentifiers
|
|
45
|
+
},
|
|
46
|
+
providerKey: extensionKey,
|
|
47
|
+
reload: reload
|
|
48
|
+
},
|
|
49
|
+
value: actionType === _linkingTypes.SmartLinkActionType.FollowEntityAction
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
var _default = extractFollowAction;
|
|
53
|
+
exports.default = _default;
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _primitives = require("../common/primitives");
|
|
10
|
+
var _extractFollowAction = _interopRequireDefault(require("./actions/extract-follow-action"));
|
|
9
11
|
var _icon = require("./icon");
|
|
10
12
|
var _utils = require("./utils");
|
|
11
13
|
var _collaboratorGroup = require("./collaboratorGroup");
|
|
@@ -45,6 +47,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
45
47
|
assignedTo: (0, _utils.extractAssignedTo)(data),
|
|
46
48
|
createdOn: (0, _linkExtractors.extractDateCreated)(data),
|
|
47
49
|
dueOn: (0, _utils.extractDueOn)(data),
|
|
50
|
+
followAction: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.follow-button') ? (0, _extractFollowAction.default)(response, showServerActions, id) : undefined,
|
|
48
51
|
previewAction: (0, _extractPreviewAction.extractPreviewAction)(response),
|
|
49
52
|
viewAction: (0, _extractViewAction.extractViewAction)(data),
|
|
50
53
|
downloadAction: (0, _extractDownloadAction.extractDownloadAction)(data),
|
package/dist/cjs/messages.js
CHANGED
|
@@ -146,6 +146,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
146
146
|
defaultMessage: 'Edit',
|
|
147
147
|
description: 'Allow a user to edit a link'
|
|
148
148
|
},
|
|
149
|
+
follow: {
|
|
150
|
+
id: 'fabric.linking.follow',
|
|
151
|
+
defaultMessage: 'Follow',
|
|
152
|
+
description: 'Click to follow a project.'
|
|
153
|
+
},
|
|
149
154
|
forbidden_description: {
|
|
150
155
|
id: 'fabric.linking.forbidden_description',
|
|
151
156
|
defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
|
|
@@ -431,6 +436,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
431
436
|
defaultMessage: 'Unassigned',
|
|
432
437
|
description: 'Shown as a tooltip text for a default unassigned fallback avatar'
|
|
433
438
|
},
|
|
439
|
+
unfollow: {
|
|
440
|
+
id: 'fabric.linking.unfollow',
|
|
441
|
+
defaultMessage: 'Unfollow',
|
|
442
|
+
description: 'Click to unfollow a project.'
|
|
443
|
+
},
|
|
434
444
|
unlink_account: {
|
|
435
445
|
id: 'fabric.linking.unlink_account',
|
|
436
446
|
defaultMessage: 'Unlink Account',
|
|
@@ -254,11 +254,11 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
254
254
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
255
255
|
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
256
256
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
257
|
-
* @param invokeType
|
|
257
|
+
* @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
258
258
|
* @returns
|
|
259
259
|
*/
|
|
260
260
|
actionClickedEvent: function actionClickedEvent(_ref6) {
|
|
261
|
-
var
|
|
261
|
+
var id = _ref6.id,
|
|
262
262
|
actionType = _ref6.actionType,
|
|
263
263
|
display = _ref6.display,
|
|
264
264
|
invokeType = _ref6.invokeType,
|
|
@@ -269,14 +269,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
269
269
|
destinationSubproduct = _ref6.destinationSubproduct,
|
|
270
270
|
location = _ref6.location;
|
|
271
271
|
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
272
|
-
(0, _ufoExperiences.startUfoExperience)('smart-link-action-invocation', experienceId, {
|
|
273
|
-
actionType: actionType,
|
|
274
|
-
display: display,
|
|
275
|
-
extensionKey: extensionKey,
|
|
276
|
-
invokeType: invokeType
|
|
277
|
-
});
|
|
278
272
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.uiActionClickedEvent)({
|
|
279
|
-
id: defaultId,
|
|
273
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
280
274
|
actionType: actionType,
|
|
281
275
|
display: display,
|
|
282
276
|
extensionKey: extensionKey,
|
|
@@ -534,7 +528,7 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
534
528
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
535
529
|
*/
|
|
536
530
|
invokeSucceededEvent: function invokeSucceededEvent(_ref13) {
|
|
537
|
-
var
|
|
531
|
+
var id = _ref13.id,
|
|
538
532
|
actionType = _ref13.actionType,
|
|
539
533
|
display = _ref13.display,
|
|
540
534
|
extensionKey = _ref13.extensionKey,
|
|
@@ -543,9 +537,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
543
537
|
destinationProduct = _ref13.destinationProduct,
|
|
544
538
|
destinationSubproduct = _ref13.destinationSubproduct,
|
|
545
539
|
location = _ref13.location;
|
|
546
|
-
(0, _ufoExperiences.succeedUfoExperience)('smart-link-action-invocation', experienceId);
|
|
547
540
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.invokeSucceededEvent)({
|
|
548
|
-
id: defaultId,
|
|
541
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
549
542
|
actionType: actionType,
|
|
550
543
|
display: display,
|
|
551
544
|
extensionKey: extensionKey,
|
|
@@ -565,7 +558,7 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
565
558
|
* @param reason The reason the invocation failed.
|
|
566
559
|
*/
|
|
567
560
|
invokeFailedEvent: function invokeFailedEvent(_ref14) {
|
|
568
|
-
var
|
|
561
|
+
var id = _ref14.id,
|
|
569
562
|
actionType = _ref14.actionType,
|
|
570
563
|
display = _ref14.display,
|
|
571
564
|
reason = _ref14.reason,
|
|
@@ -575,9 +568,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
575
568
|
destinationProduct = _ref14.destinationProduct,
|
|
576
569
|
destinationSubproduct = _ref14.destinationSubproduct,
|
|
577
570
|
location = _ref14.location;
|
|
578
|
-
(0, _ufoExperiences.failUfoExperience)('smart-link-action-invocation', experienceId);
|
|
579
571
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.invokeFailedEvent)({
|
|
580
|
-
id: defaultId,
|
|
572
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
581
573
|
actionType: actionType,
|
|
582
574
|
display: display,
|
|
583
575
|
reason: reason,
|
|
@@ -11,8 +11,11 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var measure = _interopRequireWildcard(require("../../../utils/performance"));
|
|
14
|
+
var _analytics = require("../../analytics");
|
|
14
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* Invoke client action such as preview, download and open link
|
|
18
21
|
*/
|
|
@@ -29,45 +32,48 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
29
32
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
30
33
|
measure.mark(markName, 'pending');
|
|
31
34
|
_context.prev = 4;
|
|
32
|
-
// Begin
|
|
33
|
-
|
|
34
|
-
id: experienceId,
|
|
35
|
-
extensionKey: extensionKey,
|
|
35
|
+
// Begin UFO experience
|
|
36
|
+
(0, _analytics.startUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId, {
|
|
36
37
|
actionType: actionType,
|
|
37
38
|
display: display,
|
|
39
|
+
extensionKey: extensionKey,
|
|
38
40
|
invokeType: 'client'
|
|
39
41
|
});
|
|
40
42
|
|
|
43
|
+
// Begin analytics instrumentation.
|
|
44
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
|
|
45
|
+
actionType: actionType,
|
|
46
|
+
display: display
|
|
47
|
+
});
|
|
48
|
+
|
|
41
49
|
// Invoke action
|
|
42
|
-
_context.next =
|
|
50
|
+
_context.next = 9;
|
|
43
51
|
return actionFn();
|
|
44
|
-
case
|
|
52
|
+
case 9:
|
|
45
53
|
result = _context.sent;
|
|
46
54
|
measure.mark(markName, 'resolved');
|
|
55
|
+
(0, _analytics.succeedUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId);
|
|
47
56
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeSucceededEvent({
|
|
48
|
-
id: experienceId,
|
|
49
|
-
extensionKey: extensionKey,
|
|
50
57
|
actionType: actionType,
|
|
51
58
|
display: display
|
|
52
59
|
});
|
|
53
60
|
return _context.abrupt("return", result);
|
|
54
|
-
case
|
|
55
|
-
_context.prev =
|
|
61
|
+
case 16:
|
|
62
|
+
_context.prev = 16;
|
|
56
63
|
_context.t0 = _context["catch"](4);
|
|
57
64
|
measure.mark(markName, 'errored');
|
|
65
|
+
(0, _analytics.failUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId);
|
|
58
66
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
59
67
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeFailedEvent({
|
|
60
|
-
id: experienceId,
|
|
61
|
-
extensionKey: extensionKey,
|
|
62
68
|
actionType: actionType,
|
|
63
69
|
display: display,
|
|
64
70
|
reason: reason
|
|
65
71
|
});
|
|
66
|
-
case
|
|
72
|
+
case 22:
|
|
67
73
|
case "end":
|
|
68
74
|
return _context.stop();
|
|
69
75
|
}
|
|
70
|
-
}, _callee, null, [[4,
|
|
76
|
+
}, _callee, null, [[4, 16]]);
|
|
71
77
|
}));
|
|
72
78
|
return function (_x) {
|
|
73
79
|
return _ref3.apply(this, arguments);
|
|
@@ -21,7 +21,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
|
|
|
21
21
|
var context = {
|
|
22
22
|
componentName: 'smart-cards',
|
|
23
23
|
packageName: "@atlaskit/smart-card",
|
|
24
|
-
packageVersion: "26.
|
|
24
|
+
packageVersion: "26.25.0"
|
|
25
25
|
};
|
|
26
26
|
exports.context = context;
|
|
27
27
|
var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
@@ -41,6 +41,7 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
|
|
|
41
41
|
return onAuthorize ? [(0, _RetryAction.RetryAction)(onAuthorize)] : [];
|
|
42
42
|
}, [onAuthorize]);
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
44
|
+
appearance: "block",
|
|
44
45
|
cardState: cardState,
|
|
45
46
|
onAuthorize: onAuthorize,
|
|
46
47
|
onClick: onClick,
|
|
@@ -14,7 +14,6 @@ var _titleBlock = _interopRequireDefault(require("../../../FlexibleCard/componen
|
|
|
14
14
|
var _blocks = require("../../../FlexibleCard/components/blocks");
|
|
15
15
|
var _styled = require("./styled");
|
|
16
16
|
var _constants = require("../../../../constants");
|
|
17
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
18
17
|
var _utils = require("./utils");
|
|
19
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
19
|
var _withFlexibleUIBlockCardStyle = require("./utils/withFlexibleUIBlockCardStyle");
|
|
@@ -45,11 +44,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
45
44
|
(0, _react.useEffect)(function () {
|
|
46
45
|
setIsPreviewBlockErrored(false);
|
|
47
46
|
}, [url, cardState]);
|
|
48
|
-
var _useState3 = (0, _react.useState)(function () {
|
|
49
|
-
return id ? id : (0, _uuid.default)();
|
|
50
|
-
}),
|
|
51
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 1),
|
|
52
|
-
analyticsId = _useState4[0];
|
|
53
47
|
var _ref2 = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? (0, _utils.getSimulatedBetterMetadata)(cardState.details) : (0, _utils.getSimulatedMetadata)(cardState.details),
|
|
54
48
|
titleMetadata = _ref2.titleMetadata,
|
|
55
49
|
topMetadata = _ref2.topMetadata,
|
|
@@ -96,49 +90,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
96
90
|
}, {
|
|
97
91
|
actions: [{
|
|
98
92
|
name: _constants.ActionName.PreviewAction,
|
|
99
|
-
hideIcon: true
|
|
100
|
-
onClick: function onClick() {
|
|
101
|
-
analytics.ui.actionClickedEvent({
|
|
102
|
-
id: analyticsId,
|
|
103
|
-
actionType: 'PreviewAction',
|
|
104
|
-
display: _constants.CardDisplay.Block
|
|
105
|
-
});
|
|
106
|
-
analytics.operational.invokeSucceededEvent({
|
|
107
|
-
id: analyticsId,
|
|
108
|
-
actionType: 'PreviewAction',
|
|
109
|
-
display: _constants.CardDisplay.Block
|
|
110
|
-
});
|
|
111
|
-
}
|
|
93
|
+
hideIcon: true
|
|
112
94
|
}, {
|
|
113
95
|
name: _constants.ActionName.ViewAction,
|
|
114
|
-
hideIcon: true
|
|
115
|
-
onClick: function onClick() {
|
|
116
|
-
analytics.ui.actionClickedEvent({
|
|
117
|
-
id: analyticsId,
|
|
118
|
-
actionType: 'ViewAction',
|
|
119
|
-
display: _constants.CardDisplay.Block
|
|
120
|
-
});
|
|
121
|
-
analytics.operational.invokeSucceededEvent({
|
|
122
|
-
id: analyticsId,
|
|
123
|
-
actionType: 'ViewAction',
|
|
124
|
-
display: _constants.CardDisplay.Block
|
|
125
|
-
});
|
|
126
|
-
}
|
|
96
|
+
hideIcon: true
|
|
127
97
|
}, {
|
|
128
98
|
name: _constants.ActionName.DownloadAction,
|
|
129
|
-
hideIcon: true
|
|
130
|
-
onClick: function onClick() {
|
|
131
|
-
analytics.ui.actionClickedEvent({
|
|
132
|
-
id: analyticsId,
|
|
133
|
-
actionType: 'DownloadAction',
|
|
134
|
-
display: _constants.CardDisplay.Block
|
|
135
|
-
});
|
|
136
|
-
analytics.operational.invokeSucceededEvent({
|
|
137
|
-
id: analyticsId,
|
|
138
|
-
actionType: 'DownloadAction',
|
|
139
|
-
display: _constants.CardDisplay.Block
|
|
140
|
-
});
|
|
141
|
-
}
|
|
99
|
+
hideIcon: true
|
|
142
100
|
}]
|
|
143
101
|
})));
|
|
144
102
|
};
|
|
@@ -16,9 +16,9 @@ var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0,
|
|
|
16
16
|
exports.metadataBlockCss = metadataBlockCss;
|
|
17
17
|
var titleBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n"])), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
18
18
|
exports.titleBlockCss = titleBlockCss;
|
|
19
|
-
var footerBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: 1.5rem;\n"])));
|
|
19
|
+
var footerBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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"])));
|
|
20
20
|
exports.footerBlockCss = footerBlockCss;
|
|
21
21
|
var flexibleBlockCardElevationStyle = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), _token.tokens.elevation, "var(--ds-space-025, 2px)");
|
|
22
|
-
var refreshedFlexibleBlockCardStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-
|
|
22
|
+
var refreshedFlexibleBlockCardStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border-input, ".concat(_colors.N40, ")"));
|
|
23
23
|
var flexibleBlockCardStyle = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
24
24
|
exports.flexibleBlockCardStyle = flexibleBlockCardStyle;
|
|
@@ -21,8 +21,8 @@ exports.className = className;
|
|
|
21
21
|
var borderRadius = "\n border-radius: ".concat((0, _constants.borderRadius)(), "px;\n");
|
|
22
22
|
exports.borderRadius = borderRadius;
|
|
23
23
|
var BACKGROUND_COLOR_DARK = '#262B31';
|
|
24
|
-
var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-
|
|
25
|
-
var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-
|
|
24
|
+
var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n");
|
|
25
|
+
var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-100, 4px)", ";\n");
|
|
26
26
|
var ellipsis = function ellipsis() {
|
|
27
27
|
var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
28
28
|
var unit = typeof maxWidth === 'number' ? 'px' : '';
|
|
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
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");
|
|
13
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; }
|
|
14
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; }
|
|
15
20
|
var DownloadAction = function DownloadAction(props) {
|
|
@@ -19,10 +24,37 @@ var DownloadAction = function DownloadAction(props) {
|
|
|
19
24
|
_onClick = props.onClick,
|
|
20
25
|
testId = props.testId,
|
|
21
26
|
url = props.url;
|
|
27
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
28
|
+
var invoke = (0, _useInvokeClientAction.default)({
|
|
29
|
+
analytics: analytics
|
|
30
|
+
});
|
|
22
31
|
if (downloadUrl && url) {
|
|
23
32
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
24
33
|
onClick: function onClick() {
|
|
25
|
-
(
|
|
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
|
+
});
|
|
26
58
|
if (_onClick) {
|
|
27
59
|
_onClick();
|
|
28
60
|
}
|
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
14
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
13
|
-
var _state = require("../../../../../../state");
|
|
14
15
|
var _reactIntlNext = require("react-intl-next");
|
|
15
16
|
var _messages = require("../../../../../../messages");
|
|
16
17
|
var _utils = require("../../../utils");
|
|
18
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
19
|
+
var _constants = require("../../../../../../constants");
|
|
17
20
|
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; }
|
|
18
21
|
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; }
|
|
19
22
|
var PreviewAction = function PreviewAction(props) {
|
|
@@ -28,23 +31,46 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
28
31
|
providerName = props.providerName,
|
|
29
32
|
downloadUrl = props.downloadUrl,
|
|
30
33
|
isSupportTheming = props.isSupportTheming;
|
|
31
|
-
var
|
|
32
|
-
var
|
|
34
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
35
|
+
var invoke = (0, _useInvokeClientAction.default)({
|
|
36
|
+
analytics: analytics
|
|
37
|
+
});
|
|
33
38
|
if (src && url) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
var actionFn = /*#__PURE__*/function () {
|
|
40
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
41
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
return _context.abrupt("return", (0, _utils.openEmbedModalWithFlexibleUiIcon)({
|
|
45
|
+
download: downloadUrl,
|
|
46
|
+
title: title,
|
|
47
|
+
providerName: providerName,
|
|
48
|
+
isSupportTheming: isSupportTheming,
|
|
49
|
+
analytics: analytics,
|
|
50
|
+
linkIcon: linkIcon,
|
|
51
|
+
src: src,
|
|
52
|
+
url: url
|
|
53
|
+
}));
|
|
54
|
+
case 1:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee);
|
|
59
|
+
}));
|
|
60
|
+
return function actionFn() {
|
|
61
|
+
return _ref.apply(this, arguments);
|
|
62
|
+
};
|
|
63
|
+
}();
|
|
45
64
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
46
65
|
onClick: function onClick() {
|
|
47
|
-
|
|
66
|
+
invoke({
|
|
67
|
+
actionType: _constants.ActionName.PreviewAction,
|
|
68
|
+
actionFn: actionFn,
|
|
69
|
+
// These values have already been set in analytics context.
|
|
70
|
+
// We only pass these here for ufo experience.
|
|
71
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
72
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
73
|
+
});
|
|
48
74
|
if (_onClick) {
|
|
49
75
|
_onClick();
|
|
50
76
|
}
|
|
@@ -44,14 +44,14 @@ var ServerAction = function ServerAction(_ref) {
|
|
|
44
44
|
_context.next = 6;
|
|
45
45
|
return invoke(request);
|
|
46
46
|
case 6:
|
|
47
|
-
setIsLoading(false);
|
|
48
47
|
if (!(action.reload && action.reload.url)) {
|
|
49
|
-
_context.next =
|
|
48
|
+
_context.next = 9;
|
|
50
49
|
break;
|
|
51
50
|
}
|
|
52
|
-
_context.next =
|
|
51
|
+
_context.next = 9;
|
|
53
52
|
return reload(action.reload.url, true, undefined, action.reload.id);
|
|
54
|
-
case
|
|
53
|
+
case 9:
|
|
54
|
+
setIsLoading(false);
|
|
55
55
|
if (onClick) {
|
|
56
56
|
onClick();
|
|
57
57
|
}
|