@atlaskit/smart-card 26.49.2 → 26.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/analytics.spec.yaml +17 -0
- package/dist/cjs/common/analytics/generated/analytics.types.js +1 -5
- package/dist/cjs/extractors/common/detail/types.js +1 -5
- package/dist/cjs/state/analytics/ufoExperiences.js +9 -1
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -34
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/types.js +1 -5
- package/dist/cjs/state/hooks/use-ai-summary/index.js +23 -1
- package/dist/cjs/state/types.js +1 -5
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/EmbedModal/components/embed-content/types.js +1 -5
- package/dist/cjs/view/EmbedModal/components/link-info/link-info-button/types.js +1 -5
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-dropdown-item/types.js +1 -5
- 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-state-indicator/ai-state-done.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/related-urls-block/types.js +1 -5
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/types.js +1 -5
- package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/types.js +1 -5
- package/dist/cjs/view/FlexibleCard/components/container/layered-link/types.js +1 -5
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/LinkUrl/types.js +1 -5
- package/dist/cjs/view/common/ai-summary/index.js +1 -1
- package/dist/es2019/common/analytics/generated/analytics.types.js +0 -1
- package/dist/es2019/extractors/common/detail/types.js +0 -1
- package/dist/es2019/state/analytics/ufoExperiences.js +9 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +10 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/types.js +0 -1
- package/dist/es2019/state/hooks/use-ai-summary/index.js +24 -2
- package/dist/es2019/state/types.js +0 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/EmbedModal/components/embed-content/types.js +0 -1
- package/dist/es2019/view/EmbedModal/components/link-info/link-info-button/types.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-dropdown-item/types.js +0 -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-state-indicator/ai-state-done.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/related-urls-block/types.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/types.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/types.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/container/layered-link/types.js +0 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/LinkUrl/types.js +0 -1
- package/dist/es2019/view/common/ai-summary/index.js +1 -1
- package/dist/esm/common/analytics/generated/analytics.types.js +0 -1
- package/dist/esm/extractors/common/detail/types.js +0 -1
- package/dist/esm/state/analytics/ufoExperiences.js +9 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -34
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/types.js +0 -1
- package/dist/esm/state/hooks/use-ai-summary/index.js +24 -2
- package/dist/esm/state/types.js +0 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/EmbedModal/components/embed-content/types.js +0 -1
- package/dist/esm/view/EmbedModal/components/link-info/link-info-button/types.js +0 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-dropdown-item/types.js +0 -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-state-indicator/ai-state-done.js +1 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/related-urls-block/types.js +0 -1
- package/dist/esm/view/FlexibleCard/components/common/image-icon/types.js +0 -1
- package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/types.js +0 -1
- package/dist/esm/view/FlexibleCard/components/container/layered-link/types.js +0 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/LinkUrl/types.js +0 -1
- package/dist/esm/view/common/ai-summary/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.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#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
|
|
12
|
+
|
|
13
|
+
## 26.49.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#81241](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81241) [`9e73c089380f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9e73c089380f) - [ux] Fix summary icon positioning and wrapping within hover card
|
|
18
|
+
|
|
3
19
|
## 26.49.2
|
|
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,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
102
109
|
_iterator3,
|
|
103
110
|
_step3,
|
|
104
111
|
subscriber,
|
|
112
|
+
_this$onError,
|
|
105
113
|
_iterator4,
|
|
106
114
|
_step4,
|
|
107
115
|
_subscriber2,
|
|
@@ -125,22 +133,24 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
125
133
|
} finally {
|
|
126
134
|
_iterator2.f();
|
|
127
135
|
}
|
|
128
|
-
|
|
129
|
-
_context2.
|
|
136
|
+
id = (0, _uuid.default)();
|
|
137
|
+
_context2.prev = 5;
|
|
138
|
+
(_this$onStart = this.onStart) === null || _this$onStart === void 0 || _this$onStart.call(this, id);
|
|
139
|
+
_context2.next = 9;
|
|
130
140
|
return this.fetchStream(summaryStyle);
|
|
131
|
-
case
|
|
141
|
+
case 9:
|
|
132
142
|
stream = _context2.sent;
|
|
133
143
|
bufferContent = '';
|
|
134
144
|
_iteratorAbruptCompletion = false;
|
|
135
145
|
_didIteratorError = false;
|
|
136
|
-
_context2.prev =
|
|
146
|
+
_context2.prev = 13;
|
|
137
147
|
_iterator = _asyncIterator(stream);
|
|
138
|
-
case 13:
|
|
139
|
-
_context2.next = 15;
|
|
140
|
-
return _iterator.next();
|
|
141
148
|
case 15:
|
|
149
|
+
_context2.next = 17;
|
|
150
|
+
return _iterator.next();
|
|
151
|
+
case 17:
|
|
142
152
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
143
|
-
_context2.next =
|
|
153
|
+
_context2.next = 24;
|
|
144
154
|
break;
|
|
145
155
|
}
|
|
146
156
|
chunk = _step.value;
|
|
@@ -165,53 +175,55 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
165
175
|
if (chunk.type === 'FINAL_RESPONSE') {
|
|
166
176
|
bufferContent = chunk.message.message.content;
|
|
167
177
|
}
|
|
168
|
-
case
|
|
178
|
+
case 21:
|
|
169
179
|
_iteratorAbruptCompletion = false;
|
|
170
|
-
_context2.next =
|
|
171
|
-
break;
|
|
172
|
-
case 22:
|
|
173
|
-
_context2.next = 28;
|
|
180
|
+
_context2.next = 15;
|
|
174
181
|
break;
|
|
175
182
|
case 24:
|
|
176
|
-
_context2.
|
|
177
|
-
|
|
183
|
+
_context2.next = 30;
|
|
184
|
+
break;
|
|
185
|
+
case 26:
|
|
186
|
+
_context2.prev = 26;
|
|
187
|
+
_context2.t0 = _context2["catch"](13);
|
|
178
188
|
_didIteratorError = true;
|
|
179
189
|
_iteratorError = _context2.t0;
|
|
180
|
-
case
|
|
181
|
-
_context2.prev =
|
|
182
|
-
_context2.prev =
|
|
190
|
+
case 30:
|
|
191
|
+
_context2.prev = 30;
|
|
192
|
+
_context2.prev = 31;
|
|
183
193
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
184
|
-
_context2.next =
|
|
194
|
+
_context2.next = 35;
|
|
185
195
|
break;
|
|
186
196
|
}
|
|
187
|
-
_context2.next =
|
|
197
|
+
_context2.next = 35;
|
|
188
198
|
return _iterator.return();
|
|
189
|
-
case
|
|
190
|
-
_context2.prev =
|
|
199
|
+
case 35:
|
|
200
|
+
_context2.prev = 35;
|
|
191
201
|
if (!_didIteratorError) {
|
|
192
|
-
_context2.next =
|
|
202
|
+
_context2.next = 38;
|
|
193
203
|
break;
|
|
194
204
|
}
|
|
195
205
|
throw _iteratorError;
|
|
196
|
-
case 36:
|
|
197
|
-
return _context2.finish(33);
|
|
198
|
-
case 37:
|
|
199
|
-
return _context2.finish(28);
|
|
200
206
|
case 38:
|
|
207
|
+
return _context2.finish(35);
|
|
208
|
+
case 39:
|
|
209
|
+
return _context2.finish(30);
|
|
210
|
+
case 40:
|
|
211
|
+
(_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
|
|
201
212
|
this.state = {
|
|
202
213
|
status: 'done',
|
|
203
214
|
content: bufferContent
|
|
204
215
|
};
|
|
205
|
-
_context2.next =
|
|
216
|
+
_context2.next = 48;
|
|
206
217
|
break;
|
|
207
|
-
case
|
|
208
|
-
_context2.prev =
|
|
209
|
-
_context2.t1 = _context2["catch"](
|
|
218
|
+
case 44:
|
|
219
|
+
_context2.prev = 44;
|
|
220
|
+
_context2.t1 = _context2["catch"](5);
|
|
221
|
+
(_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
|
|
210
222
|
this.state = {
|
|
211
223
|
status: 'error',
|
|
212
224
|
content: ''
|
|
213
225
|
};
|
|
214
|
-
case
|
|
226
|
+
case 48:
|
|
215
227
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
216
228
|
try {
|
|
217
229
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -223,11 +235,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
223
235
|
} finally {
|
|
224
236
|
_iterator4.f();
|
|
225
237
|
}
|
|
226
|
-
case
|
|
238
|
+
case 50:
|
|
227
239
|
case "end":
|
|
228
240
|
return _context2.stop();
|
|
229
241
|
}
|
|
230
|
-
}, _callee2, this, [[
|
|
242
|
+
}, _callee2, this, [[5, 44], [13, 26, 30, 40], [31,, 35, 39]]);
|
|
231
243
|
}));
|
|
232
244
|
function summariseUrl() {
|
|
233
245
|
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();
|
package/dist/cjs/state/types.js
CHANGED
|
@@ -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.0"
|
|
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 () {
|
|
@@ -50,8 +50,7 @@ var iconTooltipDescStyles = (0, _primitives.xcss)({
|
|
|
50
50
|
lineHeight: '14px'
|
|
51
51
|
});
|
|
52
52
|
var iconTooltipTriggerStyles = (0, _primitives.xcss)({
|
|
53
|
-
|
|
54
|
-
bottom: 'space.negative.050'
|
|
53
|
+
verticalAlign: 'bottom'
|
|
55
54
|
});
|
|
56
55
|
var AIStateDone = function AIStateDone(_ref) {
|
|
57
56
|
var appearance = _ref.appearance,
|
|
@@ -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.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -47,7 +47,7 @@ var AISummary = function AISummary(_ref) {
|
|
|
47
47
|
return (0, _react2.jsx)(_markdownToJsx.default, {
|
|
48
48
|
"data-testid": testId,
|
|
49
49
|
css: [AISummaryCSS, overrideCss],
|
|
50
|
-
children: showIcon ? "".concat(content, "
|
|
50
|
+
children: showIcon ? "".concat(content, " <Icon />") : content,
|
|
51
51
|
options: {
|
|
52
52
|
forceWrapper: true,
|
|
53
53
|
overrides: {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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) {
|
|
@@ -73,11 +80,14 @@ export class AISummaryService {
|
|
|
73
80
|
bufferContent = chunk.message.message.content;
|
|
74
81
|
}
|
|
75
82
|
}
|
|
83
|
+
(_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 ? void 0 : _this$onSuccess.call(this, id);
|
|
76
84
|
this.state = {
|
|
77
85
|
status: 'done',
|
|
78
86
|
content: bufferContent
|
|
79
87
|
};
|
|
80
88
|
} catch (err) {
|
|
89
|
+
var _this$onError;
|
|
90
|
+
(_this$onError = this.onError) === null || _this$onError === void 0 ? void 0 : _this$onError.call(this, id, 'generic');
|
|
81
91
|
this.state = {
|
|
82
92
|
status: 'error',
|
|
83
93
|
content: ''
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.50.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/es2019/view/FlexibleCard/components/actions/action/action-dropdown-item/types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|