@atlaskit/smart-card 26.49.3 → 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/analytics.spec.yaml +17 -0
  3. package/dist/cjs/state/analytics/ufoExperiences.js +9 -1
  4. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -34
  5. package/dist/cjs/state/hooks/use-ai-summary/index.js +23 -1
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +2 -1
  8. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +5 -1
  9. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/state/analytics/ufoExperiences.js +9 -1
  12. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +10 -0
  13. package/dist/es2019/state/hooks/use-ai-summary/index.js +24 -2
  14. package/dist/es2019/utils/analytics/analytics.js +1 -1
  15. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +1 -1
  16. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +1 -0
  17. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
  18. package/dist/es2019/view/LinkUrl/index.js +1 -1
  19. package/dist/esm/state/analytics/ufoExperiences.js +9 -1
  20. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +46 -34
  21. package/dist/esm/state/hooks/use-ai-summary/index.js +24 -2
  22. package/dist/esm/utils/analytics/analytics.js +1 -1
  23. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/index.js +2 -1
  24. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.js +1 -0
  25. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +3 -2
  26. package/dist/esm/view/LinkUrl/index.js +1 -1
  27. package/dist/types/common/analytics/generated/analytics.types.d.ts +14 -2
  28. package/dist/types/state/analytics/ufoExperiences.d.ts +1 -1
  29. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +3 -0
  30. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -0
  31. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.d.ts +2 -1
  32. package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
  33. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +14 -2
  34. package/dist/types-ts4.5/state/analytics/ufoExperiences.d.ts +1 -1
  35. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +3 -0
  36. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -0
  37. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-summary-viewed/types.d.ts +2 -1
  38. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 26.49.3
4
14
 
5
15
  ### Patch Changes
@@ -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
- _context2.prev = 4;
129
- _context2.next = 7;
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 7:
141
+ case 9:
132
142
  stream = _context2.sent;
133
143
  bufferContent = '';
134
144
  _iteratorAbruptCompletion = false;
135
145
  _didIteratorError = false;
136
- _context2.prev = 11;
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 = 22;
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 19:
178
+ case 21:
169
179
  _iteratorAbruptCompletion = false;
170
- _context2.next = 13;
171
- break;
172
- case 22:
173
- _context2.next = 28;
180
+ _context2.next = 15;
174
181
  break;
175
182
  case 24:
176
- _context2.prev = 24;
177
- _context2.t0 = _context2["catch"](11);
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 28:
181
- _context2.prev = 28;
182
- _context2.prev = 29;
190
+ case 30:
191
+ _context2.prev = 30;
192
+ _context2.prev = 31;
183
193
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
184
- _context2.next = 33;
194
+ _context2.next = 35;
185
195
  break;
186
196
  }
187
- _context2.next = 33;
197
+ _context2.next = 35;
188
198
  return _iterator.return();
189
- case 33:
190
- _context2.prev = 33;
199
+ case 35:
200
+ _context2.prev = 35;
191
201
  if (!_didIteratorError) {
192
- _context2.next = 36;
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 = 44;
216
+ _context2.next = 48;
206
217
  break;
207
- case 41:
208
- _context2.prev = 41;
209
- _context2.t1 = _context2["catch"](4);
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 44:
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 46:
238
+ case 50:
227
239
  case "end":
228
240
  return _context2.stop();
229
241
  }
