@atlaskit/smart-card 26.49.3 → 26.50.1
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 +16 -0
- package/analytics.spec.yaml +17 -0
- package/dist/cjs/state/analytics/ufoExperiences.js +9 -1
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +53 -35
- package/dist/cjs/state/hooks/use-ai-summary/index.js +23 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/analytics/ufoExperiences.js +9 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +14 -0
- package/dist/es2019/state/hooks/use-ai-summary/index.js +24 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/analytics/ufoExperiences.js +9 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +53 -35
- package/dist/esm/state/hooks/use-ai-summary/index.js +24 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +14 -2
- package/dist/types/state/analytics/ufoExperiences.d.ts +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +3 -0
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +14 -2
- package/dist/types-ts4.5/state/analytics/ufoExperiences.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +3 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.d.ts +2 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.50.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#81356](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81356) [`1b8f940e9229`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b8f940e9229) - AI Summary: Handle error response during streaming
|
|
8
|
+
|
|
9
|
+
## 26.50.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#78681](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78681) [`c24cecdc4ec9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c24cecdc4ec9) - Allows consumers to hide the provider in the footerblock
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#79523](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79523) [`e013a9217f3e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e013a9217f3e) - Adds analytics operational and ufo events for ai summary
|
|
18
|
+
|
|
3
19
|
## 26.49.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -85,6 +85,7 @@ events:
|
|
|
85
85
|
attributes:
|
|
86
86
|
<<: [*PackageMetaDataContext, *ResolvedAttributes]
|
|
87
87
|
fromCache:
|
|
88
|
+
required: false
|
|
88
89
|
type: boolean
|
|
89
90
|
description: if the summary is from a cache
|
|
90
91
|
|
|
@@ -93,3 +94,19 @@ events:
|
|
|
93
94
|
description: fired when a summary error is viewed
|
|
94
95
|
attributes:
|
|
95
96
|
<<: [*PackageMetaDataContext, *ResolvedAttributes]
|
|
97
|
+
|
|
98
|
+
- summary success:
|
|
99
|
+
type: operational
|
|
100
|
+
description: fired when a summary request finishes with a successful response
|
|
101
|
+
attributes:
|
|
102
|
+
<<: [*PackageMetaDataContext, *ResolvedAttributes]
|
|
103
|
+
|
|
104
|
+
- summary failed:
|
|
105
|
+
type: operational
|
|
106
|
+
description: fired when a summary request finishes with a failed response
|
|
107
|
+
attributes:
|
|
108
|
+
<<: [*PackageMetaDataContext, *ResolvedAttributes]
|
|
109
|
+
reason:
|
|
110
|
+
required: false
|
|
111
|
+
type: string
|
|
112
|
+
description: failure reason
|
|
@@ -19,10 +19,18 @@ var renderExperience = {
|
|
|
19
19
|
type: _ufo.ExperienceTypes.Load,
|
|
20
20
|
performanceType: _ufo.ExperiencePerformanceTypes.PageSegmentLoad
|
|
21
21
|
};
|
|
22
|
+
var aiExperience = {
|
|
23
|
+
platform: {
|
|
24
|
+
component: 'smart-links'
|
|
25
|
+
},
|
|
26
|
+
type: _ufo.ExperienceTypes.Experience,
|
|
27
|
+
performanceType: _ufo.ExperiencePerformanceTypes.PageSegmentLoad
|
|
28
|
+
};
|
|
22
29
|
var ufoExperiences = {
|
|
23
30
|
'smart-link-rendered': new _ufo.ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
24
31
|
'smart-link-authenticated': new _ufo.ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
25
|
-
'smart-link-action-invocation': new _ufo.ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
32
|
+
'smart-link-action-invocation': new _ufo.ConcurrentExperience('smart-link-action-invocation', inlineExperience),
|
|
33
|
+
'smart-link-ai-summary': new _ufo.ConcurrentExperience('smart-link-ai-summary', aiExperience)
|
|
26
34
|
};
|
|
27
35
|
var startUfoExperience = exports.startUfoExperience = function startUfoExperience(experienceName, id, properties) {
|
|
28
36
|
var experience = ufoExperiences[experienceName].getInstance(id);
|
|
@@ -10,6 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
14
|
var _utils = require("./utils");
|
|
14
15
|
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; } } }; }
|
|
15
16
|
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); }
|
|
@@ -82,6 +83,9 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
82
83
|
headers: _objectSpread({}, props.headers || defaultConfig.headers)
|
|
83
84
|
};
|
|
84
85
|
this.url = props.url;
|
|
86
|
+
this.onStart = props.onStart;
|
|
87
|
+
this.onSuccess = props.onSuccess;
|
|
88
|
+
this.onError = props.onError;
|
|
85
89
|
}
|
|
86
90
|
(0, _createClass2.default)(AISummaryService, [{
|
|
87
91
|
key: "summariseUrl",
|
|
@@ -91,6 +95,9 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
91
95
|
_iterator2,
|
|
92
96
|
_step2,
|
|
93
97
|
_subscriber,
|
|
98
|
+
id,
|
|
99
|
+
_this$onStart,
|
|
100
|
+
_this$onSuccess,
|
|
94
101
|
stream,
|
|
95
102
|
bufferContent,
|
|
96
103
|
_iteratorAbruptCompletion,
|
|
@@ -102,6 +109,8 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
102
109
|
_iterator3,
|
|
103
110
|
_step3,
|
|
104
111
|
subscriber,
|
|
112
|
+
_chunk$message,
|
|
113
|
+
_this$onError,
|
|
105
114
|
_iterator4,
|
|
106
115
|
_step4,
|
|
107
116
|
_subscriber2,
|
|
@@ -125,22 +134,24 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
125
134
|
} finally {
|
|
126
135
|
_iterator2.f();
|
|
127
136
|
}
|
|
128
|
-
|
|
129
|
-
_context2.
|
|
137
|
+
id = (0, _uuid.default)();
|
|
138
|
+
_context2.prev = 5;
|
|
139
|
+
(_this$onStart = this.onStart) === null || _this$onStart === void 0 || _this$onStart.call(this, id);
|
|
140
|
+
_context2.next = 9;
|
|
130
141
|
return this.fetchStream(summaryStyle);
|
|
131
|
-
case
|
|
142
|
+
case 9:
|
|
132
143
|
stream = _context2.sent;
|
|
133
144
|
bufferContent = '';
|
|
134
145
|
_iteratorAbruptCompletion = false;
|
|
135
146
|
_didIteratorError = false;
|
|
136
|
-
_context2.prev =
|
|
147
|
+
_context2.prev = 13;
|
|
137
148
|
_iterator = _asyncIterator(stream);
|
|
138
|
-
case 13:
|
|
139
|
-
_context2.next = 15;
|
|
140
|
-
return _iterator.next();
|
|
141
149
|
case 15:
|
|
150
|
+
_context2.next = 17;
|
|
151
|
+
return _iterator.next();
|
|
152
|
+
case 17:
|
|
142
153
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
143
|
-
_context2.next =
|
|
154
|
+
_context2.next = 26;
|
|
144
155
|
break;
|
|
145
156
|
}
|
|
146
157
|
chunk = _step.value;
|
|
@@ -165,53 +176,60 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
165
176
|
if (chunk.type === 'FINAL_RESPONSE') {
|
|
166
177
|
bufferContent = chunk.message.message.content;
|
|
167
178
|
}
|
|
168
|
-
|
|
179
|
+
if (!(chunk.type === 'ERROR')) {
|
|
180
|
+
_context2.next = 23;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
throw new Error(chunk === null || chunk === void 0 || (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
|
|
184
|
+
case 23:
|
|
169
185
|
_iteratorAbruptCompletion = false;
|
|
170
|
-
_context2.next =
|
|
186
|
+
_context2.next = 15;
|
|
171
187
|
break;
|
|
172
|
-
case
|
|
173
|
-
_context2.next =
|
|
188
|
+
case 26:
|
|
189
|
+
_context2.next = 32;
|
|
174
190
|
break;
|
|
175
|
-
case 24:
|
|
176
|
-
_context2.prev = 24;
|
|
177
|
-
_context2.t0 = _context2["catch"](11);
|
|
178
|
-
_didIteratorError = true;
|
|
179
|
-
_iteratorError = _context2.t0;
|
|
180
191
|
case 28:
|
|
181
192
|
_context2.prev = 28;
|
|
182
|
-
_context2.
|
|
193
|
+
_context2.t0 = _context2["catch"](13);
|
|
194
|
+
_didIteratorError = true;
|
|
195
|
+
_iteratorError = _context2.t0;
|
|
196
|
+
case 32:
|
|
197
|
+
_context2.prev = 32;
|
|
198
|
+
_context2.prev = 33;
|
|
183
199
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
184
|
-
_context2.next =
|
|
200
|
+
_context2.next = 37;
|
|
185
201
|
break;
|
|
186
202
|
}
|
|
187
|
-
_context2.next =
|
|
203
|
+
_context2.next = 37;
|
|
188
204
|
return _iterator.return();
|
|
189
|
-
case
|
|
190
|
-
_context2.prev =
|
|
205
|
+
case 37:
|
|
206
|
+
_context2.prev = 37;
|
|
191
207
|
if (!_didIteratorError) {
|
|
192
|
-
_context2.next =
|
|
208
|
+
_context2.next = 40;
|
|
193
209
|
break;
|
|
194
210
|
}
|
|
195
211
|
throw _iteratorError;
|
|
196
|
-
case
|
|
197
|
-
return _context2.finish(
|
|
198
|
-
case
|
|
199
|
-
return _context2.finish(
|
|
200
|
-
case
|
|
212
|
+
case 40:
|
|
213
|
+
return _context2.finish(37);
|
|
214
|
+
case 41:
|
|
215
|
+
return _context2.finish(32);
|
|
216
|
+
case 42:
|
|
217
|
+
(_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
|
|
201
218
|
this.state = {
|
|
202
219
|
status: 'done',
|
|
203
220
|
content: bufferContent
|
|
204
221
|
};
|
|
205
|
-
_context2.next =
|
|
222
|
+
_context2.next = 50;
|
|
206
223
|
break;
|
|
207
|
-
case
|
|
208
|
-
_context2.prev =
|
|
209
|
-
_context2.t1 = _context2["catch"](
|
|
224
|
+
case 46:
|
|
225
|
+
_context2.prev = 46;
|
|
226
|
+
_context2.t1 = _context2["catch"](5);
|
|
227
|
+
(_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
|
|
210
228
|
this.state = {
|
|
211
229
|
status: 'error',
|
|
212
230
|
content: ''
|
|
213
231
|
};
|
|
214
|
-
case
|
|
232
|
+
case 50:
|
|
215
233
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
216
234
|
try {
|
|
217
235
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -223,11 +241,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
223
241
|
} finally {
|
|
224
242
|
_iterator4.f();
|
|
225
243
|
}
|
|
226
|
-
case
|
|
244
|
+
case 52:
|
|
227
245
|
case "end":
|
|
228
246
|
return _context2.stop();
|
|
229
247
|
}
|
|
230
|
-
}, _callee2, this, [[
|
|
248
|
+
}, _callee2, this, [[5, 46], [13, 28, 32, 42], [33,, 37, 41]]);
|
|
231
249
|
}));
|
|
232
250
|
function summariseUrl() {
|
|
233
251
|
return _summariseUrl.apply(this, arguments);
|
|
@@ -9,6 +9,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _store = require("./ai-summary-service/store");
|
|
11
11
|
var _aiSummaryService = require("./ai-summary-service");
|
|
12
|
+
var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-analytics-events");
|
|
13
|
+
var _analytics = require("../../analytics");
|
|
14
|
+
var EXPERIENCE_NAME = 'smart-link-ai-summary';
|
|
12
15
|
var useAISummary = exports.useAISummary = function useAISummary(props) {
|
|
13
16
|
var _AISummariesStore$get;
|
|
14
17
|
var url = props.url,
|
|
@@ -22,6 +25,22 @@ var useAISummary = exports.useAISummary = function useAISummary(props) {
|
|
|
22
25
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
23
26
|
state = _useState2[0],
|
|
24
27
|
setState = _useState2[1];
|
|
28
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
29
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
30
|
+
var onStart = (0, _react.useCallback)(function (id) {
|
|
31
|
+
(0, _analytics.startUfoExperience)(EXPERIENCE_NAME, id);
|
|
32
|
+
}, []);
|
|
33
|
+
var onSuccess = (0, _react.useCallback)(function (id) {
|
|
34
|
+
fireEvent('operational.summary.success', {});
|
|
35
|
+
(0, _analytics.succeedUfoExperience)(EXPERIENCE_NAME, id);
|
|
36
|
+
}, [fireEvent]);
|
|
37
|
+
var onError = (0, _react.useCallback)(function (id) {
|
|
38
|
+
var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
39
|
+
fireEvent('operational.summary.failed', {
|
|
40
|
+
reason: reason
|
|
41
|
+
});
|
|
42
|
+
(0, _analytics.failUfoExperience)(EXPERIENCE_NAME, id);
|
|
43
|
+
}, [fireEvent]);
|
|
25
44
|
(0, _react.useEffect)(function () {
|
|
26
45
|
var _AISummariesStore$get2;
|
|
27
46
|
if (!_store.AISummariesStore.get(url)) {
|
|
@@ -29,13 +48,16 @@ var useAISummary = exports.useAISummary = function useAISummary(props) {
|
|
|
29
48
|
url: url,
|
|
30
49
|
baseUrl: baseUrl,
|
|
31
50
|
headers: headers,
|
|
51
|
+
onError: onError,
|
|
52
|
+
onStart: onStart,
|
|
53
|
+
onSuccess: onSuccess,
|
|
32
54
|
product: product
|
|
33
55
|
}));
|
|
34
56
|
}
|
|
35
57
|
|
|
36
58
|
//returns function that calls unsubscribe method
|
|
37
59
|
return (_AISummariesStore$get2 = _store.AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
38
|
-
}, [url, baseUrl, headers, product]);
|
|
60
|
+
}, [url, baseUrl, headers, onError, onStart, onSuccess, product]);
|
|
39
61
|
var summariseUrl = function summariseUrl() {
|
|
40
62
|
var _AISummariesStore$get3;
|
|
41
63
|
return (_AISummariesStore$get3 = _store.AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
@@ -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.50.1"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -7,7 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _useAnalyticsEvents2 = require("../../../../../../common/analytics/generated/use-analytics-events");
|
|
9
9
|
var AIEventSummaryViewed = function AIEventSummaryViewed(_ref) {
|
|
10
|
-
var fromCache = _ref.fromCache
|
|
10
|
+
var _ref$fromCache = _ref.fromCache,
|
|
11
|
+
fromCache = _ref$fromCache === void 0 ? null : _ref$fromCache;
|
|
11
12
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
12
13
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
13
14
|
(0, _react.useEffect)(function () {
|
|
@@ -22,7 +22,8 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
|
|
|
22
22
|
testId = props.testId,
|
|
23
23
|
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
24
24
|
_props$size = props.size,
|
|
25
|
-
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size
|
|
25
|
+
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
26
|
+
hideProvider = props.hideProvider;
|
|
26
27
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
27
28
|
var hasActions = (0, _react.useMemo)(function () {
|
|
28
29
|
var _filterActionItems;
|
|
@@ -37,7 +38,7 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
|
|
|
37
38
|
}, [onActionMenuOpenChange]);
|
|
38
39
|
return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, props, {
|
|
39
40
|
testId: "".concat(testId, "-resolved-view")
|
|
40
|
-
}), /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
41
|
+
}), !hideProvider && /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
41
42
|
testId: "".concat(testId, "-provider")
|
|
42
43
|
}), actions && hasActions ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
43
44
|
testId: "smart-element-group-actions",
|
|
@@ -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.50.1",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -13,10 +13,18 @@ const renderExperience = {
|
|
|
13
13
|
type: ExperienceTypes.Load,
|
|
14
14
|
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
15
15
|
};
|
|
16
|
+
const aiExperience = {
|
|
17
|
+
platform: {
|
|
18
|
+
component: 'smart-links'
|
|
19
|
+
},
|
|
20
|
+
type: ExperienceTypes.Experience,
|
|
21
|
+
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
22
|
+
};
|
|
16
23
|
const ufoExperiences = {
|
|
17
24
|
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
18
25
|
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
19
|
-
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
26
|
+
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience),
|
|
27
|
+
'smart-link-ai-summary': new ConcurrentExperience('smart-link-ai-summary', aiExperience)
|
|
20
28
|
};
|
|
21
29
|
export const startUfoExperience = (experienceName, id, properties) => {
|
|
22
30
|
const experience = ufoExperiences[experienceName].getInstance(id);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import uuid from 'uuid';
|
|
2
3
|
import { readStream, addPath } from './utils';
|
|
3
4
|
export class AISummaryService {
|
|
4
5
|
constructor(props) {
|
|
@@ -45,6 +46,9 @@ export class AISummaryService {
|
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
this.url = props.url;
|
|
49
|
+
this.onStart = props.onStart;
|
|
50
|
+
this.onSuccess = props.onSuccess;
|
|
51
|
+
this.onError = props.onError;
|
|
48
52
|
}
|
|
49
53
|
async summariseUrl(summaryStyle = 'medium') {
|
|
50
54
|
this.state = {
|
|
@@ -54,7 +58,10 @@ export class AISummaryService {
|
|
|
54
58
|
for (const subscriber of this.subscribedStateSetters) {
|
|
55
59
|
subscriber(this.state);
|
|
56
60
|
}
|
|
61
|
+
const id = uuid();
|
|
57
62
|
try {
|
|
63
|
+
var _this$onStart, _this$onSuccess;
|
|
64
|
+
(_this$onStart = this.onStart) === null || _this$onStart === void 0 ? void 0 : _this$onStart.call(this, id);
|
|
58
65
|
const stream = await this.fetchStream(summaryStyle);
|
|
59
66
|
let bufferContent = '';
|
|
60
67
|
for await (const chunk of stream) {
|
|
@@ -72,12 +79,19 @@ export class AISummaryService {
|
|
|
72
79
|
if (chunk.type === 'FINAL_RESPONSE') {
|
|
73
80
|
bufferContent = chunk.message.message.content;
|
|
74
81
|
}
|
|
82
|
+
if (chunk.type === 'ERROR') {
|
|
83
|
+
var _chunk$message;
|
|
84
|
+
throw new Error(chunk === null || chunk === void 0 ? void 0 : (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
|
|
85
|
+
}
|
|
75
86
|
}
|
|
87
|
+
(_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 ? void 0 : _this$onSuccess.call(this, id);
|
|
76
88
|
this.state = {
|
|
77
89
|
status: 'done',
|
|
78
90
|
content: bufferContent
|
|
79
91
|
};
|
|
80
92
|
} catch (err) {
|
|
93
|
+
var _this$onError;
|
|
94
|
+
(_this$onError = this.onError) === null || _this$onError === void 0 ? void 0 : _this$onError.call(this, id, 'generic');
|
|
81
95
|
this.state = {
|
|
82
96
|
status: 'error',
|
|
83
97
|
content: ''
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
1
|
+
import { useCallback, useState, useEffect } from 'react';
|
|
2
2
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
3
3
|
import { AISummaryService } from './ai-summary-service';
|
|
4
|
+
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
5
|
+
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
6
|
+
const EXPERIENCE_NAME = 'smart-link-ai-summary';
|
|
4
7
|
export const useAISummary = props => {
|
|
5
8
|
var _AISummariesStore$get;
|
|
6
9
|
const {
|
|
@@ -13,6 +16,22 @@ export const useAISummary = props => {
|
|
|
13
16
|
status: 'ready',
|
|
14
17
|
content: ''
|
|
15
18
|
});
|
|
19
|
+
const {
|
|
20
|
+
fireEvent
|
|
21
|
+
} = useAnalyticsEvents();
|
|
22
|
+
const onStart = useCallback(id => {
|
|
23
|
+
startUfoExperience(EXPERIENCE_NAME, id);
|
|
24
|
+
}, []);
|
|
25
|
+
const onSuccess = useCallback(id => {
|
|
26
|
+
fireEvent('operational.summary.success', {});
|
|
27
|
+
succeedUfoExperience(EXPERIENCE_NAME, id);
|
|
28
|
+
}, [fireEvent]);
|
|
29
|
+
const onError = useCallback((id, reason = null) => {
|
|
30
|
+
fireEvent('operational.summary.failed', {
|
|
31
|
+
reason
|
|
32
|
+
});
|
|
33
|
+
failUfoExperience(EXPERIENCE_NAME, id);
|
|
34
|
+
}, [fireEvent]);
|
|
16
35
|
useEffect(() => {
|
|
17
36
|
var _AISummariesStore$get2;
|
|
18
37
|
if (!AISummariesStore.get(url)) {
|
|
@@ -20,13 +39,16 @@ export const useAISummary = props => {
|
|
|
20
39
|
url,
|
|
21
40
|
baseUrl,
|
|
22
41
|
headers,
|
|
42
|
+
onError,
|
|
43
|
+
onStart,
|
|
44
|
+
onSuccess,
|
|
23
45
|
product
|
|
24
46
|
}));
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
//returns function that calls unsubscribe method
|
|
28
50
|
return (_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
29
|
-
}, [url, baseUrl, headers, product]);
|
|
51
|
+
}, [url, baseUrl, headers, onError, onStart, onSuccess, product]);
|
|
30
52
|
const summariseUrl = () => {
|
|
31
53
|
var _AISummariesStore$get3;
|
|
32
54
|
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: "26.
|
|
7
|
+
packageVersion: "26.50.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,8 @@ const FooterBlockResolvedView = props => {
|
|
|
12
12
|
actions,
|
|
13
13
|
testId,
|
|
14
14
|
onActionMenuOpenChange,
|
|
15
|
-
size = SmartLinkSize.Medium
|
|
15
|
+
size = SmartLinkSize.Medium,
|
|
16
|
+
hideProvider
|
|
16
17
|
} = props;
|
|
17
18
|
const context = useFlexibleUiContext();
|
|
18
19
|
const hasActions = useMemo(() => {
|
|
@@ -28,7 +29,7 @@ const FooterBlockResolvedView = props => {
|
|
|
28
29
|
}, [onActionMenuOpenChange]);
|
|
29
30
|
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
30
31
|
testId: `${testId}-resolved-view`
|
|
31
|
-
}), /*#__PURE__*/React.createElement(Provider, {
|
|
32
|
+
}), !hideProvider && /*#__PURE__*/React.createElement(Provider, {
|
|
32
33
|
testId: `${testId}-provider`
|
|
33
34
|
}), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
35
|
testId: "smart-element-group-actions",
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.
|
|
10
|
+
packageVersion: "26.50.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -13,10 +13,18 @@ var renderExperience = {
|
|
|
13
13
|
type: ExperienceTypes.Load,
|
|
14
14
|
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
15
15
|
};
|
|
16
|
+
var aiExperience = {
|
|
17
|
+
platform: {
|
|
18
|
+
component: 'smart-links'
|
|
19
|
+
},
|
|
20
|
+
type: ExperienceTypes.Experience,
|
|
21
|
+
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
22
|
+
};
|
|
16
23
|
var ufoExperiences = {
|
|
17
24
|
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
18
25
|
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
19
|
-
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
26
|
+
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience),
|
|
27
|
+
'smart-link-ai-summary': new ConcurrentExperience('smart-link-ai-summary', aiExperience)
|
|
20
28
|
};
|
|
21
29
|
export var startUfoExperience = function startUfoExperience(experienceName, id, properties) {
|
|
22
30
|
var experience = ufoExperiences[experienceName].getInstance(id);
|
|
@@ -10,6 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
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
|
+
import uuid from 'uuid';
|
|
13
14
|
import { readStream, addPath } from './utils';
|
|
14
15
|
export var AISummaryService = /*#__PURE__*/function () {
|
|
15
16
|
function AISummaryService(props) {
|
|
@@ -75,6 +76,9 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
75
76
|
headers: _objectSpread({}, props.headers || defaultConfig.headers)
|
|
76
77
|
};
|
|
77
78
|
this.url = props.url;
|
|
79
|
+
this.onStart = props.onStart;
|
|
80
|
+
this.onSuccess = props.onSuccess;
|
|
81
|
+
this.onError = props.onError;
|
|
78
82
|
}
|
|
79
83
|
_createClass(AISummaryService, [{
|
|
80
84
|
key: "summariseUrl",
|
|
@@ -84,6 +88,9 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
84
88
|
_iterator2,
|
|
85
89
|
_step2,
|
|
86
90
|
_subscriber,
|
|
91
|
+
id,
|
|
92
|
+
_this$onStart,
|
|
93
|
+
_this$onSuccess,
|
|
87
94
|
stream,
|
|
88
95
|
bufferContent,
|
|
89
96
|
_iteratorAbruptCompletion,
|
|
@@ -95,6 +102,8 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
95
102
|
_iterator3,
|
|
96
103
|
_step3,
|
|
97
104
|
subscriber,
|
|
105
|
+
_chunk$message,
|
|
106
|
+
_this$onError,
|
|
98
107
|
_iterator4,
|
|
99
108
|
_step4,
|
|
100
109
|
_subscriber2,
|
|
@@ -118,22 +127,24 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
118
127
|
} finally {
|
|
119
128
|
_iterator2.f();
|
|
120
129
|
}
|
|
121
|
-
|
|
122
|
-
_context2.
|
|
130
|
+
id = uuid();
|
|
131
|
+
_context2.prev = 5;
|
|
132
|
+
(_this$onStart = this.onStart) === null || _this$onStart === void 0 || _this$onStart.call(this, id);
|
|
133
|
+
_context2.next = 9;
|
|
123
134
|
return this.fetchStream(summaryStyle);
|
|
124
|
-
case
|
|
135
|
+
case 9:
|
|
125
136
|
stream = _context2.sent;
|
|
126
137
|
bufferContent = '';
|
|
127
138
|
_iteratorAbruptCompletion = false;
|
|
128
139
|
_didIteratorError = false;
|
|
129
|
-
_context2.prev =
|
|
140
|
+
_context2.prev = 13;
|
|
130
141
|
_iterator = _asyncIterator(stream);
|
|
131
|
-
case 13:
|
|
132
|
-
_context2.next = 15;
|
|
133
|
-
return _iterator.next();
|
|
134
142
|
case 15:
|
|
143
|
+
_context2.next = 17;
|
|
144
|
+
return _iterator.next();
|
|
145
|
+
case 17:
|
|
135
146
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
136
|
-
_context2.next =
|
|
147
|
+
_context2.next = 26;
|
|
137
148
|
break;
|
|
138
149
|
}
|
|
139
150
|
chunk = _step.value;
|
|
@@ -158,53 +169,60 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
158
169
|
if (chunk.type === 'FINAL_RESPONSE') {
|
|
159
170
|
bufferContent = chunk.message.message.content;
|
|
160
171
|
}
|
|
161
|
-
|
|
172
|
+
if (!(chunk.type === 'ERROR')) {
|
|
173
|
+
_context2.next = 23;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
throw new Error(chunk === null || chunk === void 0 || (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
|
|
177
|
+
case 23:
|
|
162
178
|
_iteratorAbruptCompletion = false;
|
|
163
|
-
_context2.next =
|
|
179
|
+
_context2.next = 15;
|
|
164
180
|
break;
|
|
165
|
-
case
|
|
166
|
-
_context2.next =
|
|
181
|
+
case 26:
|
|
182
|
+
_context2.next = 32;
|
|
167
183
|
break;
|
|
168
|
-
case 24:
|
|
169
|
-
_context2.prev = 24;
|
|
170
|
-
_context2.t0 = _context2["catch"](11);
|
|
171
|
-
_didIteratorError = true;
|
|
172
|
-
_iteratorError = _context2.t0;
|
|
173
184
|
case 28:
|
|
174
185
|
_context2.prev = 28;
|
|
175
|
-
_context2.
|
|
186
|
+
_context2.t0 = _context2["catch"](13);
|
|
187
|
+
_didIteratorError = true;
|
|
188
|
+
_iteratorError = _context2.t0;
|
|
189
|
+
case 32:
|
|
190
|
+
_context2.prev = 32;
|
|
191
|
+
_context2.prev = 33;
|
|
176
192
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
177
|
-
_context2.next =
|
|
193
|
+
_context2.next = 37;
|
|
178
194
|
break;
|
|
179
195
|
}
|
|
180
|
-
_context2.next =
|
|
196
|
+
_context2.next = 37;
|
|
181
197
|
return _iterator.return();
|
|
182
|
-
case
|
|
183
|
-
_context2.prev =
|
|
198
|
+
case 37:
|
|
199
|
+
_context2.prev = 37;
|
|
184
200
|
if (!_didIteratorError) {
|
|
185
|
-
_context2.next =
|
|
201
|
+
_context2.next = 40;
|
|
186
202
|
break;
|
|
187
203
|
}
|
|
188
204
|
throw _iteratorError;
|
|
189
|
-
case
|
|
190
|
-
return _context2.finish(
|
|
191
|
-
case
|
|
192
|
-
return _context2.finish(
|
|
193
|
-
case
|
|
205
|
+
case 40:
|
|
206
|
+
return _context2.finish(37);
|
|
207
|
+
case 41:
|
|
208
|
+
return _context2.finish(32);
|
|
209
|
+
case 42:
|
|
210
|
+
(_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
|
|
194
211
|
this.state = {
|
|
195
212
|
status: 'done',
|
|
196
213
|
content: bufferContent
|
|
197
214
|
};
|
|
198
|
-
_context2.next =
|
|
215
|
+
_context2.next = 50;
|
|
199
216
|
break;
|
|
200
|
-
case
|
|
201
|
-
_context2.prev =
|
|
202
|
-
_context2.t1 = _context2["catch"](
|
|
217
|
+
case 46:
|
|
218
|
+
_context2.prev = 46;
|
|
219
|
+
_context2.t1 = _context2["catch"](5);
|
|
220
|
+
(_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
|
|
203
221
|
this.state = {
|
|
204
222
|
status: 'error',
|
|
205
223
|
content: ''
|
|
206
224
|
};
|
|
207
|
-
case
|
|
225
|
+
case 50:
|
|
208
226
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
209
227
|
try {
|
|
210
228
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -216,11 +234,11 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
216
234
|
} finally {
|
|
217
235
|
_iterator4.f();
|
|
218
236
|
}
|
|
219
|
-
case
|
|
237
|
+
case 52:
|
|
220
238
|
case "end":
|
|
221
239
|
return _context2.stop();
|
|
222
240
|
}
|
|
223
|
-
}, _callee2, this, [[
|
|
241
|
+
}, _callee2, this, [[5, 46], [13, 28, 32, 42], [33,, 37, 41]]);
|
|
224
242
|
}));
|
|
225
243
|
function summariseUrl() {
|
|
226
244
|
return _summariseUrl.apply(this, arguments);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useCallback, useState, useEffect } from 'react';
|
|
3
3
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
4
4
|
import { AISummaryService } from './ai-summary-service';
|
|
5
|
+
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
6
|
+
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
7
|
+
var EXPERIENCE_NAME = 'smart-link-ai-summary';
|
|
5
8
|
export var useAISummary = function useAISummary(props) {
|
|
6
9
|
var _AISummariesStore$get;
|
|
7
10
|
var url = props.url,
|
|
@@ -15,6 +18,22 @@ export var useAISummary = function useAISummary(props) {
|
|
|
15
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
19
|
state = _useState2[0],
|
|
17
20
|
setState = _useState2[1];
|
|
21
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
22
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
23
|
+
var onStart = useCallback(function (id) {
|
|
24
|
+
startUfoExperience(EXPERIENCE_NAME, id);
|
|
25
|
+
}, []);
|
|
26
|
+
var onSuccess = useCallback(function (id) {
|
|
27
|
+
fireEvent('operational.summary.success', {});
|
|
28
|
+
succeedUfoExperience(EXPERIENCE_NAME, id);
|
|
29
|
+
}, [fireEvent]);
|
|
30
|
+
var onError = useCallback(function (id) {
|
|
31
|
+
var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
32
|
+
fireEvent('operational.summary.failed', {
|
|
33
|
+
reason: reason
|
|
34
|
+
});
|
|
35
|
+
failUfoExperience(EXPERIENCE_NAME, id);
|
|
36
|
+
}, [fireEvent]);
|
|
18
37
|
useEffect(function () {
|
|
19
38
|
var _AISummariesStore$get2;
|
|
20
39
|
if (!AISummariesStore.get(url)) {
|
|
@@ -22,13 +41,16 @@ export var useAISummary = function useAISummary(props) {
|
|
|
22
41
|
url: url,
|
|
23
42
|
baseUrl: baseUrl,
|
|
24
43
|
headers: headers,
|
|
44
|
+
onError: onError,
|
|
45
|
+
onStart: onStart,
|
|
46
|
+
onSuccess: onSuccess,
|
|
25
47
|
product: product
|
|
26
48
|
}));
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
//returns function that calls unsubscribe method
|
|
30
52
|
return (_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
31
|
-
}, [url, baseUrl, headers, product]);
|
|
53
|
+
}, [url, baseUrl, headers, onError, onStart, onSuccess, product]);
|
|
32
54
|
var summariseUrl = function summariseUrl() {
|
|
33
55
|
var _AISummariesStore$get3;
|
|
34
56
|
return (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.
|
|
18
|
+
packageVersion: "26.50.1"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
3
3
|
var AIEventSummaryViewed = function AIEventSummaryViewed(_ref) {
|
|
4
|
-
var fromCache = _ref.fromCache
|
|
4
|
+
var _ref$fromCache = _ref.fromCache,
|
|
5
|
+
fromCache = _ref$fromCache === void 0 ? null : _ref$fromCache;
|
|
5
6
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
6
7
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
7
8
|
useEffect(function () {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,8 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
|
|
|
12
12
|
testId = props.testId,
|
|
13
13
|
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
14
14
|
_props$size = props.size,
|
|
15
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size
|
|
15
|
+
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
16
|
+
hideProvider = props.hideProvider;
|
|
16
17
|
var context = useFlexibleUiContext();
|
|
17
18
|
var hasActions = useMemo(function () {
|
|
18
19
|
var _filterActionItems;
|
|
@@ -27,7 +28,7 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
|
|
|
27
28
|
}, [onActionMenuOpenChange]);
|
|
28
29
|
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
29
30
|
testId: "".concat(testId, "-resolved-view")
|
|
30
|
-
}), /*#__PURE__*/React.createElement(Provider, {
|
|
31
|
+
}), !hideProvider && /*#__PURE__*/React.createElement(Provider, {
|
|
31
32
|
testId: "".concat(testId, "-provider")
|
|
32
33
|
}), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
33
34
|
testId: "smart-element-group-actions",
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.
|
|
13
|
+
packageVersion: "26.50.1",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::81a232dd81b5db01399e6f7e28181c20>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -25,8 +25,14 @@ export type ResolvedAttributesType = {
|
|
|
25
25
|
canBeDatasource: boolean | null;
|
|
26
26
|
};
|
|
27
27
|
export type ButtonClickedAiSummaryAttributesType = {};
|
|
28
|
-
export type SummaryViewedAttributesType = {
|
|
28
|
+
export type SummaryViewedAttributesType = {
|
|
29
|
+
fromCache: boolean | null;
|
|
30
|
+
};
|
|
29
31
|
export type ErrorViewedAiSummaryAttributesType = {};
|
|
32
|
+
export type SummarySuccessAttributesType = {};
|
|
33
|
+
export type SummaryFailedAttributesType = {
|
|
34
|
+
reason: string | null;
|
|
35
|
+
};
|
|
30
36
|
export type AnalyticsEventAttributes = {
|
|
31
37
|
/**
|
|
32
38
|
* fired when an ai summary is clicked */
|
|
@@ -37,5 +43,11 @@ export type AnalyticsEventAttributes = {
|
|
|
37
43
|
/**
|
|
38
44
|
* fired when a summary error is viewed */
|
|
39
45
|
'ui.error.viewed.aiSummary': ErrorViewedAiSummaryAttributesType;
|
|
46
|
+
/**
|
|
47
|
+
* fired when a summary request finishes with a successful response */
|
|
48
|
+
'operational.summary.success': SummarySuccessAttributesType;
|
|
49
|
+
/**
|
|
50
|
+
* fired when a summary request finishes with a failed response */
|
|
51
|
+
'operational.summary.failed': SummaryFailedAttributesType;
|
|
40
52
|
};
|
|
41
53
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomData } from '@atlaskit/ufo';
|
|
2
|
-
type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation';
|
|
2
|
+
type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation' | 'smart-link-ai-summary';
|
|
3
3
|
export declare const startUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
4
4
|
export declare const succeedUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
5
5
|
export declare const failUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
@@ -4,6 +4,9 @@ export declare class AISummaryService implements AISummaryServiceInt {
|
|
|
4
4
|
private config;
|
|
5
5
|
private url;
|
|
6
6
|
private subscribedStateSetters;
|
|
7
|
+
private onStart?;
|
|
8
|
+
private onSuccess?;
|
|
9
|
+
private onError?;
|
|
7
10
|
constructor(props: AISummaryServiceProps);
|
|
8
11
|
private fetchStream;
|
|
9
12
|
summariseUrl(summaryStyle?: SummaryStyle): Promise<void>;
|
|
@@ -7,6 +7,9 @@ export interface AISummaryServiceInt {
|
|
|
7
7
|
export type AISummaryServiceProps = {
|
|
8
8
|
baseUrl?: string;
|
|
9
9
|
headers?: Record<string, string>;
|
|
10
|
+
onError?: (id: string, reason?: string) => void;
|
|
11
|
+
onStart?: (id: string) => void;
|
|
12
|
+
onSuccess?: (id: string) => void;
|
|
10
13
|
product?: ProductType;
|
|
11
14
|
url: string;
|
|
12
15
|
};
|
|
@@ -12,4 +12,8 @@ export type FooterBlockProps = {
|
|
|
12
12
|
* Function to be called when footer action dropdown open state is changed.
|
|
13
13
|
*/
|
|
14
14
|
onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Allows hiding of the resources provider
|
|
17
|
+
*/
|
|
18
|
+
hideProvider?: boolean;
|
|
15
19
|
} & BlockProps;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::81a232dd81b5db01399e6f7e28181c20>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -25,8 +25,14 @@ export type ResolvedAttributesType = {
|
|
|
25
25
|
canBeDatasource: boolean | null;
|
|
26
26
|
};
|
|
27
27
|
export type ButtonClickedAiSummaryAttributesType = {};
|
|
28
|
-
export type SummaryViewedAttributesType = {
|
|
28
|
+
export type SummaryViewedAttributesType = {
|
|
29
|
+
fromCache: boolean | null;
|
|
30
|
+
};
|
|
29
31
|
export type ErrorViewedAiSummaryAttributesType = {};
|
|
32
|
+
export type SummarySuccessAttributesType = {};
|
|
33
|
+
export type SummaryFailedAttributesType = {
|
|
34
|
+
reason: string | null;
|
|
35
|
+
};
|
|
30
36
|
export type AnalyticsEventAttributes = {
|
|
31
37
|
/**
|
|
32
38
|
* fired when an ai summary is clicked */
|
|
@@ -37,5 +43,11 @@ export type AnalyticsEventAttributes = {
|
|
|
37
43
|
/**
|
|
38
44
|
* fired when a summary error is viewed */
|
|
39
45
|
'ui.error.viewed.aiSummary': ErrorViewedAiSummaryAttributesType;
|
|
46
|
+
/**
|
|
47
|
+
* fired when a summary request finishes with a successful response */
|
|
48
|
+
'operational.summary.success': SummarySuccessAttributesType;
|
|
49
|
+
/**
|
|
50
|
+
* fired when a summary request finishes with a failed response */
|
|
51
|
+
'operational.summary.failed': SummaryFailedAttributesType;
|
|
40
52
|
};
|
|
41
53
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomData } from '@atlaskit/ufo';
|
|
2
|
-
type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation';
|
|
2
|
+
type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation' | 'smart-link-ai-summary';
|
|
3
3
|
export declare const startUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
4
4
|
export declare const succeedUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
5
5
|
export declare const failUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData) => void;
|
|
@@ -4,6 +4,9 @@ export declare class AISummaryService implements AISummaryServiceInt {
|
|
|
4
4
|
private config;
|
|
5
5
|
private url;
|
|
6
6
|
private subscribedStateSetters;
|
|
7
|
+
private onStart?;
|
|
8
|
+
private onSuccess?;
|
|
9
|
+
private onError?;
|
|
7
10
|
constructor(props: AISummaryServiceProps);
|
|
8
11
|
private fetchStream;
|
|
9
12
|
summariseUrl(summaryStyle?: SummaryStyle): Promise<void>;
|
|
@@ -7,6 +7,9 @@ export interface AISummaryServiceInt {
|
|
|
7
7
|
export type AISummaryServiceProps = {
|
|
8
8
|
baseUrl?: string;
|
|
9
9
|
headers?: Record<string, string>;
|
|
10
|
+
onError?: (id: string, reason?: string) => void;
|
|
11
|
+
onStart?: (id: string) => void;
|
|
12
|
+
onSuccess?: (id: string) => void;
|
|
10
13
|
product?: ProductType;
|
|
11
14
|
url: string;
|
|
12
15
|
};
|
|
@@ -12,4 +12,8 @@ export type FooterBlockProps = {
|
|
|
12
12
|
* Function to be called when footer action dropdown open state is changed.
|
|
13
13
|
*/
|
|
14
14
|
onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Allows hiding of the resources provider
|
|
17
|
+
*/
|
|
18
|
+
hideProvider?: boolean;
|
|
15
19
|
} & BlockProps;
|