@atlaskit/smart-card 26.52.3 → 26.52.5
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 +13 -0
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/messages.js +2 -2
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +6 -10
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/readStream.js +125 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/utils.js +0 -119
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/delete-action/index.js +24 -0
- package/dist/cjs/view/FlexibleCard/components/actions/delete-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/edit-action/index.js +24 -0
- package/dist/cjs/view/FlexibleCard/components/actions/edit-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +15 -15
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +0 -22
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/constants.js +1 -1
- package/dist/es2019/messages.js +2 -2
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +6 -11
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/readStream.js +48 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/utils.js +0 -47
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/delete-action/index.js +15 -0
- package/dist/es2019/view/FlexibleCard/components/actions/delete-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/edit-action/index.js +15 -0
- package/dist/es2019/view/FlexibleCard/components/actions/edit-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +2 -13
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +0 -24
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/messages.js +2 -2
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +6 -10
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/readStream.js +118 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/utils.js +0 -117
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/delete-action/index.js +17 -0
- package/dist/esm/view/FlexibleCard/components/actions/delete-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/edit-action/index.js +17 -0
- package/dist/esm/view/FlexibleCard/components/actions/edit-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +2 -13
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +0 -22
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/readStream.d.ts +1 -0
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +6 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +0 -1
- package/dist/types/view/FlexibleCard/components/actions/delete-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/delete-action/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/edit-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/edit-action/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +2 -12
- package/dist/types-ts4.5/constants.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/readStream.d.ts +1 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +6 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +0 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/delete-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/delete-action/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/edit-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/edit-action/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +2 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.52.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#89065](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89065) [`9276d00960ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9276d00960ff) - [ux] AI Link Summary Generic Error text has been updated.
|
|
8
|
+
- [#87848](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87848) [`b7121232bf12`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b7121232bf12) - Tests for link AI Summary Service added.
|
|
9
|
+
|
|
10
|
+
## 26.52.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#88718](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88718) [`c0c472e0dc0b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c0c472e0dc0b) - Refactoring FlexibleCard's EditAction and DeleteAction creation
|
|
15
|
+
|
|
3
16
|
## 26.52.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/constants.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = expo
|
|
|
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';
|
|
10
|
-
var CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI_TROUBLESHOOTING = 'https://
|
|
10
|
+
var CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI_TROUBLESHOOTING = 'https://status.atlassian.com/';
|
|
11
11
|
var CONTENT_URL_ACCEPTABLE_USE_POLICY = exports.CONTENT_URL_ACCEPTABLE_USE_POLICY = 'https://www.atlassian.com/legal/acceptable-use-policy';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/cjs/messages.js
CHANGED
|
@@ -43,8 +43,8 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
43
43
|
},
|
|
44
44
|
ai_summary_error_generic: {
|
|
45
45
|
id: 'fabric.linking.ai_summary_error_generic',
|
|
46
|
-
defaultMessage:
|
|
47
|
-
description: 'Shown when AI
|
|
46
|
+
defaultMessage: 'Atlassian Intelligence (AI) isn’t responding. Try again later or <a>check the status of AI</a>.',
|
|
47
|
+
description: 'Shown when AI Summary encountered an unexpected error while summarizing the linked resource content.'
|
|
48
48
|
},
|
|
49
49
|
ai_summary_error_acceptable_use_violation: {
|
|
50
50
|
id: 'fabric.linking.ai_summary_error_acceptable_use_violation',
|
|
@@ -13,6 +13,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
14
14
|
var _types = require("./types");
|
|
15
15
|
var _utils = require("./utils");
|
|
16
|
+
var _readStream = require("./readStream");
|
|
16
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -60,25 +61,20 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
60
61
|
}
|
|
61
62
|
throw new Error("Status: ".concat(response.status, "\n URL: ").concat(_this.url, "\n StatusText ").concat(response.statusText));
|
|
62
63
|
case 11:
|
|
63
|
-
return _context.abrupt("return", (0,
|
|
64
|
+
return _context.abrupt("return", (0, _readStream.readStream)(response));
|
|
64
65
|
case 12:
|
|
65
66
|
case "end":
|
|
66
67
|
return _context.stop();
|
|
67
68
|
}
|
|
68
69
|
}, _callee);
|
|
69
70
|
})));
|
|
70
|
-
|
|
71
|
-
baseUrl: '/gateway/api/assist',
|
|
72
|
-
headers: {
|
|
71
|
+
this.config = {
|
|
72
|
+
baseUrl: props.baseUrl || '/gateway/api/assist',
|
|
73
|
+
headers: _objectSpread({
|
|
73
74
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
74
75
|
'x-experience-id': 'smart-link',
|
|
75
|
-
//TODO: EDM-9337 - Remove the hardcoded Confluence product name and find a way to populate the product name here
|
|
76
76
|
'x-product': props.product || 'confluence'
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
this.config = {
|
|
80
|
-
baseUrl: props.baseUrl || defaultConfig.baseUrl,
|
|
81
|
-
headers: _objectSpread({}, props.headers || defaultConfig.headers)
|
|
77
|
+
}, props.headers)
|
|
82
78
|
};
|
|
83
79
|
this.url = props.url;
|
|
84
80
|
this.ari = props.ari;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.readStream = readStream;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
10
|
+
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function readStream(_x) {
|
|
16
|
+
return _readStream.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
function _readStream() {
|
|
19
|
+
_readStream = (0, _wrapAsyncGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
|
|
20
|
+
var reader, doneStreaming, chunkBuffer, chunkTypeErrorMessage, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
|
|
21
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
reader = (0, _utils.getBufferReader)(response);
|
|
25
|
+
doneStreaming = false;
|
|
26
|
+
chunkBuffer = '';
|
|
27
|
+
chunkTypeErrorMessage = 'jsonChunkType error';
|
|
28
|
+
case 4:
|
|
29
|
+
_context.prev = 4;
|
|
30
|
+
_context.next = 7;
|
|
31
|
+
return (0, _awaitAsyncGenerator2.default)(reader.read());
|
|
32
|
+
case 7:
|
|
33
|
+
_yield$_awaitAsyncGen = _context.sent;
|
|
34
|
+
value = _yield$_awaitAsyncGen.value;
|
|
35
|
+
done = _yield$_awaitAsyncGen.done;
|
|
36
|
+
doneStreaming = done;
|
|
37
|
+
if (!value) {
|
|
38
|
+
_context.next = 42;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
|
|
42
|
+
chunkBuffer = '';
|
|
43
|
+
_iterator = _createForOfIteratorHelper(processedChunks);
|
|
44
|
+
_context.prev = 15;
|
|
45
|
+
_iterator.s();
|
|
46
|
+
case 17:
|
|
47
|
+
if ((_step = _iterator.n()).done) {
|
|
48
|
+
_context.next = 34;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
chunk = _step.value;
|
|
52
|
+
_context.prev = 19;
|
|
53
|
+
jsonChunk = JSON.parse(chunk);
|
|
54
|
+
if (!(jsonChunk.type === 'ERROR')) {
|
|
55
|
+
_context.next = 23;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
throw new Error(chunkTypeErrorMessage);
|
|
59
|
+
case 23:
|
|
60
|
+
_context.next = 25;
|
|
61
|
+
return jsonChunk;
|
|
62
|
+
case 25:
|
|
63
|
+
_context.next = 32;
|
|
64
|
+
break;
|
|
65
|
+
case 27:
|
|
66
|
+
_context.prev = 27;
|
|
67
|
+
_context.t0 = _context["catch"](19);
|
|
68
|
+
if (!(_context.t0 instanceof Error && _context.t0.message === chunkTypeErrorMessage)) {
|
|
69
|
+
_context.next = 31;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
throw _context.t0;
|
|
73
|
+
case 31:
|
|
74
|
+
// the chunk may be incomplete, so we'll save it for the next iteration.
|
|
75
|
+
chunkBuffer = chunk;
|
|
76
|
+
case 32:
|
|
77
|
+
_context.next = 17;
|
|
78
|
+
break;
|
|
79
|
+
case 34:
|
|
80
|
+
_context.next = 39;
|
|
81
|
+
break;
|
|
82
|
+
case 36:
|
|
83
|
+
_context.prev = 36;
|
|
84
|
+
_context.t1 = _context["catch"](15);
|
|
85
|
+
_iterator.e(_context.t1);
|
|
86
|
+
case 39:
|
|
87
|
+
_context.prev = 39;
|
|
88
|
+
_iterator.f();
|
|
89
|
+
return _context.finish(39);
|
|
90
|
+
case 42:
|
|
91
|
+
_context.next = 52;
|
|
92
|
+
break;
|
|
93
|
+
case 44:
|
|
94
|
+
_context.prev = 44;
|
|
95
|
+
_context.t2 = _context["catch"](4);
|
|
96
|
+
if (!(_context.t2 instanceof DOMException && _context.t2.name === 'AbortError')) {
|
|
97
|
+
_context.next = 50;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
doneStreaming = true;
|
|
101
|
+
_context.next = 52;
|
|
102
|
+
break;
|
|
103
|
+
case 50:
|
|
104
|
+
reader.cancel();
|
|
105
|
+
throw _context.t2;
|
|
106
|
+
case 52:
|
|
107
|
+
if (!doneStreaming) {
|
|
108
|
+
_context.next = 4;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case 53:
|
|
112
|
+
if (!chunkBuffer) {
|
|
113
|
+
_context.next = 56;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
error = new Error("Not all the data was processed: ".concat(chunkBuffer));
|
|
117
|
+
throw error;
|
|
118
|
+
case 56:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee, null, [[4, 44], [15, 36, 39, 42], [19, 27]]);
|
|
123
|
+
}));
|
|
124
|
+
return _readStream.apply(this, arguments);
|
|
125
|
+
}
|
|
@@ -1,128 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.getBufferReader = exports.addPath = void 0;
|
|
8
|
-
exports.readStream = readStream;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
11
|
-
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
12
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
-
function readStream(_x) {
|
|
16
|
-
return _readStream.apply(this, arguments);
|
|
17
|
-
}
|
|
18
|
-
function _readStream() {
|
|
19
|
-
_readStream = (0, _wrapAsyncGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
|
|
20
|
-
var reader, doneStreaming, chunkBuffer, chunkTypeErrorMessage, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
|
|
21
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
22
|
-
while (1) switch (_context.prev = _context.next) {
|
|
23
|
-
case 0:
|
|
24
|
-
reader = getBufferReader(response);
|
|
25
|
-
doneStreaming = false;
|
|
26
|
-
chunkBuffer = '';
|
|
27
|
-
chunkTypeErrorMessage = 'jsonChunkType error';
|
|
28
|
-
case 4:
|
|
29
|
-
_context.prev = 4;
|
|
30
|
-
_context.next = 7;
|
|
31
|
-
return (0, _awaitAsyncGenerator2.default)(reader.read());
|
|
32
|
-
case 7:
|
|
33
|
-
_yield$_awaitAsyncGen = _context.sent;
|
|
34
|
-
value = _yield$_awaitAsyncGen.value;
|
|
35
|
-
done = _yield$_awaitAsyncGen.done;
|
|
36
|
-
doneStreaming = done;
|
|
37
|
-
if (!value) {
|
|
38
|
-
_context.next = 42;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
|
|
42
|
-
chunkBuffer = '';
|
|
43
|
-
_iterator = _createForOfIteratorHelper(processedChunks);
|
|
44
|
-
_context.prev = 15;
|
|
45
|
-
_iterator.s();
|
|
46
|
-
case 17:
|
|
47
|
-
if ((_step = _iterator.n()).done) {
|
|
48
|
-
_context.next = 34;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
chunk = _step.value;
|
|
52
|
-
_context.prev = 19;
|
|
53
|
-
jsonChunk = JSON.parse(chunk);
|
|
54
|
-
if (!(jsonChunk.type === 'ERROR')) {
|
|
55
|
-
_context.next = 23;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
throw new Error(chunkTypeErrorMessage);
|
|
59
|
-
case 23:
|
|
60
|
-
_context.next = 25;
|
|
61
|
-
return jsonChunk;
|
|
62
|
-
case 25:
|
|
63
|
-
_context.next = 32;
|
|
64
|
-
break;
|
|
65
|
-
case 27:
|
|
66
|
-
_context.prev = 27;
|
|
67
|
-
_context.t0 = _context["catch"](19);
|
|
68
|
-
if (!(_context.t0 instanceof Error && _context.t0.message === chunkTypeErrorMessage)) {
|
|
69
|
-
_context.next = 31;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
throw _context.t0;
|
|
73
|
-
case 31:
|
|
74
|
-
// the chunk may be incomplete, so we'll save it for the next iteration.
|
|
75
|
-
chunkBuffer = chunk;
|
|
76
|
-
case 32:
|
|
77
|
-
_context.next = 17;
|
|
78
|
-
break;
|
|
79
|
-
case 34:
|
|
80
|
-
_context.next = 39;
|
|
81
|
-
break;
|
|
82
|
-
case 36:
|
|
83
|
-
_context.prev = 36;
|
|
84
|
-
_context.t1 = _context["catch"](15);
|
|
85
|
-
_iterator.e(_context.t1);
|
|
86
|
-
case 39:
|
|
87
|
-
_context.prev = 39;
|
|
88
|
-
_iterator.f();
|
|
89
|
-
return _context.finish(39);
|
|
90
|
-
case 42:
|
|
91
|
-
_context.next = 52;
|
|
92
|
-
break;
|
|
93
|
-
case 44:
|
|
94
|
-
_context.prev = 44;
|
|
95
|
-
_context.t2 = _context["catch"](4);
|
|
96
|
-
if (!(_context.t2 instanceof DOMException && _context.t2.name === 'AbortError')) {
|
|
97
|
-
_context.next = 50;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
doneStreaming = true;
|
|
101
|
-
_context.next = 52;
|
|
102
|
-
break;
|
|
103
|
-
case 50:
|
|
104
|
-
reader.cancel();
|
|
105
|
-
throw _context.t2;
|
|
106
|
-
case 52:
|
|
107
|
-
if (!doneStreaming) {
|
|
108
|
-
_context.next = 4;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
case 53:
|
|
112
|
-
if (!chunkBuffer) {
|
|
113
|
-
_context.next = 56;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
error = new Error("Not all the data was processed: ".concat(chunkBuffer));
|
|
117
|
-
throw error;
|
|
118
|
-
case 56:
|
|
119
|
-
case "end":
|
|
120
|
-
return _context.stop();
|
|
121
|
-
}
|
|
122
|
-
}, _callee, null, [[4, 44], [15, 36, 39, 42], [19, 27]]);
|
|
123
|
-
}));
|
|
124
|
-
return _readStream.apply(this, arguments);
|
|
125
|
-
}
|
|
126
7
|
var getBufferReader = exports.getBufferReader = function getBufferReader(response) {
|
|
127
8
|
if (!response.body) {
|
|
128
9
|
throw new Error('Response body is empty');
|
|
@@ -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.52.
|
|
25
|
+
packageVersion: "26.52.5"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1,24 @@
|
|
|
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 _action = _interopRequireDefault(require("../action"));
|
|
11
|
+
var _messages = require("../../../../../messages");
|
|
12
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
|
|
14
|
+
var DeleteAction = function DeleteAction(props) {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
|
|
16
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete),
|
|
17
|
+
icon: /*#__PURE__*/_react.default.createElement(_cross.default, {
|
|
18
|
+
label: "Delete"
|
|
19
|
+
}),
|
|
20
|
+
testId: "smart-action-delete-action",
|
|
21
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete)
|
|
22
|
+
}, props));
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = DeleteAction;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 _action = _interopRequireDefault(require("../action"));
|
|
11
|
+
var _messages = require("../../../../../messages");
|
|
12
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
|
|
14
|
+
var EditAction = function EditAction(props) {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
|
|
16
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit),
|
|
17
|
+
icon: /*#__PURE__*/_react.default.createElement(_edit.default, {
|
|
18
|
+
label: "Edit"
|
|
19
|
+
}),
|
|
20
|
+
testId: "smart-action-edit-action",
|
|
21
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit)
|
|
22
|
+
}, props));
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = EditAction;
|
|
@@ -4,14 +4,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.CustomAction = void 0;
|
|
8
|
+
Object.defineProperty(exports, "DeleteAction", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _deleteAction.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
Object.defineProperty(exports, "DownloadAction", {
|
|
9
15
|
enumerable: true,
|
|
10
16
|
get: function get() {
|
|
11
17
|
return _downloadAction.default;
|
|
12
18
|
}
|
|
13
19
|
});
|
|
14
|
-
exports
|
|
20
|
+
Object.defineProperty(exports, "EditAction", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _editAction.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
15
26
|
Object.defineProperty(exports, "FollowAction", {
|
|
16
27
|
enumerable: true,
|
|
17
28
|
get: function get() {
|
|
@@ -30,19 +41,8 @@ var _utils = require("./utils");
|
|
|
30
41
|
var _followAction = _interopRequireDefault(require("./follow-action"));
|
|
31
42
|
var _previewAction = _interopRequireDefault(require("./preview-action"));
|
|
32
43
|
var _downloadAction = _interopRequireDefault(require("./download-action"));
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* the icon to a cross icon.
|
|
36
|
-
* @see Action
|
|
37
|
-
*/
|
|
38
|
-
var DeleteAction = exports.DeleteAction = (0, _utils.createUIAction)(_constants.ActionName.DeleteAction);
|
|
39
|
-
/**
|
|
40
|
-
* Creates a EditAction component. Accepts default ActionProps, but defaults
|
|
41
|
-
* the icon to an edit (pencil) icon.
|
|
42
|
-
* @see Action
|
|
43
|
-
*/
|
|
44
|
-
var EditAction = exports.EditAction = (0, _utils.createUIAction)(_constants.ActionName.EditAction);
|
|
45
|
-
|
|
44
|
+
var _editAction = _interopRequireDefault(require("./edit-action"));
|
|
45
|
+
var _deleteAction = _interopRequireDefault(require("./delete-action"));
|
|
46
46
|
/**
|
|
47
47
|
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
48
48
|
* to the text 'View' inside the button.
|
|
@@ -15,8 +15,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _action = _interopRequireDefault(require("./action"));
|
|
16
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
17
|
var _messages = require("../../../../messages");
|
|
18
|
-
var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
|
|
19
|
-
var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
|
|
20
18
|
var _viewAction = _interopRequireDefault(require("./action/view-action"));
|
|
21
19
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
22
20
|
var _actionMappings;
|
|
@@ -27,26 +25,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
25
|
var actionMappings = (_actionMappings = {}, (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.CustomAction, {
|
|
28
26
|
component: _action.default,
|
|
29
27
|
props: {}
|
|
30
|
-
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.DeleteAction, {
|
|
31
|
-
component: _action.default,
|
|
32
|
-
props: {
|
|
33
|
-
testId: 'smart-action-delete-action',
|
|
34
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete),
|
|
35
|
-
icon: /*#__PURE__*/_react.default.createElement(_cross.default, {
|
|
36
|
-
label: "Delete"
|
|
37
|
-
}),
|
|
38
|
-
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.delete)
|
|
39
|
-
}
|
|
40
|
-
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.EditAction, {
|
|
41
|
-
component: _action.default,
|
|
42
|
-
props: {
|
|
43
|
-
testId: 'smart-action-edit-action',
|
|
44
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit),
|
|
45
|
-
icon: /*#__PURE__*/_react.default.createElement(_edit.default, {
|
|
46
|
-
label: "Edit"
|
|
47
|
-
}),
|
|
48
|
-
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit)
|
|
49
|
-
}
|
|
50
28
|
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.ViewAction, {
|
|
51
29
|
component: _viewAction.default,
|
|
52
30
|
props: {
|
|
@@ -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.52.
|
|
20
|
+
packageVersion: "26.52.5",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
package/dist/es2019/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
|
|
2
2
|
export const CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
|
|
3
3
|
export const CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
|
|
4
|
-
export const CONTENT_URL_AI_TROUBLESHOOTING = 'https://
|
|
4
|
+
export const CONTENT_URL_AI_TROUBLESHOOTING = 'https://status.atlassian.com/';
|
|
5
5
|
export const CONTENT_URL_ACCEPTABLE_USE_POLICY = 'https://www.atlassian.com/legal/acceptable-use-policy';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/es2019/messages.js
CHANGED
|
@@ -37,8 +37,8 @@ export const messages = defineMessages({
|
|
|
37
37
|
},
|
|
38
38
|
ai_summary_error_generic: {
|
|
39
39
|
id: 'fabric.linking.ai_summary_error_generic',
|
|
40
|
-
defaultMessage:
|
|
41
|
-
description: 'Shown when AI
|
|
40
|
+
defaultMessage: 'Atlassian Intelligence (AI) isn’t responding. Try again later or <a>check the status of AI</a>.',
|
|
41
|
+
description: 'Shown when AI Summary encountered an unexpected error while summarizing the linked resource content.'
|
|
42
42
|
},
|
|
43
43
|
ai_summary_error_acceptable_use_violation: {
|
|
44
44
|
id: 'fabric.linking.ai_summary_error_acceptable_use_violation',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { errorMessages } from './types';
|
|
4
|
-
import {
|
|
4
|
+
import { addPath } from './utils';
|
|
5
|
+
import { readStream } from './readStream';
|
|
5
6
|
export class AISummaryService {
|
|
6
7
|
constructor(props) {
|
|
7
8
|
_defineProperty(this, "state", {
|
|
@@ -33,19 +34,13 @@ export class AISummaryService {
|
|
|
33
34
|
return readStream(response);
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
|
-
|
|
37
|
-
baseUrl: '/gateway/api/assist',
|
|
37
|
+
this.config = {
|
|
38
|
+
baseUrl: props.baseUrl || '/gateway/api/assist',
|
|
38
39
|
headers: {
|
|
39
40
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
40
41
|
'x-experience-id': 'smart-link',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
this.config = {
|
|
46
|
-
baseUrl: props.baseUrl || defaultConfig.baseUrl,
|
|
47
|
-
headers: {
|
|
48
|
-
...(props.headers || defaultConfig.headers)
|
|
42
|
+
'x-product': props.product || 'confluence',
|
|
43
|
+
...props.headers
|
|
49
44
|
}
|
|
50
45
|
};
|
|
51
46
|
this.url = props.url;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getBufferReader } from './utils';
|
|
2
|
+
export async function* readStream(response) {
|
|
3
|
+
const reader = getBufferReader(response);
|
|
4
|
+
let doneStreaming = false;
|
|
5
|
+
let chunkBuffer = '';
|
|
6
|
+
const chunkTypeErrorMessage = 'jsonChunkType error';
|
|
7
|
+
do {
|
|
8
|
+
try {
|
|
9
|
+
const {
|
|
10
|
+
value,
|
|
11
|
+
done
|
|
12
|
+
} = await reader.read();
|
|
13
|
+
doneStreaming = done;
|
|
14
|
+
if (value) {
|
|
15
|
+
const processedChunks = `${chunkBuffer}${value}`.split('\n'); // assumes that all JSON chunks are separated by a new-line;
|
|
16
|
+
|
|
17
|
+
chunkBuffer = '';
|
|
18
|
+
for (let chunk of processedChunks) {
|
|
19
|
+
try {
|
|
20
|
+
const jsonChunk = JSON.parse(chunk);
|
|
21
|
+
if (jsonChunk.type === 'ERROR') {
|
|
22
|
+
throw new Error(chunkTypeErrorMessage);
|
|
23
|
+
}
|
|
24
|
+
yield jsonChunk;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (e instanceof Error && e.message === chunkTypeErrorMessage) {
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
// the chunk may be incomplete, so we'll save it for the next iteration.
|
|
30
|
+
chunkBuffer = chunk;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// If we abort the call, this exception bubbles up, so we want to catch it and exit gracefully
|
|
36
|
+
if (e instanceof DOMException && e.name === 'AbortError') {
|
|
37
|
+
doneStreaming = true;
|
|
38
|
+
} else {
|
|
39
|
+
reader.cancel();
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} while (!doneStreaming);
|
|
44
|
+
if (chunkBuffer) {
|
|
45
|
+
const error = new Error(`Not all the data was processed: ${chunkBuffer}`);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|