@atlaskit/smart-card 46.5.4 → 46.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/analytics.spec.yaml +34 -0
  3. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +10 -6
  4. package/dist/cjs/state/hooks/use-one-click-chat-spotlight-eligibility/index.js +8 -4
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/InlineCard/common/one-click-chat-spotlight/index.js +10 -5
  7. package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +5 -1
  8. package/dist/cjs/view/LinkUrl/index.js +1 -1
  9. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +6 -1
  10. package/dist/es2019/state/hooks/use-one-click-chat-spotlight-eligibility/index.js +7 -3
  11. package/dist/es2019/utils/analytics/analytics.js +1 -1
  12. package/dist/es2019/view/InlineCard/common/one-click-chat-spotlight/index.js +7 -4
  13. package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +3 -2
  14. package/dist/es2019/view/LinkUrl/index.js +1 -1
  15. package/dist/esm/state/hooks/use-invoke-client-action/index.js +10 -4
  16. package/dist/esm/state/hooks/use-one-click-chat-spotlight-eligibility/index.js +8 -4
  17. package/dist/esm/utils/analytics/analytics.js +1 -1
  18. package/dist/esm/view/InlineCard/common/one-click-chat-spotlight/index.js +10 -5
  19. package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +5 -1
  20. package/dist/esm/view/LinkUrl/index.js +1 -1
  21. package/dist/types/common/analytics/generated/analytics.types.d.ts +13 -1
  22. package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +2 -0
  23. package/dist/types/state/hooks/use-one-click-chat-spotlight-eligibility/index.d.ts +3 -2
  24. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 46.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`77fab8e2466a7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/77fab8e2466a7) -
8
+ Distinguish Spotlight V2 CTA and inline action analytics sources behind
9
+ platform_sl_one_click_chat_spotlight_v2_fg.
10
+
3
11
  ## 46.5.4
4
12
 
5
13
  ### Patch Changes
@@ -172,6 +172,33 @@ attributes:
172
172
  type: string
173
173
  description: Type of resource the link is pointing to
174
174
  events:
175
+ - oneClickChatSpotlight clicked (oneClickChatSpotlightV2):
176
+ type: ui
177
+ description:
178
+ Fired once when the spotlight CTA or highlighted inline action is clicked while the
179
+ spotlight is open
180
+ attributes:
181
+ provider:
182
+ type: ['google-drive', 'github']
183
+ description: Provider of the highlighted Smart Link
184
+ product:
185
+ type: ['confluence_web', 'jira_web']
186
+ description: Host product showing the spotlight
187
+ appearance:
188
+ type: ['inline']
189
+ description: Smart Link appearance
190
+ cohort:
191
+ type: ['treatment']
192
+ description: Experiment cohort showing the spotlight
193
+ variant:
194
+ type: ['v2']
195
+ description: Spotlight version
196
+ interactionSource:
197
+ type: ['spotlightCta', 'inlineAction']
198
+ required: false
199
+ description:
200
+ spotlightCta identifies the spotlight CTA (currently See takeaways); inlineAction
201
+ identifies the highlighted inline action. Absent on older clients.
175
202
  - button clicked (copyLink):
176
203
  type: ui
177
204
  description: Fired when an copy link is clicked
@@ -211,6 +238,13 @@ events:
211
238
  required: false
212
239
  type: string
213
240
  description: Key for RovoChat prompts
241
+ interactionSource:
242
+ required: false
243
+ type: ['spotlightCta', 'inlineAction']
244
+ description:
245
+ Origin of the gated inline Rovo invocation. spotlightCta identifies the spotlight CTA
246
+ (currently See takeaways); inlineAction identifies Summarize or Explain, whether or not
247
+ a spotlight is visible. Absent for older clients, gate-off and other surfaces.
214
248
 
215
249
  - button clicked (copySummary):
216
250
  type: ui
@@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
11
  var _react = require("react");
11
12
  var _uuid = require("uuid");
13
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
12
14
  var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-analytics-events");
13
15
  var _getMeasure3 = require("../../../utils/get-measure");
14
16
  var _mark = require("../../../utils/mark");
15
17
  var _failUfoExperience = require("../../analytics/failUfoExperience");
16
18
  var _startUfoExperience = require("../../analytics/startUfoExperience");
17
19
  var _succeedUfoExperience = require("../../analytics/succeedUfoExperience");
18
- // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
19
-
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
20
22
  var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
21
23
 
22
24
  /**
@@ -29,11 +31,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
29
31
  var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
30
32
  return (0, _react.useCallback)( /*#__PURE__*/function () {
31
33
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
32
- var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _getMeasure$duration, _getMeasure, result, _getMeasure$duration2, _getMeasure2, reason, _t;
34
+ var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, interactionSource, _ref2$resourceType, resourceType, experienceId, markName, _getMeasure$duration, _getMeasure, result, _getMeasure$duration2, _getMeasure2, reason, _t;
33
35
  return _regenerator.default.wrap(function (_context) {
34
36
  while (1) switch (_context.prev = _context.next) {
35
37
  case 0:
36
- actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
38
+ actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, interactionSource = _ref2.interactionSource, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
37
39
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
38
40
  experienceId = (0, _uuid.v4)(); // Begin performance instrumentation.
39
41
  markName = "".concat(experienceId, "-").concat(actionType);
@@ -49,14 +51,16 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
49
51
 
50
52
  // Begin analytics instrumentation.
51
53
  if (actionSubjectId !== undefined) {
52
- fireEvent("ui.button.clicked.".concat(actionSubjectId), {
54
+ fireEvent("ui.button.clicked.".concat(actionSubjectId), _objectSpread({
53
55
  actionType: actionType !== null && actionType !== void 0 ? actionType : null,
54
56
  definitionId: definitionId,
55
57
  display: display !== null && display !== void 0 ? display : null,
56
58
  id: id !== null && id !== void 0 ? id : experienceId,
57
59
  resourceType: resourceType,
58
60
  prompt: prompt
59
- });
61
+ }, (0, _fg.fg)('platform_sl_one_click_chat_spotlight_v2_fg') && actionSubjectId === 'rovoChatPrompt' && interactionSource ? {
62
+ interactionSource: interactionSource
63
+ } : {}));
60
64
  }
61
65
  // Invoke action
62
66
  _context.next = 2;
@@ -150,7 +150,7 @@ function useOneClickChatSpotlightEligibility(_ref) {
150
150
  shown.current = true;
151
151
  interaction.current('impression');
152
152
  }, [eligibility.isEligible, suppression]);
153
- var finish = (0, _react.useCallback)(function (kind) {
153
+ var finish = (0, _react.useCallback)(function (kind, source) {
154
154
  if (!shown.current || ended.current) {
155
155
  return false;
156
156
  }
@@ -158,7 +158,11 @@ function useOneClickChatSpotlightEligibility(_ref) {
158
158
  if (kind === 'dismissed') {
159
159
  suppression === null || suppression === void 0 || suppression.dismiss(Date.now());
160
160
  }
161
- interaction.current(kind);
161
+ if (source) {
162
+ interaction.current(kind, source);
163
+ } else {
164
+ interaction.current(kind);
165
+ }
162
166
  (0, _suppression.releaseSpotlight)(owner.current);
163
167
  setEligibility({
164
168
  isEligible: false,
@@ -166,8 +170,8 @@ function useOneClickChatSpotlightEligibility(_ref) {
166
170
  });
167
171
  return true;
168
172
  }, [suppression]);
169
- var onClick = (0, _react.useCallback)(function () {
170
- return finish('clicked');
173
+ var onClick = (0, _react.useCallback)(function (source) {
174
+ return finish('clicked', source);
171
175
  }, [finish]);
172
176
  var onDismiss = (0, _react.useCallback)(function () {
173
177
  finish('dismissed');
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
25
25
  var context = exports.context = {
26
26
  componentName: 'smart-cards',
27
27
  packageName: "@atlaskit/smart-card" || '',
28
- packageVersion: "46.5.3" || ''
28
+ packageVersion: "46.5.4" || ''
29
29
  };
30
30
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
31
31
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.OneClickChatSpotlight = OneClickChatSpotlight;
10
10
  require("./index.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -30,6 +31,8 @@ var _useRovoConfig2 = _interopRequireDefault(require("../../../../state/hooks/us
30
31
  var _store = require("../../../../state/store");
31
32
  var _excluded = ["children", "style", "shouldFitViewport", "shouldRenderToParent", "shouldFitContainer", "appearance", "xcss", "isReferenceHidden"];
32
33
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
34
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
36
  var messages = (0, _reactIntl.defineMessages)({
34
37
  heading: {
35
38
  id: 'smart-card.one-click-chat-spotlight-v2.heading.ai-non-final',
@@ -192,19 +195,21 @@ function OneClickChatSpotlight(_ref3) {
192
195
  product = _useRovoConfig.product;
193
196
  var card = (0, _store.useSmartCardState)(url !== null && url !== void 0 ? url : '');
194
197
  var provider = (0, _getExtensionKey.getExtensionKey)(card.details);
195
- var onInteraction = (0, _react.useCallback)(function (interaction) {
198
+ var onInteraction = (0, _react.useCallback)(function (interaction, interactionSource) {
196
199
  createAnalyticsEvent({
197
200
  eventType: interaction === 'impression' ? 'track' : 'ui',
198
201
  action: interaction === 'impression' ? 'viewed' : interaction,
199
202
  actionSubject: 'oneClickChatSpotlight',
200
203
  actionSubjectId: 'oneClickChatSpotlightV2',
201
- attributes: {
204
+ attributes: _objectSpread({
202
205
  provider: provider === 'google-object-provider' ? 'google-drive' : 'github',
203
206
  product: product === 'CONFLUENCE' ? 'confluence_web' : 'jira_web',
204
207
  appearance: 'inline',
205
208
  cohort: 'treatment',
206
209
  variant: 'v2'
207
- }
210
+ }, interactionSource ? {
211
+ interactionSource: interactionSource
212
+ } : {})
208
213
  }).fire(_constants.EVENT_CHANNEL);
209
214
  }, [createAnalyticsEvent, provider, product]);
210
215
  var spotlight = (0, _useOneClickChatSpotlightEligibility.default)({
@@ -265,7 +270,7 @@ function OneClickChatSpotlight(_ref3) {
265
270
  ref: ref,
266
271
  onClickCapture: function onClickCapture() {
267
272
  if (spotlight.isEligible) {
268
- spotlight.onClick();
273
+ spotlight.onClick('inlineAction');
269
274
  }
270
275
  }
271
276
  }, children);
@@ -278,7 +283,7 @@ function OneClickChatSpotlight(_ref3) {
278
283
  actionLabel: intl.formatMessage(messages.action),
279
284
  onDismiss: spotlight.onDismiss,
280
285
  onAction: function onAction() {
281
- if (spotlight.onClick()) {
286
+ if (spotlight.onClick('spotlightCta')) {
282
287
  onInvoke();
283
288
  }
284
289
  }
@@ -183,8 +183,10 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
183
183
  content = _ref4.content,
184
184
  icon = _ref4.icon;
185
185
  var invokePrompt = (0, _react.useCallback)(function () {
186
+ var interactionSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'inlineAction';
186
187
  if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
187
188
  invoke(_objectSpread(_objectSpread({}, rovoChatAction.invokeAction), {}, {
189
+ interactionSource: interactionSource,
188
190
  actionFn: function () {
189
191
  var _actionFn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
190
192
  return _regenerator.default.wrap(function (_context2) {
@@ -223,6 +225,8 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
223
225
  key: url,
224
226
  url: url,
225
227
  actionOptions: actionOptions,
226
- onInvoke: invokePrompt
228
+ onInvoke: function onInvoke() {
229
+ return invokePrompt('spotlightCta');
230
+ }
227
231
  }, button) : button;
228
232
  };
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
19
19
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
20
20
  var PACKAGE_DATA = {
21
21
  packageName: "@atlaskit/smart-card",
22
- packageVersion: "46.5.3",
22
+ packageVersion: "46.5.4",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
2
2
 
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
4
  import { v4 as uuid } from 'uuid';
5
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
6
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
6
7
  import { getMeasure } from '../../../utils/get-measure';
7
8
  import { mark } from '../../../utils/mark';
@@ -29,6 +30,7 @@ const useInvokeClientAction = ({
29
30
  display,
30
31
  id,
31
32
  prompt,
33
+ interactionSource,
32
34
  resourceType = null
33
35
  }) => {
34
36
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
@@ -55,7 +57,10 @@ const useInvokeClientAction = ({
55
57
  display: display !== null && display !== void 0 ? display : null,
56
58
  id: id !== null && id !== void 0 ? id : experienceId,
57
59
  resourceType,
58
- prompt
60
+ prompt,
61
+ ...(fg('platform_sl_one_click_chat_spotlight_v2_fg') && actionSubjectId === 'rovoChatPrompt' && interactionSource ? {
62
+ interactionSource
63
+ } : {})
59
64
  });
60
65
  }
61
66
  // Invoke action
@@ -126,7 +126,7 @@ export default function useOneClickChatSpotlightEligibility({
126
126
  shown.current = true;
127
127
  interaction.current('impression');
128
128
  }, [eligibility.isEligible, suppression]);
129
- const finish = useCallback(kind => {
129
+ const finish = useCallback((kind, source) => {
130
130
  if (!shown.current || ended.current) {
131
131
  return false;
132
132
  }
@@ -134,7 +134,11 @@ export default function useOneClickChatSpotlightEligibility({
134
134
  if (kind === 'dismissed') {
135
135
  suppression === null || suppression === void 0 ? void 0 : suppression.dismiss(Date.now());
136
136
  }
137
- interaction.current(kind);
137
+ if (source) {
138
+ interaction.current(kind, source);
139
+ } else {
140
+ interaction.current(kind);
141
+ }
138
142
  releaseSpotlight(owner.current);
139
143
  setEligibility({
140
144
  isEligible: false,
@@ -142,7 +146,7 @@ export default function useOneClickChatSpotlightEligibility({
142
146
  });
143
147
  return true;
144
148
  }, [suppression]);
145
- const onClick = useCallback(() => finish('clicked'), [finish]);
149
+ const onClick = useCallback(source => finish('clicked', source), [finish]);
146
150
  const onDismiss = useCallback(() => {
147
151
  finish('dismissed');
148
152
  }, [finish]);
@@ -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: "46.5.3" || ''
7
+ packageVersion: "46.5.4" || ''
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -175,7 +175,7 @@ export function OneClickChatSpotlight({
175
175
  } = useRovoConfig();
176
176
  const card = useSmartCardState(url !== null && url !== void 0 ? url : '');
177
177
  const provider = getExtensionKey(card.details);
178
- const onInteraction = useCallback(interaction => {
178
+ const onInteraction = useCallback((interaction, interactionSource) => {
179
179
  createAnalyticsEvent({
180
180
  eventType: interaction === 'impression' ? 'track' : 'ui',
181
181
  action: interaction === 'impression' ? 'viewed' : interaction,
@@ -186,7 +186,10 @@ export function OneClickChatSpotlight({
186
186
  product: product === 'CONFLUENCE' ? 'confluence_web' : 'jira_web',
187
187
  appearance: 'inline',
188
188
  cohort: 'treatment',
189
- variant: 'v2'
189
+ variant: 'v2',
190
+ ...(interactionSource ? {
191
+ interactionSource
192
+ } : {})
190
193
  }
191
194
  }).fire(EVENT_CHANNEL);
192
195
  }, [createAnalyticsEvent, provider, product]);
@@ -242,7 +245,7 @@ export function OneClickChatSpotlight({
242
245
  ref: ref,
243
246
  onClickCapture: () => {
244
247
  if (spotlight.isEligible) {
245
- spotlight.onClick();
248
+ spotlight.onClick('inlineAction');
246
249
  }
247
250
  }
248
251
  }, children),
@@ -253,7 +256,7 @@ export function OneClickChatSpotlight({
253
256
  actionLabel: intl.formatMessage(messages.action),
254
257
  onDismiss: spotlight.onDismiss,
255
258
  onAction: () => {
256
- if (spotlight.onClick()) {
259
+ if (spotlight.onClick('spotlightCta')) {
257
260
  onInvoke();
258
261
  }
259
262
  }
@@ -157,10 +157,11 @@ const InlineRovoActionButtonWithSpotlight = ({
157
157
  iconSize: 'small',
158
158
  provider: provider === null || provider === void 0 ? void 0 : provider.text
159
159
  }) || {} : {};
160
- const invokePrompt = useCallback(() => {
160
+ const invokePrompt = useCallback((interactionSource = 'inlineAction') => {
161
161
  if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
162
162
  invoke({
163
163
  ...rovoChatAction.invokeAction,
164
+ interactionSource,
164
165
  actionFn: async () => sendPromptMessage(promptData),
165
166
  prompt: promptKey
166
167
  });
@@ -183,6 +184,6 @@ const InlineRovoActionButtonWithSpotlight = ({
183
184
  key: url,
184
185
  url: url,
185
186
  actionOptions: actionOptions,
186
- onInvoke: invokePrompt
187
+ onInvoke: () => invokePrompt('spotlightCta')
187
188
  }, button) : button;
188
189
  };
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "46.5.3",
12
+ packageVersion: "46.5.4",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -1,9 +1,13 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
6
  import { useCallback } from 'react';
4
7
 
5
8
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
6
9
  import { v4 as uuid } from 'uuid';
10
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
11
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
8
12
  import { getMeasure } from '../../../utils/get-measure';
9
13
  import { mark } from '../../../utils/mark';
@@ -22,11 +26,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
22
26
  var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
23
27
  return useCallback( /*#__PURE__*/function () {
24
28
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
25
- var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _getMeasure$duration, _getMeasure, result, _getMeasure$duration2, _getMeasure2, reason, _t;
29
+ var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, interactionSource, _ref2$resourceType, resourceType, experienceId, markName, _getMeasure$duration, _getMeasure, result, _getMeasure$duration2, _getMeasure2, reason, _t;
26
30
  return _regeneratorRuntime.wrap(function (_context) {
27
31
  while (1) switch (_context.prev = _context.next) {
28
32
  case 0:
29
- actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
33
+ actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, interactionSource = _ref2.interactionSource, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
30
34
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
31
35
  experienceId = uuid(); // Begin performance instrumentation.
32
36
  markName = "".concat(experienceId, "-").concat(actionType);
@@ -42,14 +46,16 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
42
46
 
43
47
  // Begin analytics instrumentation.
44
48
  if (actionSubjectId !== undefined) {
45
- fireEvent("ui.button.clicked.".concat(actionSubjectId), {
49
+ fireEvent("ui.button.clicked.".concat(actionSubjectId), _objectSpread({
46
50
  actionType: actionType !== null && actionType !== void 0 ? actionType : null,
47
51
  definitionId: definitionId,
48
52
  display: display !== null && display !== void 0 ? display : null,
49
53
  id: id !== null && id !== void 0 ? id : experienceId,
50
54
  resourceType: resourceType,
51
55
  prompt: prompt
52
- });
56
+ }, fg('platform_sl_one_click_chat_spotlight_v2_fg') && actionSubjectId === 'rovoChatPrompt' && interactionSource ? {
57
+ interactionSource: interactionSource
58
+ } : {}));
53
59
  }
54
60
  // Invoke action
55
61
  _context.next = 2;
@@ -143,7 +143,7 @@ export default function useOneClickChatSpotlightEligibility(_ref) {
143
143
  shown.current = true;
144
144
  interaction.current('impression');
145
145
  }, [eligibility.isEligible, suppression]);
146
- var finish = useCallback(function (kind) {
146
+ var finish = useCallback(function (kind, source) {
147
147
  if (!shown.current || ended.current) {
148
148
  return false;
149
149
  }
@@ -151,7 +151,11 @@ export default function useOneClickChatSpotlightEligibility(_ref) {
151
151
  if (kind === 'dismissed') {
152
152
  suppression === null || suppression === void 0 || suppression.dismiss(Date.now());
153
153
  }
154
- interaction.current(kind);
154
+ if (source) {
155
+ interaction.current(kind, source);
156
+ } else {
157
+ interaction.current(kind);
158
+ }
155
159
  releaseSpotlight(owner.current);
156
160
  setEligibility({
157
161
  isEligible: false,
@@ -159,8 +163,8 @@ export default function useOneClickChatSpotlightEligibility(_ref) {
159
163
  });
160
164
  return true;
161
165
  }, [suppression]);
162
- var onClick = useCallback(function () {
163
- return finish('clicked');
166
+ var onClick = useCallback(function (source) {
167
+ return finish('clicked', source);
164
168
  }, [finish]);
165
169
  var onDismiss = useCallback(function () {
166
170
  finish('dismissed');
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.5.3" || ''
7
+ packageVersion: "46.5.4" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,10 +1,13 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
6
  var _excluded = ["children", "style", "shouldFitViewport", "shouldRenderToParent", "shouldFitContainer", "appearance", "xcss", "isReferenceHidden"];
6
7
  import "./index.compiled.css";
7
8
  import { ax, ix } from "@compiled/react/runtime";
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
11
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useRef, useState } from 'react';
9
12
  import { defineMessages, useIntl } from 'react-intl';
10
13
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
@@ -183,19 +186,21 @@ export function OneClickChatSpotlight(_ref3) {
183
186
  product = _useRovoConfig.product;
184
187
  var card = useSmartCardState(url !== null && url !== void 0 ? url : '');
185
188
  var provider = getExtensionKey(card.details);
186
- var onInteraction = useCallback(function (interaction) {
189
+ var onInteraction = useCallback(function (interaction, interactionSource) {
187
190
  createAnalyticsEvent({
188
191
  eventType: interaction === 'impression' ? 'track' : 'ui',
189
192
  action: interaction === 'impression' ? 'viewed' : interaction,
190
193
  actionSubject: 'oneClickChatSpotlight',
191
194
  actionSubjectId: 'oneClickChatSpotlightV2',
192
- attributes: {
195
+ attributes: _objectSpread({
193
196
  provider: provider === 'google-object-provider' ? 'google-drive' : 'github',
194
197
  product: product === 'CONFLUENCE' ? 'confluence_web' : 'jira_web',
195
198
  appearance: 'inline',
196
199
  cohort: 'treatment',
197
200
  variant: 'v2'
198
- }
201
+ }, interactionSource ? {
202
+ interactionSource: interactionSource
203
+ } : {})
199
204
  }).fire(EVENT_CHANNEL);
200
205
  }, [createAnalyticsEvent, provider, product]);
201
206
  var spotlight = useOneClickChatSpotlightEligibility({
@@ -256,7 +261,7 @@ export function OneClickChatSpotlight(_ref3) {
256
261
  ref: ref,
257
262
  onClickCapture: function onClickCapture() {
258
263
  if (spotlight.isEligible) {
259
- spotlight.onClick();
264
+ spotlight.onClick('inlineAction');
260
265
  }
261
266
  }
262
267
  }, children);
@@ -269,7 +274,7 @@ export function OneClickChatSpotlight(_ref3) {
269
274
  actionLabel: intl.formatMessage(messages.action),
270
275
  onDismiss: spotlight.onDismiss,
271
276
  onAction: function onAction() {
272
- if (spotlight.onClick()) {
277
+ if (spotlight.onClick('spotlightCta')) {
273
278
  onInvoke();
274
279
  }
275
280
  }
@@ -174,8 +174,10 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
174
174
  content = _ref4.content,
175
175
  icon = _ref4.icon;
176
176
  var invokePrompt = useCallback(function () {
177
+ var interactionSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'inlineAction';
177
178
  if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
178
179
  invoke(_objectSpread(_objectSpread({}, rovoChatAction.invokeAction), {}, {
180
+ interactionSource: interactionSource,
179
181
  actionFn: function () {
180
182
  var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
181
183
  return _regeneratorRuntime.wrap(function (_context2) {
@@ -214,6 +216,8 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
214
216
  key: url,
215
217
  url: url,
216
218
  actionOptions: actionOptions,
217
- onInvoke: invokePrompt
219
+ onInvoke: function onInvoke() {
220
+ return invokePrompt('spotlightCta');
221
+ }
218
222
  }, button) : button;
219
223
  };
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  var PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "46.5.3",
15
+ packageVersion: "46.5.4",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::4928ecfae3052d3576f2c17a7af29cc5>>
6
+ * @codegen <<SignedSource::9cd75b85ebe2e335394c0d7f99ba9cb1>>
7
7
  * @codegenCommand afm workspace @atlassian/analytics-tooling analytics:codegen smart-card
8
8
  */
9
9
  export type PackageMetaDataContextType = {
@@ -33,6 +33,14 @@ export type ResolvedContextType = {
33
33
  canBeDatasource?: boolean | null;
34
34
  location?: string | null;
35
35
  };
36
+ export type OneClickChatSpotlightClickedAttributesType = {
37
+ provider: 'google-drive' | 'github';
38
+ product: 'confluence_web' | 'jira_web';
39
+ appearance: 'inline';
40
+ cohort: 'treatment';
41
+ variant: 'v2';
42
+ interactionSource?: 'spotlightCta' | 'inlineAction' | null;
43
+ };
36
44
  export type ButtonClickedCopyLinkAttributesType = {
37
45
  actionType?: string | null;
38
46
  id?: string | null;
@@ -76,6 +84,7 @@ export type ButtonClickedRovoChatPromptAttributesType = {
76
84
  display?: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview' | 'url' | null;
77
85
  resourceType?: string | null;
78
86
  prompt?: string | null;
87
+ interactionSource?: 'spotlightCta' | 'inlineAction' | null;
79
88
  };
80
89
  export type ButtonClickedCopySummaryAttributesType = {};
81
90
  export type SummaryViewedAttributesType = {
@@ -294,6 +303,9 @@ export type SmartLinkClickedSmartlinkClickAnalyticsWorkflowsAttributesType = {
294
303
  isContextMenu?: boolean | null;
295
304
  };
296
305
  export type AnalyticsEventAttributes = {
306
+ /**
307
+ * Fired once when the spotlight CTA or highlighted inline action is clicked while the spotlight is open */
308
+ 'ui.oneClickChatSpotlight.clicked': OneClickChatSpotlightClickedAttributesType;
297
309
  /**
298
310
  * Fired when an copy link is clicked */
299
311
  'ui.button.clicked.copyLink': ButtonClickedCopyLinkAttributesType;
@@ -1,5 +1,6 @@
1
1
  import { type FireEventFunction } from '../../../common/analytics/types';
2
2
  import { type CardInnerAppearance } from '../../../view/Card/types';
3
+ export type RovoInteractionSource = 'spotlightCta' | 'inlineAction';
3
4
  export type UseInvokeClientActionProps = {
4
5
  /**
5
6
  * A function to dispatch analytics events.
@@ -8,6 +9,7 @@ export type UseInvokeClientActionProps = {
8
9
  };
9
10
  export type InvokeClientActionSubjectId = 'copyLink' | 'downloadDocument' | 'invokePreviewScreen' | 'rovoChatPrompt' | 'shortcutGoToLink';
10
11
  type InvokeRovoChatClientActionProps = {
12
+ interactionSource?: RovoInteractionSource;
11
13
  prompt?: string;
12
14
  };
13
15
  export type InvokeClientActionProps = {
@@ -1,8 +1,9 @@
1
1
  import type { CardActionOptions } from '../../../view/Card/types';
2
+ import type { RovoInteractionSource } from '../use-invoke-client-action/types';
2
3
  import { type EligibilityResult } from './evaluate';
3
4
  export type SpotlightInteraction = 'impression' | 'clicked' | 'dismissed';
4
5
  export interface SpotlightEligibility extends EligibilityResult {
5
- onClick: () => boolean;
6
+ onClick: (source?: RovoInteractionSource) => boolean;
6
7
  onDismiss: () => void;
7
8
  onShown: () => void;
8
9
  product?: string;
@@ -11,6 +12,6 @@ export interface SpotlightEligibility extends EligibilityResult {
11
12
  export default function useOneClickChatSpotlightEligibility({ url, actionOptions, isOpportunity, onInteraction, }: {
12
13
  actionOptions?: CardActionOptions;
13
14
  isOpportunity: boolean;
14
- onInteraction: (interaction: SpotlightInteraction) => void;
15
+ onInteraction: (interaction: SpotlightInteraction, source?: RovoInteractionSource) => void;
15
16
  url?: string;
16
17
  }): SpotlightEligibility;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "46.5.4",
3
+ "version": "46.5.5",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"