@atlaskit/smart-card 26.56.5 → 26.57.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 +7 -0
- package/dist/cjs/constants.js +5 -1
- package/dist/cjs/extractors/flexible/actions/extract-ai-summary-action.js +20 -0
- package/dist/cjs/extractors/flexible/actions/index.js +3 -2
- package/dist/cjs/extractors/flexible/index.js +3 -2
- package/dist/cjs/messages.js +10 -0
- package/dist/cjs/state/hooks/use-ai-summary-config/index.js +19 -0
- package/dist/cjs/state/hooks/use-ai-summary-config/types.js +5 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/get-is-ai-summary-enabled.js +13 -0
- package/dist/cjs/view/Card/types.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +60 -0
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/index.js +19 -0
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/index.js +4 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -1
- package/dist/cjs/view/HoverCard/utils.js +1 -7
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/constants.js +4 -1
- package/dist/es2019/extractors/flexible/actions/extract-ai-summary-action.js +14 -0
- package/dist/es2019/extractors/flexible/actions/index.js +5 -3
- package/dist/es2019/extractors/flexible/index.js +3 -2
- package/dist/es2019/messages.js +10 -0
- package/dist/es2019/state/flexible-ui-context/types.js +1 -1
- package/dist/es2019/state/hooks/use-ai-summary-config/index.js +12 -0
- package/dist/es2019/state/hooks/use-ai-summary-config/types.js +1 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/get-is-ai-summary-enabled.js +5 -0
- package/dist/es2019/view/Card/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +51 -0
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/index.js +12 -0
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/index.js +4 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -1
- package/dist/es2019/view/HoverCard/utils.js +0 -4
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/constants.js +4 -1
- package/dist/esm/extractors/flexible/actions/extract-ai-summary-action.js +14 -0
- package/dist/esm/extractors/flexible/actions/index.js +4 -3
- package/dist/esm/extractors/flexible/index.js +3 -2
- package/dist/esm/messages.js +10 -0
- package/dist/esm/state/flexible-ui-context/types.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary-config/index.js +13 -0
- package/dist/esm/state/hooks/use-ai-summary-config/types.js +1 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/get-is-ai-summary-enabled.js +7 -0
- package/dist/esm/view/Card/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +50 -0
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/index.js +12 -0
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -1
- package/dist/esm/view/FlexibleCard/index.js +4 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +2 -1
- package/dist/esm/view/HoverCard/utils.js +0 -6
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +2 -0
- package/dist/types/extractors/flexible/actions/extract-ai-summary-action.d.ts +5 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +2 -1
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +8 -1
- package/dist/types/state/hooks/use-ai-summary-config/index.d.ts +2 -0
- package/dist/types/state/hooks/use-ai-summary-config/types.d.ts +5 -0
- package/dist/types/utils/get-is-ai-summary-enabled.d.ts +2 -0
- package/dist/types/view/Card/types.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/action-block/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/types.d.ts +2 -0
- package/dist/types/view/HoverCard/utils.d.ts +0 -1
- package/dist/types-ts4.5/constants.d.ts +4 -0
- package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +2 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-ai-summary-action.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +8 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary-config/index.d.ts +2 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary-config/types.d.ts +5 -0
- package/dist/types-ts4.5/utils/get-is-ai-summary-enabled.d.ts +2 -0
- package/dist/types-ts4.5/view/Card/types.d.ts +2 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/types.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -0
- package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.57.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#91341](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91341) [`0d60ffae0a83`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d60ffae0a83) - Increases the flexible snippet block line maximum from 3 to 6
|
|
8
|
+
- [#91338](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91338) [`e993af1f6cbb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e993af1f6cbb) - Add AI Summary action to Flex UI action block
|
|
9
|
+
|
|
3
10
|
## 26.56.5
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkInternalTheme = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.MediaPlacement = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI = exports.CONTENT_URL_ACCEPTABLE_USE_POLICY = exports.CONTENT_URL_3P_ACCOUNT_AUTH = exports.ActionName = void 0;
|
|
6
|
+
exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkInternalTheme = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.MediaPlacement = exports.InternalActionName = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI = exports.CONTENT_URL_ACCEPTABLE_USE_POLICY = exports.CONTENT_URL_3P_ACCOUNT_AUTH = exports.ActionName = void 0;
|
|
7
7
|
var CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
|
|
8
8
|
var CONTENT_URL_3P_ACCOUNT_AUTH = exports.CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
|
|
9
9
|
var CONTENT_URL_AI = exports.CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
|
|
@@ -153,6 +153,10 @@ var ActionName = exports.ActionName = /*#__PURE__*/function (ActionName) {
|
|
|
153
153
|
ActionName["CustomAction"] = "CustomAction";
|
|
154
154
|
return ActionName;
|
|
155
155
|
}({});
|
|
156
|
+
var InternalActionName = exports.InternalActionName = /*#__PURE__*/function (InternalActionName) {
|
|
157
|
+
InternalActionName["AISummaryAction"] = "AISummaryAction";
|
|
158
|
+
return InternalActionName;
|
|
159
|
+
}({});
|
|
156
160
|
/**
|
|
157
161
|
* Flexible UI icons - each mapped to AK icons.
|
|
158
162
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractAISummaryAction = void 0;
|
|
7
|
+
var _types = require("../../../view/Card/types");
|
|
8
|
+
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
9
|
+
var _getIsAiSummaryEnabled = require("../../../utils/get-is-ai-summary-enabled");
|
|
10
|
+
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
11
|
+
var extractAISummaryAction = exports.extractAISummaryAction = function extractAISummaryAction(response, url, actionOptions, aiSummaryConfig) {
|
|
12
|
+
if (!(0, _canShowAction.canShowAction)(_types.CardAction.AISummaryAction, actionOptions) || !(0, _getIsAiSummaryEnabled.getIsAISummaryEnabled)(aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.isAdminHubAIEnabled, response) || !(aiSummaryConfig !== null && aiSummaryConfig !== void 0 && aiSummaryConfig.product) || !url) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
url: url,
|
|
17
|
+
ari: (0, _linkExtractors.extractAri)(response.data),
|
|
18
|
+
product: aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.product
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -9,12 +9,13 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _constants = require("../../../constants");
|
|
10
10
|
var _extractDownloadAction = require("./extract-download-action");
|
|
11
11
|
var _extractPreviewAction = require("./extract-preview-action");
|
|
12
|
+
var _extractAiSummaryAction = require("./extract-ai-summary-action");
|
|
12
13
|
var _extractFollowAction = _interopRequireDefault(require("./extract-follow-action"));
|
|
13
14
|
var _extractCopyLinkAction = require("./extract-copy-link-action");
|
|
14
|
-
var extractActions = function extractActions(response, actionOptions, id) {
|
|
15
|
+
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
15
16
|
var _action;
|
|
16
17
|
var data = response.data;
|
|
17
|
-
var action = (_action = {}, (0, _defineProperty2.default)(_action, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_action, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), _action);
|
|
18
|
+
var action = (_action = {}, (0, _defineProperty2.default)(_action, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_action, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (0, _defineProperty2.default)(_action, _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _action);
|
|
18
19
|
return Object.values(action).some(function (value) {
|
|
19
20
|
return Boolean(value);
|
|
20
21
|
}) ? action : undefined;
|
|
@@ -22,14 +22,15 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
22
22
|
id = _ref.id,
|
|
23
23
|
renderers = _ref.renderers,
|
|
24
24
|
actionOptions = _ref.actionOptions,
|
|
25
|
-
response = _ref.response
|
|
25
|
+
response = _ref.response,
|
|
26
|
+
aiSummaryConfig = _ref.aiSummaryConfig;
|
|
26
27
|
if (!response) {
|
|
27
28
|
return undefined;
|
|
28
29
|
}
|
|
29
30
|
var data = response.data;
|
|
30
31
|
var url = (0, _linkExtractors.extractLink)(data);
|
|
31
32
|
return {
|
|
32
|
-
actions: (0, _actions.default)(response, actionOptions, id),
|
|
33
|
+
actions: (0, _actions.default)(response, url, actionOptions, id, aiSummaryConfig),
|
|
33
34
|
assignedToGroup: (0, _utils.extractPersonAssignedToAsArray)(data),
|
|
34
35
|
attachmentCount: (0, _utils.extractAttachmentCount)(data),
|
|
35
36
|
authorGroup: (0, _linkExtractors.extractPersonCreatedBy)(data),
|
package/dist/cjs/messages.js
CHANGED
|
@@ -201,6 +201,16 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
201
201
|
defaultMessage: 'Download file',
|
|
202
202
|
description: 'Allow a user to download a file'
|
|
203
203
|
},
|
|
204
|
+
ai_summary_action: {
|
|
205
|
+
id: 'fabric.linking.ai_summary_action.nonfinal',
|
|
206
|
+
defaultMessage: 'Summarize with AI',
|
|
207
|
+
description: 'Allow a user to summarize a link'
|
|
208
|
+
},
|
|
209
|
+
ai_summary_action_description: {
|
|
210
|
+
id: 'fabric.linking.ai_summary_action_description.nonfinal',
|
|
211
|
+
defaultMessage: 'Summarize the content of this link using Atlassian Intelligence.',
|
|
212
|
+
description: 'Description of what the summarize link with AI action does'
|
|
213
|
+
},
|
|
204
214
|
edit: {
|
|
205
215
|
id: 'fabric.linking.edit',
|
|
206
216
|
defaultMessage: 'Edit',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAISummaryConfig = void 0;
|
|
7
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var useAISummaryConfig = exports.useAISummaryConfig = function useAISummaryConfig() {
|
|
10
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
11
|
+
product = _useSmartLinkContext.product,
|
|
12
|
+
isAdminHubAIEnabled = _useSmartLinkContext.isAdminHubAIEnabled;
|
|
13
|
+
return (0, _react.useMemo)(function () {
|
|
14
|
+
return {
|
|
15
|
+
product: product,
|
|
16
|
+
isAdminHubAIEnabled: isAdminHubAIEnabled
|
|
17
|
+
};
|
|
18
|
+
}, [product, isAdminHubAIEnabled]);
|
|
19
|
+
};
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.
|
|
25
|
+
packageVersion: "26.57.0"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getIsAISummaryEnabled = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
var getIsAISummaryEnabled = exports.getIsAISummaryEnabled = function getIsAISummaryEnabled() {
|
|
9
|
+
var _response$meta;
|
|
10
|
+
var isAdminHubAIEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
11
|
+
var response = arguments.length > 1 ? arguments[1] : undefined;
|
|
12
|
+
return Boolean((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 || (_response$meta = response.meta) === null || _response$meta === void 0 || (_response$meta = _response$meta.supportedFeature) === null || _response$meta === void 0 ? void 0 : _response$meta.includes('AISummary')));
|
|
13
|
+
};
|
|
@@ -11,5 +11,6 @@ var CardAction = exports.CardAction = /*#__PURE__*/function (CardAction) {
|
|
|
11
11
|
CardAction["ChangeStatusAction"] = "ChangeStatusAction";
|
|
12
12
|
CardAction["FollowAction"] = "FollowAction";
|
|
13
13
|
CardAction["CopyLinkAction"] = "CopyLinkAction";
|
|
14
|
+
CardAction["AISummaryAction"] = "AISummaryAction";
|
|
14
15
|
return CardAction;
|
|
15
16
|
}({});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AISummaryActionComponent = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _messages = require("../../../../../messages");
|
|
14
|
+
var _action = _interopRequireDefault(require("../action"));
|
|
15
|
+
var _aiIcon = _interopRequireDefault(require("../../../../common/ai-icon"));
|
|
16
|
+
var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
|
|
17
|
+
var _useAiSummary = require("../../../../../state/hooks/use-ai-summary");
|
|
18
|
+
var _excluded = ["onClick", "url", "ari", "product"];
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
var AISummaryActionComponent = exports.AISummaryActionComponent = function AISummaryActionComponent(_ref) {
|
|
22
|
+
var onClickCallback = _ref.onClick,
|
|
23
|
+
_ref$url = _ref.url,
|
|
24
|
+
url = _ref$url === void 0 ? '' : _ref$url,
|
|
25
|
+
_ref$ari = _ref.ari,
|
|
26
|
+
ari = _ref$ari === void 0 ? '' : _ref$ari,
|
|
27
|
+
product = _ref.product,
|
|
28
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
29
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
30
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
31
|
+
var _useAISummary = (0, _useAiSummary.useAISummary)({
|
|
32
|
+
url: url,
|
|
33
|
+
ari: ari,
|
|
34
|
+
product: product
|
|
35
|
+
}),
|
|
36
|
+
status = _useAISummary.state.status,
|
|
37
|
+
summariseUrl = _useAISummary.summariseUrl;
|
|
38
|
+
var handleActionClick = (0, _react.useCallback)(function () {
|
|
39
|
+
fireEvent('ui.button.clicked.aiSummary', {});
|
|
40
|
+
fireEvent('track.aiInteraction.initiated', {
|
|
41
|
+
aiFeatureName: 'Smart Links Summary',
|
|
42
|
+
proactiveAIGenerated: 0,
|
|
43
|
+
userGeneratedAI: 1
|
|
44
|
+
});
|
|
45
|
+
summariseUrl();
|
|
46
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
47
|
+
}, [fireEvent, onClickCallback, summariseUrl]);
|
|
48
|
+
if (status === 'ready' || status === 'error') {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
|
|
50
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action),
|
|
51
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
|
|
52
|
+
label: "Summarise with AI"
|
|
53
|
+
}),
|
|
54
|
+
onClick: handleActionClick,
|
|
55
|
+
testId: "smart-action-ai-summary-action",
|
|
56
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action_description)
|
|
57
|
+
}, props));
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
11
|
+
var _constants = require("../../../../../constants");
|
|
12
|
+
var _aiSummaryActionComponent = require("./ai-summary-action-component");
|
|
13
|
+
var AISummaryAction = function AISummaryAction(props) {
|
|
14
|
+
var _context$actions;
|
|
15
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
16
|
+
var actionData = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[_constants.InternalActionName.AISummaryAction];
|
|
17
|
+
return actionData ? /*#__PURE__*/_react.default.createElement(_aiSummaryActionComponent.AISummaryActionComponent, (0, _extends2.default)({}, actionData, props)) : null;
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = AISummaryAction;
|
|
@@ -4,6 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "AISummaryAction", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _aiSummaryAction.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
Object.defineProperty(exports, "CopyLinkAction", {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
get: function get() {
|
|
@@ -52,4 +58,5 @@ var _editAction = _interopRequireDefault(require("./edit-action"));
|
|
|
52
58
|
var _downloadAction = _interopRequireDefault(require("./download-action"));
|
|
53
59
|
var _followAction = _interopRequireDefault(require("./follow-action"));
|
|
54
60
|
var _previewAction = _interopRequireDefault(require("./preview-action"));
|
|
55
|
-
var _copyLinkAction = _interopRequireDefault(require("./copy-link-action"));
|
|
61
|
+
var _copyLinkAction = _interopRequireDefault(require("./copy-link-action"));
|
|
62
|
+
var _aiSummaryAction = _interopRequireDefault(require("./ai-summary-action"));
|
|
@@ -19,7 +19,7 @@ var ignoreContainerPaddingStyles = (0, _primitives.xcss)({
|
|
|
19
19
|
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
20
20
|
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
21
21
|
});
|
|
22
|
-
var DEFAULT_SORT_ORDER = [
|
|
22
|
+
var DEFAULT_SORT_ORDER = ['PreviewAction', 'CopyLinkAction', 'AISummaryAction'];
|
|
23
23
|
var sort = function sort(a, b) {
|
|
24
24
|
var idxA = DEFAULT_SORT_ORDER.indexOf(a);
|
|
25
25
|
var idxB = DEFAULT_SORT_ORDER.indexOf(b);
|
|
@@ -20,8 +20,6 @@ var _aiStateIndicator = _interopRequireDefault(require("../ai-state-indicator"))
|
|
|
20
20
|
var _utils = require("../../utils");
|
|
21
21
|
var _messages = require("../../../../../../messages");
|
|
22
22
|
var _useAiSummary = require("../../../../../../state/hooks/use-ai-summary");
|
|
23
|
-
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
24
|
-
var _linkProvider = require("@atlaskit/link-provider");
|
|
25
23
|
var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
|
|
26
24
|
var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
|
|
27
25
|
var _useAnalyticsEvents2 = require("../../../../../../common/analytics/generated/use-analytics-events");
|
|
@@ -30,6 +28,8 @@ var _aiEventErrorViewed = _interopRequireDefault(require("../ai-event-error-view
|
|
|
30
28
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
31
29
|
var _react2 = require("@emotion/react");
|
|
32
30
|
var _featureDiscovery = _interopRequireDefault(require("../feature-discovery"));
|
|
31
|
+
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
32
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
33
33
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
34
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
35
|
var AISummaryBlockErrorIndicator = exports.AISummaryBlockErrorIndicator = function AISummaryBlockErrorIndicator(_ref) {
|
|
@@ -14,7 +14,7 @@ var _elements = require("../../elements");
|
|
|
14
14
|
var _utils = require("../../utils");
|
|
15
15
|
var _excluded = ["maxLines", "status", "testId", "text"];
|
|
16
16
|
var DEFAULT_MAX_LINES = 3;
|
|
17
|
-
var MAXIMUM_MAX_LINES =
|
|
17
|
+
var MAXIMUM_MAX_LINES = 6;
|
|
18
18
|
var MINIMUM_MAX_LINES = 1;
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -13,6 +13,7 @@ var _constants = require("../../constants");
|
|
|
13
13
|
var _container = _interopRequireDefault(require("./components/container"));
|
|
14
14
|
var _flexibleUiContext = require("../../state/flexible-ui-context");
|
|
15
15
|
var _utils = require("./utils");
|
|
16
|
+
var _useAiSummaryConfig = require("../../state/hooks/use-ai-summary-config");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
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; }
|
|
@@ -42,11 +43,13 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
42
43
|
testId = _ref.testId,
|
|
43
44
|
ui = _ref.ui,
|
|
44
45
|
url = _ref.url;
|
|
46
|
+
var aiSummaryConfig = (0, _useAiSummaryConfig.useAISummaryConfig)();
|
|
45
47
|
var cardType = cardState.status,
|
|
46
48
|
details = cardState.details;
|
|
47
49
|
var status = cardType;
|
|
48
50
|
var context = (0, _react.useMemo)(function () {
|
|
49
51
|
return (0, _utils.getContextByStatus)({
|
|
52
|
+
aiSummaryConfig: aiSummaryConfig,
|
|
50
53
|
response: details,
|
|
51
54
|
id: id,
|
|
52
55
|
renderers: renderers,
|
|
@@ -54,7 +57,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
54
57
|
status: status,
|
|
55
58
|
url: url
|
|
56
59
|
});
|
|
57
|
-
}, [details, id, renderers, actionOptions, status, url]);
|
|
60
|
+
}, [aiSummaryConfig, details, id, renderers, actionOptions, status, url]);
|
|
58
61
|
var retry = (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
|
|
59
62
|
var _ref2 = context || {},
|
|
60
63
|
title = _ref2.title;
|
|
@@ -30,6 +30,7 @@ var _click = require("../../../utils/analytics/click");
|
|
|
30
30
|
var _store = require("../../../state/store");
|
|
31
31
|
var _forbidden = _interopRequireDefault(require("./views/forbidden"));
|
|
32
32
|
var _ContentContainer = _interopRequireDefault(require("./ContentContainer"));
|
|
33
|
+
var _getIsAiSummaryEnabled = require("../../../utils/get-is-ai-summary-enabled");
|
|
33
34
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
35
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
36
|
/** @jsx jsx */
|
|
@@ -93,7 +94,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
93
94
|
var linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
|
|
94
95
|
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
95
96
|
isAdminHubAIEnabled = _useSmartLinkContext.isAdminHubAIEnabled;
|
|
96
|
-
var isAISummaryEnabled = (0,
|
|
97
|
+
var isAISummaryEnabled = (0, _getIsAiSummaryEnabled.getIsAISummaryEnabled)(isAdminHubAIEnabled, cardState.details);
|
|
97
98
|
var services = (0, _helpers.getServices)(linkState.details);
|
|
98
99
|
var statusRef = (0, _react2.useRef)(linkStatus);
|
|
99
100
|
var analyticsRef = (0, _react2.useRef)(analytics);
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getSimulatedMetadata = exports.getSimulatedBetterMetadata =
|
|
7
|
+
exports.getSimulatedMetadata = exports.getSimulatedBetterMetadata = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _constants = require("../../constants");
|
|
10
10
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
@@ -205,10 +205,4 @@ var getSimulatedBetterMetadata = exports.getSimulatedBetterMetadata = function g
|
|
|
205
205
|
default:
|
|
206
206
|
return defaultMetadata;
|
|
207
207
|
}
|
|
208
|
-
};
|
|
209
|
-
var getIsAISummaryEnabled = exports.getIsAISummaryEnabled = function getIsAISummaryEnabled() {
|
|
210
|
-
var _response$meta;
|
|
211
|
-
var isAdminHubAIEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
212
|
-
var response = arguments.length > 1 ? arguments[1] : undefined;
|
|
213
|
-
return Boolean((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 || (_response$meta = response.meta) === null || _response$meta === void 0 || (_response$meta = _response$meta.supportedFeature) === null || _response$meta === void 0 ? void 0 : _response$meta.includes('AISummary')));
|
|
214
208
|
};
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.
|
|
20
|
+
packageVersion: "26.57.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
package/dist/es2019/constants.js
CHANGED
|
@@ -155,7 +155,10 @@ export let ActionName = /*#__PURE__*/function (ActionName) {
|
|
|
155
155
|
ActionName["CustomAction"] = "CustomAction";
|
|
156
156
|
return ActionName;
|
|
157
157
|
}({});
|
|
158
|
-
|
|
158
|
+
export let InternalActionName = /*#__PURE__*/function (InternalActionName) {
|
|
159
|
+
InternalActionName["AISummaryAction"] = "AISummaryAction";
|
|
160
|
+
return InternalActionName;
|
|
161
|
+
}({});
|
|
159
162
|
/**
|
|
160
163
|
* Flexible UI icons - each mapped to AK icons.
|
|
161
164
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CardAction } from '../../../view/Card/types';
|
|
2
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
+
import { getIsAISummaryEnabled } from '../../../utils/get-is-ai-summary-enabled';
|
|
4
|
+
import { extractAri } from '@atlaskit/link-extractors';
|
|
5
|
+
export const extractAISummaryAction = (response, url, actionOptions, aiSummaryConfig) => {
|
|
6
|
+
if (!canShowAction(CardAction.AISummaryAction, actionOptions) || !getIsAISummaryEnabled(aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.isAdminHubAIEnabled, response) || !(aiSummaryConfig !== null && aiSummaryConfig !== void 0 && aiSummaryConfig.product) || !url) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
url,
|
|
11
|
+
ari: extractAri(response.data),
|
|
12
|
+
product: aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.product
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { ActionName } from '../../../constants';
|
|
1
|
+
import { ActionName, InternalActionName } from '../../../constants';
|
|
2
2
|
import { extractDownloadAction } from './extract-download-action';
|
|
3
3
|
import { extractPreviewAction } from './extract-preview-action';
|
|
4
|
+
import { extractAISummaryAction } from './extract-ai-summary-action';
|
|
4
5
|
import extractFollowAction from './extract-follow-action';
|
|
5
6
|
import { extractCopyLinkAction } from './extract-copy-link-action';
|
|
6
|
-
const extractActions = (response, actionOptions, id) => {
|
|
7
|
+
const extractActions = (response, url, actionOptions, id, aiSummaryConfig) => {
|
|
7
8
|
const data = response.data;
|
|
8
9
|
const action = {
|
|
9
10
|
[ActionName.CopyLinkAction]: extractCopyLinkAction(data, actionOptions),
|
|
10
11
|
[ActionName.DownloadAction]: extractDownloadAction(data, actionOptions),
|
|
11
12
|
[ActionName.FollowAction]: extractFollowAction(response, actionOptions, id),
|
|
12
|
-
[ActionName.PreviewAction]: extractPreviewAction(response, actionOptions)
|
|
13
|
+
[ActionName.PreviewAction]: extractPreviewAction(response, actionOptions),
|
|
14
|
+
[InternalActionName.AISummaryAction]: extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)
|
|
13
15
|
};
|
|
14
16
|
return Object.values(action).some(value => Boolean(value)) ? action : undefined;
|
|
15
17
|
};
|
|
@@ -14,7 +14,8 @@ const extractFlexibleUiContext = ({
|
|
|
14
14
|
id,
|
|
15
15
|
renderers,
|
|
16
16
|
actionOptions,
|
|
17
|
-
response
|
|
17
|
+
response,
|
|
18
|
+
aiSummaryConfig
|
|
18
19
|
} = {}) => {
|
|
19
20
|
if (!response) {
|
|
20
21
|
return undefined;
|
|
@@ -22,7 +23,7 @@ const extractFlexibleUiContext = ({
|
|
|
22
23
|
const data = response.data;
|
|
23
24
|
const url = extractLink(data);
|
|
24
25
|
return {
|
|
25
|
-
actions: extractActions(response, actionOptions, id),
|
|
26
|
+
actions: extractActions(response, url, actionOptions, id, aiSummaryConfig),
|
|
26
27
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
27
28
|
attachmentCount: extractAttachmentCount(data),
|
|
28
29
|
authorGroup: extractPersonCreatedBy(data),
|
package/dist/es2019/messages.js
CHANGED
|
@@ -195,6 +195,16 @@ export const messages = defineMessages({
|
|
|
195
195
|
defaultMessage: 'Download file',
|
|
196
196
|
description: 'Allow a user to download a file'
|
|
197
197
|
},
|
|
198
|
+
ai_summary_action: {
|
|
199
|
+
id: 'fabric.linking.ai_summary_action.nonfinal',
|
|
200
|
+
defaultMessage: 'Summarize with AI',
|
|
201
|
+
description: 'Allow a user to summarize a link'
|
|
202
|
+
},
|
|
203
|
+
ai_summary_action_description: {
|
|
204
|
+
id: 'fabric.linking.ai_summary_action_description.nonfinal',
|
|
205
|
+
defaultMessage: 'Summarize the content of this link using Atlassian Intelligence.',
|
|
206
|
+
description: 'Description of what the summarize link with AI action does'
|
|
207
|
+
},
|
|
198
208
|
edit: {
|
|
199
209
|
id: 'fabric.linking.edit',
|
|
200
210
|
defaultMessage: 'Edit',
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
export const useAISummaryConfig = () => {
|
|
4
|
+
const {
|
|
5
|
+
product,
|
|
6
|
+
isAdminHubAIEnabled
|
|
7
|
+
} = useSmartLinkContext();
|
|
8
|
+
return useMemo(() => ({
|
|
9
|
+
product,
|
|
10
|
+
isAdminHubAIEnabled
|
|
11
|
+
}), [product, isAdminHubAIEnabled]);
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.57.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
export const getIsAISummaryEnabled = (isAdminHubAIEnabled = false, response) => {
|
|
3
|
+
var _response$meta, _response$meta$suppor;
|
|
4
|
+
return Boolean(getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 ? void 0 : (_response$meta = response.meta) === null || _response$meta === void 0 ? void 0 : (_response$meta$suppor = _response$meta.supportedFeature) === null || _response$meta$suppor === void 0 ? void 0 : _response$meta$suppor.includes('AISummary')));
|
|
5
|
+
};
|
|
@@ -5,5 +5,6 @@ export let CardAction = /*#__PURE__*/function (CardAction) {
|
|
|
5
5
|
CardAction["ChangeStatusAction"] = "ChangeStatusAction";
|
|
6
6
|
CardAction["FollowAction"] = "FollowAction";
|
|
7
7
|
CardAction["CopyLinkAction"] = "CopyLinkAction";
|
|
8
|
+
CardAction["AISummaryAction"] = "AISummaryAction";
|
|
8
9
|
return CardAction;
|
|
9
10
|
}({});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import { messages } from '../../../../../messages';
|
|
5
|
+
import Action from '../action';
|
|
6
|
+
import AiIcon from '../../../../common/ai-icon';
|
|
7
|
+
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
8
|
+
import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
|
|
9
|
+
export const AISummaryActionComponent = ({
|
|
10
|
+
onClick: onClickCallback,
|
|
11
|
+
url = '',
|
|
12
|
+
ari = '',
|
|
13
|
+
product,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
fireEvent
|
|
18
|
+
} = useAnalyticsEvents();
|
|
19
|
+
const {
|
|
20
|
+
state: {
|
|
21
|
+
status
|
|
22
|
+
},
|
|
23
|
+
summariseUrl
|
|
24
|
+
} = useAISummary({
|
|
25
|
+
url,
|
|
26
|
+
ari,
|
|
27
|
+
product
|
|
28
|
+
});
|
|
29
|
+
const handleActionClick = useCallback(() => {
|
|
30
|
+
fireEvent('ui.button.clicked.aiSummary', {});
|
|
31
|
+
fireEvent('track.aiInteraction.initiated', {
|
|
32
|
+
aiFeatureName: 'Smart Links Summary',
|
|
33
|
+
proactiveAIGenerated: 0,
|
|
34
|
+
userGeneratedAI: 1
|
|
35
|
+
});
|
|
36
|
+
summariseUrl();
|
|
37
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
38
|
+
}, [fireEvent, onClickCallback, summariseUrl]);
|
|
39
|
+
if (status === 'ready' || status === 'error') {
|
|
40
|
+
return /*#__PURE__*/React.createElement(Action, _extends({
|
|
41
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
|
|
42
|
+
icon: /*#__PURE__*/React.createElement(AiIcon, {
|
|
43
|
+
label: "Summarise with AI"
|
|
44
|
+
}),
|
|
45
|
+
onClick: handleActionClick,
|
|
46
|
+
testId: "smart-action-ai-summary-action",
|
|
47
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action_description)
|
|
48
|
+
}, props));
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
4
|
+
import { InternalActionName } from '../../../../../constants';
|
|
5
|
+
import { AISummaryActionComponent } from './ai-summary-action-component';
|
|
6
|
+
const AISummaryAction = props => {
|
|
7
|
+
var _context$actions;
|
|
8
|
+
const context = useFlexibleUiContext();
|
|
9
|
+
const actionData = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.AISummaryAction];
|
|
10
|
+
return actionData ? /*#__PURE__*/React.createElement(AISummaryActionComponent, _extends({}, actionData, props)) : null;
|
|
11
|
+
};
|
|
12
|
+
export default AISummaryAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,4 +4,5 @@ export { default as EditAction } from './edit-action';
|
|
|
4
4
|
export { default as DownloadAction } from './download-action';
|
|
5
5
|
export { default as FollowAction } from './follow-action';
|
|
6
6
|
export { default as PreviewAction } from './preview-action';
|
|
7
|
-
export { default as CopyLinkAction } from './copy-link-action';
|
|
7
|
+
export { default as CopyLinkAction } from './copy-link-action';
|
|
8
|
+
export { default as AISummaryAction } from './ai-summary-action';
|