230
- }, _callee2, this, [[4, 41], [11, 24, 28, 38], [29,, 33, 37]]);
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();
@@ -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.49.3"
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 () {
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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.49.3",
20
+ packageVersion: "26.50.0",
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) {
@@ -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,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.49.3"
7
+ packageVersion: "26.50.0"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
3
3
  const AIEventSummaryViewed = ({
4
- fromCache
4
+ fromCache = null
5
5
  }) => {
6
6
  const {
7
7
  fireEvent
@@ -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.49.3",
10
+ packageVersion: "26.50.0",
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,7 @@ export var AISummaryService = /*#__PURE__*/function () {
95
102
  _iterator3,
96
103
  _step3,
97
104
  subscriber,
105
+ _this$onError,
98
106
  _iterator4,
99
107
  _step4,
100
108
  _subscriber2,
@@ -118,22 +126,24 @@ export var AISummaryService = /*#__PURE__*/function () {
118
126
  } finally {
119
127
  _iterator2.f();
120
128
  }
121
- _context2.prev = 4;
122
- _context2.next = 7;
129
+ id = uuid();
130
+ _context2.prev = 5;
131
+ (_this$onStart = this.onStart) === null || _this$onStart === void 0 || _this$onStart.call(this, id);
132
+ _context2.next = 9;
123
133
  return this.fetchStream(summaryStyle);
124
- case 7:
134
+ case 9:
125
135
  stream = _context2.sent;
126
136
  bufferContent = '';
127
137
  _iteratorAbruptCompletion = false;
128
138
  _didIteratorError = false;
129
- _context2.prev = 11;
139
+ _context2.prev = 13;
130
140
  _iterator = _asyncIterator(stream);
131
- case 13:
132
- _context2.next = 15;
133
- return _iterator.next();
134
141
  case 15:
142
+ _context2.next = 17;
143
+ return _iterator.next();
144
+ case 17:
135
145
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
136
- _context2.next = 22;
146
+ _context2.next = 24;
137
147
  break;
138
148
  }
139
149
  chunk = _step.value;
@@ -158,53 +168,55 @@ export var AISummaryService = /*#__PURE__*/function () {
158
168
  if (chunk.type === 'FINAL_RESPONSE') {
159
169
  bufferContent = chunk.message.message.content;
160
170
  }
161
- case 19:
171
+ case 21:
162
172
  _iteratorAbruptCompletion = false;
163
- _context2.next = 13;
164
- break;
165
- case 22:
166
- _context2.next = 28;
173
+ _context2.next = 15;
167
174
  break;
168
175
  case 24:
169
- _context2.prev = 24;
170
- _context2.t0 = _context2["catch"](11);
176
+ _context2.next = 30;
177
+ break;
178
+ case 26:
179
+ _context2.prev = 26;
180
+ _context2.t0 = _context2["catch"](13);
171
181
  _didIteratorError = true;
172
182
  _iteratorError = _context2.t0;
173
- case 28:
174
- _context2.prev = 28;
175
- _context2.prev = 29;
183
+ case 30:
184
+ _context2.prev = 30;
185
+ _context2.prev = 31;
176
186
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
177
- _context2.next = 33;
187
+ _context2.next = 35;
178
188
  break;
179
189
  }
180
- _context2.next = 33;
190
+ _context2.next = 35;
181
191
  return _iterator.return();
182
- case 33:
183
- _context2.prev = 33;
192
+ case 35:
193
+ _context2.prev = 35;
184
194
  if (!_didIteratorError) {
185
- _context2.next = 36;
195
+ _context2.next = 38;
186
196
  break;
187
197
  }
188
198
  throw _iteratorError;
189
- case 36:
190
- return _context2.finish(33);
191
- case 37:
192
- return _context2.finish(28);
193
199
  case 38:
200
+ return _context2.finish(35);
201
+ case 39:
202
+ return _context2.finish(30);
203
+ case 40:
204
+ (_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
194
205
  this.state = {
195
206
  status: 'done',
196
207
  content: bufferContent
197
208
  };
198
- _context2.next = 44;
209
+ _context2.next = 48;
199
210
  break;
200
- case 41:
201
- _context2.prev = 41;
202
- _context2.t1 = _context2["catch"](4);
211
+ case 44:
212
+ _context2.prev = 44;
213
+ _context2.t1 = _context2["catch"](5);
214
+ (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
203
215
  this.state = {
204
216
  status: 'error',
205
217
  content: ''
206
218
  };
207
- case 44:
219
+ case 48:
208
220
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
209
221
  try {
210
222
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -216,11 +228,11 @@ export var AISummaryService = /*#__PURE__*/function () {
216
228
  } finally {
217
229
  _iterator4.f();
218
230
  }
219
- case 46:
231
+ case 50:
220
232
  case "end":
221
233
  return _context2.stop();
222
234
  }
223
- }, _callee2, this, [[4, 41], [11, 24, 28, 38], [29,, 33, 37]]);
235
+ }, _callee2, this, [[5, 44], [13, 26, 30, 40], [31,, 35, 39]]);
224
236
  }));
225
237
  function summariseUrl() {
226
238
  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.49.3"
18
+ packageVersion: "26.50.0"
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 () {
@@ -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.49.3",
13
+ packageVersion: "26.50.0",
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::7957a4f104d8499ba8c1d791bc4c61e2>>
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
  };
@@ -1,3 +1,4 @@
1
+ import type { SummaryViewedAttributesType } from '../../../../../../common/analytics/generated/analytics.types';
1
2
  export type AIEventSummaryViewedProps = {
2
- fromCache?: boolean;
3
+ fromCache?: SummaryViewedAttributesType['fromCache'];
3
4
  };
@@ -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::7957a4f104d8499ba8c1d791bc4c61e2>>
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
  };
@@ -1,3 +1,4 @@
1
+ import type { SummaryViewedAttributesType } from '../../../../../../common/analytics/generated/analytics.types';
1
2
  export type AIEventSummaryViewedProps = {
2
- fromCache?: boolean;
3
+ fromCache?: SummaryViewedAttributesType['fromCache'];
3
4
  };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.49.3",
3
+ "version": "26.50.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"