@atlaskit/smart-card 32.7.5 → 32.7.6
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/state/hooks/use-ai-summary/ai-summary-service/index.js +8 -4
- package/dist/cjs/state/hooks/use-ai-summary/index.js +18 -4
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +6 -1
- package/dist/es2019/state/hooks/use-ai-summary/index.js +13 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +8 -4
- package/dist/esm/state/hooks/use-ai-summary/index.js +18 -4
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +1 -0
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +2 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +1 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +2 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 32.7.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#177262](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177262)
|
|
8
|
+
[`a37a3cccb88c6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a37a3cccb88c6) -
|
|
9
|
+
Update summarize feature to receive output on user's preferred language
|
|
10
|
+
|
|
3
11
|
## 32.7.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -12,14 +12,15 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
14
14
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _readStream = require("./readStream");
|
|
16
17
|
var _types = require("./types");
|
|
17
18
|
var _utils = require("./utils");
|
|
18
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
19
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
21
20
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
21
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
23
24
|
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
24
25
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
25
26
|
var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
@@ -47,12 +48,14 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
47
48
|
case 0:
|
|
48
49
|
payload = {
|
|
49
50
|
recipient_agent_named_id: 'smartlink_summary_agent',
|
|
50
|
-
agent_input_context: {
|
|
51
|
+
agent_input_context: _objectSpread({
|
|
51
52
|
content_url: _this.url,
|
|
52
53
|
content_ari: _this.ari,
|
|
53
54
|
prompt_id: 'smart_links',
|
|
54
55
|
summary_output_mimetype: 'text/markdown'
|
|
55
|
-
}
|
|
56
|
+
}, (0, _platformFeatureFlags.fg)('send_locale_to_summarize_in_assistance-service') && {
|
|
57
|
+
locale: _this.locale
|
|
58
|
+
})
|
|
56
59
|
};
|
|
57
60
|
options = {
|
|
58
61
|
method: 'POST',
|
|
@@ -87,6 +90,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
87
90
|
};
|
|
88
91
|
this.url = props.url;
|
|
89
92
|
this.ari = props.ari;
|
|
93
|
+
this.locale = props.locale;
|
|
90
94
|
this.onStart = props.onStart;
|
|
91
95
|
this.onSuccess = props.onSuccess;
|
|
92
96
|
this.onError = props.onError;
|
|
@@ -5,10 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useAISummary = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _react = require("react");
|
|
11
|
+
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
13
|
var _aiSummaryService = require("./ai-summary-service");
|
|
11
14
|
var _store = require("./ai-summary-service/store");
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
12
17
|
/**
|
|
13
18
|
* Stream AI summary for an url.
|
|
14
19
|
* For hook specific to AI summary on as a smart link, please see useAISummaryAction.
|
|
@@ -30,26 +35,35 @@ var useAISummary = exports.useAISummary = function useAISummary(props) {
|
|
|
30
35
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
31
36
|
state = _useState2[0],
|
|
32
37
|
setState = _useState2[1];
|
|
38
|
+
var _ref = (0, _platformFeatureFlags.fg)('send_locale_to_summarize_in_assistance-service') ?
|
|
39
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
40
|
+
(0, _reactIntlNext.useIntl)() : {
|
|
41
|
+
locale: undefined
|
|
42
|
+
},
|
|
43
|
+
locale = _ref.locale;
|
|
33
44
|
(0, _react.useEffect)(function () {
|
|
34
45
|
var _AISummariesStore$get2;
|
|
35
46
|
//do not create a service for the empty URL string when the link data is not yet available,
|
|
36
47
|
//or the service has already been created and cached.
|
|
37
48
|
if (url && !_store.AISummariesStore.get(url)) {
|
|
38
|
-
_store.AISummariesStore.set(url, new _aiSummaryService.AISummaryService({
|
|
49
|
+
_store.AISummariesStore.set(url, new _aiSummaryService.AISummaryService(_objectSpread(_objectSpread({
|
|
39
50
|
url: url,
|
|
40
51
|
ari: ari,
|
|
41
52
|
baseUrl: baseUrl,
|
|
42
53
|
product: product,
|
|
43
|
-
envKey: envKey
|
|
54
|
+
envKey: envKey
|
|
55
|
+
}, (0, _platformFeatureFlags.fg)('send_locale_to_summarize_in_assistance-service') && {
|
|
56
|
+
locale: locale
|
|
57
|
+
}), {}, {
|
|
44
58
|
onError: onError,
|
|
45
59
|
onStart: onStart,
|
|
46
60
|
onSuccess: onSuccess
|
|
47
|
-
}));
|
|
61
|
+
})));
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
//returns function that calls unsubscribe method
|
|
51
65
|
return (_AISummariesStore$get2 = _store.AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
52
|
-
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey]);
|
|
66
|
+
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey, locale]);
|
|
53
67
|
var summariseUrl = function summariseUrl() {
|
|
54
68
|
var _AISummariesStore$get3;
|
|
55
69
|
return (_AISummariesStore$get3 = _store.AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
@@ -17,7 +17,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
17
17
|
var context = exports.context = {
|
|
18
18
|
componentName: 'smart-cards',
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "32.7.
|
|
20
|
+
packageVersion: "32.7.6"
|
|
21
21
|
};
|
|
22
22
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
23
23
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
20
20
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
21
21
|
var PACKAGE_DATA = {
|
|
22
22
|
packageName: "@atlaskit/smart-card",
|
|
23
|
-
packageVersion: "32.7.
|
|
23
|
+
packageVersion: "32.7.6",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { getBaseUrl } from '@atlaskit/linking-common';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { readStream } from './readStream';
|
|
5
6
|
import { ChunkProcessingError } from './types';
|
|
6
7
|
import { addPath, getXProductHeaderValue } from './utils';
|
|
@@ -27,7 +28,10 @@ export class AISummaryService {
|
|
|
27
28
|
content_url: this.url,
|
|
28
29
|
content_ari: this.ari,
|
|
29
30
|
prompt_id: 'smart_links',
|
|
30
|
-
summary_output_mimetype: 'text/markdown'
|
|
31
|
+
summary_output_mimetype: 'text/markdown',
|
|
32
|
+
...(fg('send_locale_to_summarize_in_assistance-service') && {
|
|
33
|
+
locale: this.locale
|
|
34
|
+
})
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
37
|
const options = {
|
|
@@ -53,6 +57,7 @@ export class AISummaryService {
|
|
|
53
57
|
};
|
|
54
58
|
this.url = props.url;
|
|
55
59
|
this.ari = props.ari;
|
|
60
|
+
this.locale = props.locale;
|
|
56
61
|
this.onStart = props.onStart;
|
|
57
62
|
this.onSuccess = props.onSuccess;
|
|
58
63
|
this.onError = props.onError;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
import { AISummaryService } from './ai-summary-service';
|
|
3
5
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
4
6
|
/**
|
|
@@ -21,6 +23,13 @@ export const useAISummary = props => {
|
|
|
21
23
|
status: 'ready',
|
|
22
24
|
content: ''
|
|
23
25
|
});
|
|
26
|
+
const {
|
|
27
|
+
locale
|
|
28
|
+
} = fg('send_locale_to_summarize_in_assistance-service') ?
|
|
29
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
30
|
+
useIntl() : {
|
|
31
|
+
locale: undefined
|
|
32
|
+
};
|
|
24
33
|
useEffect(() => {
|
|
25
34
|
var _AISummariesStore$get2;
|
|
26
35
|
//do not create a service for the empty URL string when the link data is not yet available,
|
|
@@ -32,6 +41,9 @@ export const useAISummary = props => {
|
|
|
32
41
|
baseUrl,
|
|
33
42
|
product,
|
|
34
43
|
envKey,
|
|
44
|
+
...(fg('send_locale_to_summarize_in_assistance-service') && {
|
|
45
|
+
locale
|
|
46
|
+
}),
|
|
35
47
|
onError,
|
|
36
48
|
onStart,
|
|
37
49
|
onSuccess
|
|
@@ -40,7 +52,7 @@ export const useAISummary = props => {
|
|
|
40
52
|
|
|
41
53
|
//returns function that calls unsubscribe method
|
|
42
54
|
return (_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
43
|
-
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey]);
|
|
55
|
+
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey, locale]);
|
|
44
56
|
const summariseUrl = () => {
|
|
45
57
|
var _AISummariesStore$get3;
|
|
46
58
|
return (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
@@ -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: "32.7.
|
|
7
|
+
packageVersion: "32.7.6"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.6",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -2,16 +2,17 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
5
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
6
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
11
|
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
12
12
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
13
13
|
import uuid from 'uuid';
|
|
14
14
|
import { getBaseUrl } from '@atlaskit/linking-common';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { readStream } from './readStream';
|
|
16
17
|
import { ChunkProcessingError } from './types';
|
|
17
18
|
import { addPath, getXProductHeaderValue } from './utils';
|
|
@@ -40,12 +41,14 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
40
41
|
case 0:
|
|
41
42
|
payload = {
|
|
42
43
|
recipient_agent_named_id: 'smartlink_summary_agent',
|
|
43
|
-
agent_input_context: {
|
|
44
|
+
agent_input_context: _objectSpread({
|
|
44
45
|
content_url: _this.url,
|
|
45
46
|
content_ari: _this.ari,
|
|
46
47
|
prompt_id: 'smart_links',
|
|
47
48
|
summary_output_mimetype: 'text/markdown'
|
|
48
|
-
}
|
|
49
|
+
}, fg('send_locale_to_summarize_in_assistance-service') && {
|
|
50
|
+
locale: _this.locale
|
|
51
|
+
})
|
|
49
52
|
};
|
|
50
53
|
options = {
|
|
51
54
|
method: 'POST',
|
|
@@ -80,6 +83,7 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
80
83
|
};
|
|
81
84
|
this.url = props.url;
|
|
82
85
|
this.ari = props.ari;
|
|
86
|
+
this.locale = props.locale;
|
|
83
87
|
this.onStart = props.onStart;
|
|
84
88
|
this.onSuccess = props.onSuccess;
|
|
85
89
|
this.onError = props.onError;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
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; }
|
|
2
5
|
import { useEffect, useState } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl-next';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
8
|
import { AISummaryService } from './ai-summary-service';
|
|
4
9
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
5
10
|
/**
|
|
@@ -23,26 +28,35 @@ export var useAISummary = function useAISummary(props) {
|
|
|
23
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
29
|
state = _useState2[0],
|
|
25
30
|
setState = _useState2[1];
|
|
31
|
+
var _ref = fg('send_locale_to_summarize_in_assistance-service') ?
|
|
32
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
33
|
+
useIntl() : {
|
|
34
|
+
locale: undefined
|
|
35
|
+
},
|
|
36
|
+
locale = _ref.locale;
|
|
26
37
|
useEffect(function () {
|
|
27
38
|
var _AISummariesStore$get2;
|
|
28
39
|
//do not create a service for the empty URL string when the link data is not yet available,
|
|
29
40
|
//or the service has already been created and cached.
|
|
30
41
|
if (url && !AISummariesStore.get(url)) {
|
|
31
|
-
AISummariesStore.set(url, new AISummaryService({
|
|
42
|
+
AISummariesStore.set(url, new AISummaryService(_objectSpread(_objectSpread({
|
|
32
43
|
url: url,
|
|
33
44
|
ari: ari,
|
|
34
45
|
baseUrl: baseUrl,
|
|
35
46
|
product: product,
|
|
36
|
-
envKey: envKey
|
|
47
|
+
envKey: envKey
|
|
48
|
+
}, fg('send_locale_to_summarize_in_assistance-service') && {
|
|
49
|
+
locale: locale
|
|
50
|
+
}), {}, {
|
|
37
51
|
onError: onError,
|
|
38
52
|
onStart: onStart,
|
|
39
53
|
onSuccess: onSuccess
|
|
40
|
-
}));
|
|
54
|
+
})));
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
//returns function that calls unsubscribe method
|
|
44
58
|
return (_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
45
|
-
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey]);
|
|
59
|
+
}, [url, baseUrl, onError, onStart, onSuccess, product, ari, envKey, locale]);
|
|
46
60
|
var summariseUrl = function summariseUrl() {
|
|
47
61
|
var _AISummariesStore$get3;
|
|
48
62
|
return (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
@@ -10,7 +10,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
10
10
|
export var context = {
|
|
11
11
|
componentName: 'smart-cards',
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.6"
|
|
14
14
|
};
|
|
15
15
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
16
16
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
13
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
14
14
|
var PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "32.7.
|
|
16
|
+
packageVersion: "32.7.6",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -18,6 +18,7 @@ export type AISummaryServiceProps = {
|
|
|
18
18
|
*/
|
|
19
19
|
ari?: string;
|
|
20
20
|
envKey?: EnvironmentsKeys;
|
|
21
|
+
locale?: string;
|
|
21
22
|
url: string;
|
|
22
23
|
};
|
|
23
24
|
export type AISummaryServiceConfig = {
|
|
@@ -38,6 +39,7 @@ export type AgentInputContext = {
|
|
|
38
39
|
content_ari?: string;
|
|
39
40
|
prompt_id: PromptId;
|
|
40
41
|
summary_output_mimetype?: SummaryOutputMimeType;
|
|
42
|
+
locale?: string;
|
|
41
43
|
};
|
|
42
44
|
export type PromptId = 'smart_links';
|
|
43
45
|
export type SummaryOutputMimeType = 'text/adf' | 'text/markdown' | 'text/json';
|
|
@@ -18,6 +18,7 @@ export type AISummaryServiceProps = {
|
|
|
18
18
|
*/
|
|
19
19
|
ari?: string;
|
|
20
20
|
envKey?: EnvironmentsKeys;
|
|
21
|
+
locale?: string;
|
|
21
22
|
url: string;
|
|
22
23
|
};
|
|
23
24
|
export type AISummaryServiceConfig = {
|
|
@@ -38,6 +39,7 @@ export type AgentInputContext = {
|
|
|
38
39
|
content_ari?: string;
|
|
39
40
|
prompt_id: PromptId;
|
|
40
41
|
summary_output_mimetype?: SummaryOutputMimeType;
|
|
42
|
+
locale?: string;
|
|
41
43
|
};
|
|
42
44
|
export type PromptId = 'smart_links';
|
|
43
45
|
export type SummaryOutputMimeType = 'text/adf' | 'text/markdown' | 'text/json';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "32.7.
|
|
3
|
+
"version": "32.7.6",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -182,6 +182,9 @@
|
|
|
182
182
|
},
|
|
183
183
|
"platform_editor_hyperlink_underline": {
|
|
184
184
|
"type": "boolean"
|
|
185
|
+
},
|
|
186
|
+
"send_locale_to_summarize_in_assistance-service": {
|
|
187
|
+
"type": "boolean"
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
}
|