@atlaskit/rovo-agent-analytics 0.18.0 → 0.20.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 (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +103 -58
  3. package/actions/add-tools-prompt/package.json +17 -0
  4. package/actions/agent-interactions/package.json +17 -0
  5. package/actions/create-flow/package.json +17 -0
  6. package/actions/debug/package.json +17 -0
  7. package/actions/editing/package.json +17 -0
  8. package/actions/evaluation/package.json +17 -0
  9. package/actions/tool-actions/package.json +5 -5
  10. package/dist/cjs/actions/groups/add-tools-prompt.js +43 -0
  11. package/dist/cjs/actions/groups/agent-interactions.js +55 -0
  12. package/dist/cjs/actions/groups/create-flow.js +51 -0
  13. package/dist/cjs/actions/groups/debug.js +42 -0
  14. package/dist/cjs/actions/groups/editing.js +32 -0
  15. package/dist/cjs/actions/groups/evaluation.js +1 -0
  16. package/dist/cjs/actions/{tool-actions/index.js → groups/tools.js} +25 -2
  17. package/dist/cjs/actions/index.js +46 -36
  18. package/dist/cjs/actions/registry.js +26 -0
  19. package/dist/cjs/common/types.js +13 -1
  20. package/dist/cjs/create/index.js +12 -33
  21. package/dist/es2019/actions/groups/add-tools-prompt.js +37 -0
  22. package/dist/es2019/actions/groups/agent-interactions.js +50 -0
  23. package/dist/es2019/actions/groups/create-flow.js +45 -0
  24. package/dist/es2019/actions/groups/debug.js +37 -0
  25. package/dist/es2019/actions/groups/editing.js +27 -0
  26. package/dist/es2019/actions/groups/evaluation.js +0 -0
  27. package/dist/es2019/actions/{tool-actions/index.js → groups/tools.js} +27 -1
  28. package/dist/es2019/actions/index.js +48 -35
  29. package/dist/es2019/actions/registry.js +20 -0
  30. package/dist/es2019/common/types.js +7 -0
  31. package/dist/es2019/create/index.js +15 -32
  32. package/dist/esm/actions/groups/add-tools-prompt.js +37 -0
  33. package/dist/esm/actions/groups/agent-interactions.js +50 -0
  34. package/dist/esm/actions/groups/create-flow.js +45 -0
  35. package/dist/esm/actions/groups/debug.js +37 -0
  36. package/dist/esm/actions/groups/editing.js +27 -0
  37. package/dist/esm/actions/groups/evaluation.js +0 -0
  38. package/dist/esm/actions/{tool-actions/index.js → groups/tools.js} +27 -1
  39. package/dist/esm/actions/index.js +47 -36
  40. package/dist/esm/actions/registry.js +20 -0
  41. package/dist/esm/common/types.js +7 -0
  42. package/dist/esm/create/index.js +13 -33
  43. package/dist/types/actions/groups/add-tools-prompt.d.ts +39 -0
  44. package/dist/types/actions/groups/agent-interactions.d.ts +81 -0
  45. package/dist/types/actions/groups/create-flow.d.ts +65 -0
  46. package/dist/types/actions/groups/debug.d.ts +55 -0
  47. package/dist/types/actions/groups/editing.d.ts +33 -0
  48. package/dist/types/actions/groups/evaluation.d.ts +56 -0
  49. package/dist/types/actions/groups/tools.d.ts +69 -0
  50. package/dist/types/actions/index.d.ts +18 -47
  51. package/dist/types/actions/registry.d.ts +23 -0
  52. package/dist/types/common/types.d.ts +14 -0
  53. package/dist/types/create/index.d.ts +17 -15
  54. package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +39 -0
  55. package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +81 -0
  56. package/dist/types-ts4.5/actions/groups/create-flow.d.ts +65 -0
  57. package/dist/types-ts4.5/actions/groups/debug.d.ts +55 -0
  58. package/dist/types-ts4.5/actions/groups/editing.d.ts +33 -0
  59. package/dist/types-ts4.5/actions/groups/evaluation.d.ts +56 -0
  60. package/dist/types-ts4.5/actions/groups/tools.d.ts +69 -0
  61. package/dist/types-ts4.5/actions/index.d.ts +18 -47
  62. package/dist/types-ts4.5/actions/registry.d.ts +23 -0
  63. package/dist/types-ts4.5/common/types.d.ts +14 -0
  64. package/dist/types-ts4.5/create/index.d.ts +17 -15
  65. package/package.json +2 -2
  66. package/dist/types/actions/tool-actions/index.d.ts +0 -18
  67. package/dist/types-ts4.5/actions/tool-actions/index.d.ts +0 -18
@@ -5,47 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useRovoAgentActionAnalytics = exports.AgentDebugActions = exports.AgentCommonActions = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _react = require("react");
10
11
  var _analyticsNext = require("@atlaskit/analytics-next");
11
12
  var _constants = require("../common/constants");
13
+ var _types = require("../common/types");
12
14
  var _utils = require("../common/utils");
15
+ var _agentInteractions = require("./groups/agent-interactions");
16
+ var _debug = require("./groups/debug");
17
+ var _editing = require("./groups/editing");
18
+ var _registry = require("./registry");
19
+ var _excluded = ["action", "actionSubject", "attributes"];
13
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; }
14
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; }
15
- var AgentDebugActions = exports.AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
16
- /* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
17
- AgentDebugActions["VIEW"] = "debugView";
18
- /* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
19
- AgentDebugActions["COPY_ALL"] = "debugCopyAll";
20
- /* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
21
- AgentDebugActions["COPY"] = "debugCopy";
22
- /* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
23
- AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
24
- return AgentDebugActions;
25
- }({});
26
- var AgentCommonActions = exports.AgentCommonActions = /*#__PURE__*/function (AgentCommonActions) {
27
- /* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
28
- AgentCommonActions["VIEW"] = "view";
29
- /* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
30
- AgentCommonActions["EDIT"] = "edit";
31
- /* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
32
- AgentCommonActions["UPDATED"] = "updated";
33
- /* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
34
- AgentCommonActions["COPY_LINK"] = "copyLink";
35
- /* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
36
- AgentCommonActions["DELETE"] = "delete";
37
- /* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
38
- AgentCommonActions["DUPLICATE"] = "duplicate";
39
- /* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
40
- AgentCommonActions["STAR"] = "star";
41
- /* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
42
- AgentCommonActions["CHAT"] = "chat";
43
- /* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
44
- AgentCommonActions["VERIFY"] = "verify";
45
- /* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
46
- AgentCommonActions["UNVERIFY"] = "unverify";
47
- return AgentCommonActions;
48
- }({});
22
+ // Backward-compatible aliases
23
+ // TODO: migrate consumers to use group-specific imports, then remove
24
+ var AgentCommonActions = exports.AgentCommonActions = _objectSpread(_objectSpread({}, _agentInteractions.AgentInteractionActions), _editing.AgentEditingActions);
25
+
26
+ // TODO: Remove the alias, will be breaking change, this is just for backward compatibility
27
+ var AgentDebugActions = exports.AgentDebugActions = _debug.AgentDebugActions;
49
28
  var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
50
29
  var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
51
30
  var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
@@ -53,19 +32,49 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
53
32
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
54
33
  var commonAttributesRef = (0, _react.useRef)(commonAttributes);
55
34
  var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
56
- var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes);
35
+ var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), {}, {
36
+ library: _types.LIBRARY_ATTRIBUTE
37
+ }, event.attributes);
57
38
  createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, globalEventConfig), event), {}, {
58
39
  attributes: attributes
59
40
  })).fire(_constants.ANALYTICS_CHANNEL);
60
41
  }, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
61
42
  );
43
+
44
+ /**
45
+ * Simple tracking of just action + attributes only.
46
+ * Uses default actionSubject ('rovoAgent').
47
+ *
48
+ * @deprecated Use trackAgentEvent() with typed payloads instead
49
+ */
62
50
  var trackAgentAction = (0, _react.useCallback)(function (action, attributes) {
63
51
  fireAnalyticsEvent({
64
- actionSubject: 'rovoAgent',
52
+ actionSubject: _registry.DefaultActionSubject,
65
53
  action: action,
66
54
  attributes: attributes
67
55
  });
68
56
  }, [fireAnalyticsEvent]);
57
+
58
+ /**
59
+ * Fully-typed event tracking using discriminated union payload types.
60
+ * The payload type enforces correct action, actionSubject, and attributes.
61
+ */
62
+ var trackAgentEvent = (0, _react.useCallback)(function (payload) {
63
+ var action = payload.action,
64
+ actionSubject = payload.actionSubject,
65
+ attributes = payload.attributes,
66
+ eventProps = (0, _objectWithoutProperties2.default)(payload, _excluded);
67
+ fireAnalyticsEvent(_objectSpread(_objectSpread({
68
+ actionSubject: actionSubject,
69
+ action: action
70
+ }, eventProps), {}, {
71
+ attributes: attributes
72
+ }));
73
+ }, [fireAnalyticsEvent]);
74
+
75
+ /**
76
+ * @deprecated Use trackAgentEvent() with typed payloads instead
77
+ */
69
78
  var trackAgentActionError = (0, _react.useCallback)(function (action, error, attributes) {
70
79
  fireAnalyticsEvent({
71
80
  actionSubject: 'rovoAgentError',
@@ -79,6 +88,7 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
79
88
  }, [fireAnalyticsEvent]);
80
89
  return {
81
90
  trackAgentAction: trackAgentAction,
91
+ trackAgentEvent: trackAgentEvent,
82
92
  trackAgentActionError: trackAgentActionError
83
93
  };
84
94
  };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultActionSubject = void 0;
7
+ /**
8
+ * Action Registry (Backwards Compatibility)
9
+ *
10
+ * This file contains deprecated exports for backwards compatibility
11
+ * with consumers using `trackAgentAction()`.
12
+ *
13
+ * For new code, use the payload types from each group file directly
14
+ * with `trackAgentEvent()`.
15
+ *
16
+ * @deprecated The registry pattern is deprecated. Use EventPayload from types.ts instead.
17
+ */
18
+
19
+ var DefaultActionSubject = exports.DefaultActionSubject = 'rovoAgent';
20
+
21
+ /**
22
+ * Combined attribute map (union of all groups).
23
+ * Used by the backward-compatible `trackAgentAction` helper.
24
+ *
25
+ * @deprecated Use EventPayload with trackAgentEvent() instead
26
+ */
@@ -1 +1,13 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LIBRARY_ATTRIBUTE = void 0;
7
+ /** Common library attribute injected into all events */
8
+ var LIBRARY_ATTRIBUTE = exports.LIBRARY_ATTRIBUTE = 'agents-analytics';
9
+
10
+ /**
11
+ * Union of all event payload types.
12
+ * Use with `trackAgentEvent()` for typed event tracking.
13
+ */
@@ -5,42 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useRovoAgentCreateAnalytics = exports.AgentCreateActions = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = require("react");
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
+ var _addToolsPrompt = require("../actions/groups/add-tools-prompt");
13
+ var _createFlow = require("../actions/groups/create-flow");
14
+ var _registry = require("../actions/registry");
12
15
  var _constants = require("../common/constants");
13
16
  var _csid = require("../common/csid");
14
17
  var _utils = require("../common/utils");
15
18
  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; }
16
19
  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; }
17
- var AgentCreateActions = exports.AgentCreateActions = /*#__PURE__*/function (AgentCreateActions) {
18
- /* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
19
- AgentCreateActions["START"] = "createFlowStart";
20
- /* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
21
- AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
22
- /* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
23
- AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
24
- /* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
25
- AgentCreateActions["ACTIVATE"] = "createFlowActivate";
26
- /* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
27
- AgentCreateActions["RESTART"] = "createFlowRestart";
28
- /* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
29
- AgentCreateActions["ERROR"] = "createFlowError";
30
- /* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
31
- AgentCreateActions["LAND"] = "createLandInStudio";
32
- /* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
33
- AgentCreateActions["DISCARD"] = "createDiscard";
34
- /* Show no skills modal - https://data-portal.internal.atlassian.com/analytics/registry/97435 */
35
- AgentCreateActions["SHOW_NO_SKILLS_MODAL"] = "showNoSkillsModal";
36
- /* Browse click no skills modal - https://data-portal.internal.atlassian.com/analytics/registry/97436 */
37
- AgentCreateActions["BROWSE_CLICK_NO_SKILLS_MODAL"] = "browseClickNoSkillsModal";
38
- /* Discard no skills modal - https://data-portal.internal.atlassian.com/analytics/registry/97437 */
39
- AgentCreateActions["DISCARD_NO_SKILLS_MODAL"] = "discardNoSkillsModal";
40
- /* Draft created from solution architect plan card - https://data-portal.internal.atlassian.com/analytics/registry/97924 */
41
- AgentCreateActions["SA_DRAFT"] = "saDraft";
42
- return AgentCreateActions;
43
- }({});
20
+ // Backward-compatible alias
21
+ // TODO: migrate consumers to use CreateFlowActions / AddToolsPromptActions directly, then remove
22
+ var AgentCreateActions = exports.AgentCreateActions = _objectSpread(_objectSpread({}, _createFlow.CreateFlowActions), _addToolsPrompt.AddToolsPromptActions);
44
23
  var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
45
24
  var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
46
25
  var _useRovoAgentCSID = (0, _csid.useRovoAgentCSID)(),
@@ -69,7 +48,7 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
69
48
  */
70
49
  var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
71
50
  fireAnalyticsEvent({
72
- actionSubject: 'rovoAgent',
51
+ actionSubject: _registry.DefaultActionSubject,
73
52
  action: action,
74
53
  attributes: attributes
75
54
  });
@@ -80,16 +59,16 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
80
59
  */
81
60
  var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
82
61
  fireAnalyticsEvent({
83
- actionSubject: 'rovoAgent',
84
- action: AgentCreateActions.START,
62
+ actionSubject: _registry.DefaultActionSubject,
63
+ action: _createFlow.CreateFlowActions.START,
85
64
  attributes: attributes
86
65
  });
87
66
  refreshCSID();
88
67
  }, [fireAnalyticsEvent, refreshCSID]);
89
68
  var trackCreateSessionError = (0, _react.useCallback)(function (error, attributes) {
90
69
  fireAnalyticsEvent({
91
- actionSubject: 'rovoAgent',
92
- action: AgentCreateActions.ERROR,
70
+ actionSubject: _registry.DefaultActionSubject,
71
+ action: _createFlow.CreateFlowActions.ERROR,
93
72
  attributes: _objectSpread({
94
73
  error: {
95
74
  message: error.message
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Action Group: addToolsPrompt
3
+ *
4
+ * Add tools prompt modal — shown when a user tries to activate/publish an agent that has no tools.
5
+ * The user can browse tools or dismiss and proceed without them.
6
+ *
7
+ * This group is intentionally flow-agnostic so the action values stay stable
8
+ * regardless of whether the prompt fires from the create flow or a future publish flow.
9
+ *
10
+ * ## Adding a new action
11
+ * 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
12
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
13
+ * (see other files in this directory for the template)
14
+ */
15
+
16
+ /**
17
+ * Discriminated union payload type for add tools prompt events.
18
+ * Use with `trackAgentEvent()`.
19
+ */
20
+
21
+ // ============================================================================
22
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
23
+ // ============================================================================
24
+
25
+ /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
26
+ export const ACTION_GROUP = 'addToolsPrompt';
27
+
28
+ /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
29
+ export let AddToolsPromptActions = /*#__PURE__*/function (AddToolsPromptActions) {
30
+ /* Add tools prompt shown (agent has no tools) - https://data-portal.internal.atlassian.com/analytics/registry/98106 */
31
+ AddToolsPromptActions["SHOWN"] = "addToolsPromptShown";
32
+ /* User clicked "Browse skills" on the add tools prompt - https://data-portal.internal.atlassian.com/analytics/registry/98107 */
33
+ AddToolsPromptActions["BROWSE"] = "addToolsPromptBrowse";
34
+ /* User dismissed the add tools prompt ("No thanks") and proceeded anyway - https://data-portal.internal.atlassian.com/analytics/registry/98108 */
35
+ AddToolsPromptActions["DISMISS"] = "addToolsPromptDismiss";
36
+ return AddToolsPromptActions;
37
+ }({});
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Action Group: agentInteractions
3
+ *
4
+ * User-initiated interactions with an agent — typically from the overflow menu ("...")
5
+ * or agent profile surfaces (viewing, editing, deleting, duplicating, starring, sharing, verifying).
6
+ *
7
+ * NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
8
+ *
9
+ * ## Adding a new action
10
+ * 1. Add a new variant to the `AgentInteractionsEventPayload` union type below with a data-portal link
11
+ * 2. If this action doesn't fit user interactions, create a new group file instead
12
+ * (see other files in this directory for the template)
13
+ */
14
+
15
+ /**
16
+ * Discriminated union payload type for agent interaction events.
17
+ * Use with `trackAgentEvent()`.
18
+ */
19
+
20
+ // ============================================================================
21
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
22
+ // ============================================================================
23
+
24
+ /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
25
+ export const ACTION_GROUP = 'agentInteractions';
26
+
27
+ /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
28
+ export let AgentInteractionActions = /*#__PURE__*/function (AgentInteractionActions) {
29
+ /* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
30
+ AgentInteractionActions["VIEW"] = "view";
31
+ /* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
32
+ AgentInteractionActions["EDIT"] = "edit";
33
+ /* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
34
+ AgentInteractionActions["COPY_LINK"] = "copyLink";
35
+ /* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
36
+ AgentInteractionActions["DELETE"] = "delete";
37
+ /* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
38
+ AgentInteractionActions["DUPLICATE"] = "duplicate";
39
+ /* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
40
+ AgentInteractionActions["STAR"] = "star";
41
+ /* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
42
+ AgentInteractionActions["CHAT"] = "chat";
43
+ /* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
44
+ AgentInteractionActions["VERIFY"] = "verify";
45
+ /* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
46
+ AgentInteractionActions["UNVERIFY"] = "unverify";
47
+ return AgentInteractionActions;
48
+ }({});
49
+
50
+ /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Action Group: createFlow
3
+ *
4
+ * Create agent funnel steps — from clicking "Create agent" through to activation or discard,
5
+ *
6
+ * ## Adding a new action
7
+ * 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
8
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
9
+ * (see other files in this directory for the template)
10
+ */
11
+
12
+ /**
13
+ * Discriminated union payload type for create flow events.
14
+ * Use with `trackAgentEvent()`.
15
+ */
16
+
17
+ // ============================================================================
18
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
19
+ // ============================================================================
20
+
21
+ /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
22
+ export const ACTION_GROUP = 'createFlow';
23
+
24
+ /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
25
+ export let CreateFlowActions = /*#__PURE__*/function (CreateFlowActions) {
26
+ /* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
27
+ CreateFlowActions["START"] = "createFlowStart";
28
+ /* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
29
+ CreateFlowActions["SKIP_NL"] = "createFlowSkipNL";
30
+ /* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
31
+ CreateFlowActions["REVIEW_NL"] = "createFlowReviewNL";
32
+ /* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
33
+ CreateFlowActions["ACTIVATE"] = "createFlowActivate";
34
+ /* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
35
+ CreateFlowActions["RESTART"] = "createFlowRestart";
36
+ /* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
37
+ CreateFlowActions["ERROR"] = "createFlowError";
38
+ /* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
39
+ CreateFlowActions["LAND"] = "createLandInStudio";
40
+ /* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
41
+ CreateFlowActions["DISCARD"] = "createDiscard";
42
+ /* Draft created from solution architect plan card - https://data-portal.internal.atlassian.com/analytics/registry/97924 */
43
+ CreateFlowActions["SA_DRAFT"] = "saDraft";
44
+ return CreateFlowActions;
45
+ }({});
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Action Group: debug
3
+ *
4
+ * Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
5
+ *
6
+ * ## Adding a new action
7
+ * 1. Add a new variant to the `DebugEventPayload` union type below with a data-portal link
8
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
9
+ * (see other files in this directory for the template)
10
+ */
11
+
12
+ /**
13
+ * Discriminated union payload type for debug events.
14
+ * Use with `trackAgentEvent()`.
15
+ */
16
+
17
+ // ============================================================================
18
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
19
+ // ============================================================================
20
+
21
+ /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
22
+ export const ACTION_GROUP = 'debug';
23
+
24
+ /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
25
+ export let AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
26
+ /* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
27
+ AgentDebugActions["VIEW"] = "debugView";
28
+ /* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
29
+ AgentDebugActions["COPY_ALL"] = "debugCopyAll";
30
+ /* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
31
+ AgentDebugActions["COPY"] = "debugCopy";
32
+ /* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
33
+ AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
34
+ return AgentDebugActions;
35
+ }({});
36
+
37
+ /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Action Group: editing
3
+ *
4
+ * Agent editing/mutation events — fired when an agent's configuration is saved or modified.
5
+ * Unlike agentInteractions (user clicks), these track actual data changes.
6
+ *
7
+ * ## Adding a new action
8
+ * 1. Add a new variant to the `EditingEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit editing/mutation events, create a new group file instead
10
+ * (see other files in this directory for the template)
11
+ */
12
+
13
+ // ============================================================================
14
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
15
+ // ============================================================================
16
+
17
+ /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
18
+ export const ACTION_GROUP = 'editing';
19
+
20
+ /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
21
+ export let AgentEditingActions = /*#__PURE__*/function (AgentEditingActions) {
22
+ /* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
23
+ AgentEditingActions["UPDATED"] = "updated";
24
+ return AgentEditingActions;
25
+ }({});
26
+
27
+ /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
File without changes
@@ -1,3 +1,23 @@
1
+ /**
2
+ * Action Group: tools
3
+ *
4
+ * Actions related to agent tool execution during chat
5
+ * (confirming, streaming, viewing results, errors).
6
+ *
7
+ * ## Adding a new action
8
+ * 1. Add a new variant to the `ToolsEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
10
+ * (see other files in this directory for the template)
11
+ */
12
+
13
+ // ============================================================================
14
+ // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
15
+ // ============================================================================
16
+
17
+ /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
18
+ export const ACTION_GROUP = 'tools';
19
+
20
+ /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
1
21
  export let AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
2
22
  /* When chatting with an agent, and tools confirmation being shown, then user click proceed with the possible actions (e.g. confirm, dismiss etc) https://data-portal.internal.atlassian.com/analytics/registry/97675 */
3
23
  AgentToolActions["TOOLS_EXECUTION_CONFIRMED"] = "toolsExecutionConfirmed";
@@ -8,4 +28,10 @@ export let AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
8
28
  /* When tools execution result streaming fails https://data-portal.internal.atlassian.com/analytics/registry/97752 */
9
29
  AgentToolActions["TOOLS_EXECUTION_RESULT_ERROR"] = "toolsExecutionResultError";
10
30
  return AgentToolActions;
11
- }({});
31
+ }({});
32
+
33
+ /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
34
+
35
+ /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
36
+
37
+ /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
@@ -1,41 +1,22 @@
1
1
  import { useCallback, useContext, useRef } from 'react';
2
2
  import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
3
3
  import { ANALYTICS_CHANNEL } from '../common/constants';
4
+ import { LIBRARY_ATTRIBUTE } from '../common/types';
4
5
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
5
- export let AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
6
- /* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
7
- AgentDebugActions["VIEW"] = "debugView";
8
- /* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
9
- AgentDebugActions["COPY_ALL"] = "debugCopyAll";
10
- /* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
11
- AgentDebugActions["COPY"] = "debugCopy";
12
- /* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
13
- AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
14
- return AgentDebugActions;
15
- }({});
16
- export let AgentCommonActions = /*#__PURE__*/function (AgentCommonActions) {
17
- /* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
18
- AgentCommonActions["VIEW"] = "view";
19
- /* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
20
- AgentCommonActions["EDIT"] = "edit";
21
- /* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
22
- AgentCommonActions["UPDATED"] = "updated";
23
- /* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
24
- AgentCommonActions["COPY_LINK"] = "copyLink";
25
- /* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
26
- AgentCommonActions["DELETE"] = "delete";
27
- /* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
28
- AgentCommonActions["DUPLICATE"] = "duplicate";
29
- /* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
30
- AgentCommonActions["STAR"] = "star";
31
- /* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
32
- AgentCommonActions["CHAT"] = "chat";
33
- /* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
34
- AgentCommonActions["VERIFY"] = "verify";
35
- /* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
36
- AgentCommonActions["UNVERIFY"] = "unverify";
37
- return AgentCommonActions;
38
- }({});
6
+ import { AgentInteractionActions } from './groups/agent-interactions';
7
+ import { AgentDebugActions as AgentDebugActionsEnum } from './groups/debug';
8
+ import { AgentEditingActions } from './groups/editing';
9
+ import { DefaultActionSubject } from './registry';
10
+
11
+ // Backward-compatible aliases
12
+ // TODO: migrate consumers to use group-specific imports, then remove
13
+ export const AgentCommonActions = {
14
+ ...AgentInteractionActions,
15
+ ...AgentEditingActions
16
+ };
17
+
18
+ // TODO: Remove the alias, will be breaking change, this is just for backward compatibility
19
+ export const AgentDebugActions = AgentDebugActionsEnum;
39
20
  const globalEventConfig = getDefaultTrackEventConfig();
40
21
  export const useRovoAgentActionAnalytics = commonAttributes => {
41
22
  const analyticsContext = useContext(AnalyticsReactContext);
@@ -47,6 +28,7 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
47
28
  const attributes = {
48
29
  ...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
49
30
  ...commonAttributesRef.current,
31
+ library: LIBRARY_ATTRIBUTE,
50
32
  ...event.attributes
51
33
  };
52
34
  createAnalyticsEvent({
@@ -56,13 +38,43 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
56
38
  }).fire(ANALYTICS_CHANNEL);
57
39
  }, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
58
40
  );
41
+
42
+ /**
43
+ * Simple tracking of just action + attributes only.
44
+ * Uses default actionSubject ('rovoAgent').
45
+ *
46
+ * @deprecated Use trackAgentEvent() with typed payloads instead
47
+ */
59
48
  const trackAgentAction = useCallback((action, attributes) => {
60
49
  fireAnalyticsEvent({
61
- actionSubject: 'rovoAgent',
50
+ actionSubject: DefaultActionSubject,
62
51
  action,
63
52
  attributes
64
53
  });
65
54
  }, [fireAnalyticsEvent]);
55
+
56
+ /**
57
+ * Fully-typed event tracking using discriminated union payload types.
58
+ * The payload type enforces correct action, actionSubject, and attributes.
59
+ */
60
+ const trackAgentEvent = useCallback(payload => {
61
+ const {
62
+ action,
63
+ actionSubject,
64
+ attributes,
65
+ ...eventProps
66
+ } = payload;
67
+ fireAnalyticsEvent({
68
+ actionSubject,
69
+ action,
70
+ ...eventProps,
71
+ attributes
72
+ });
73
+ }, [fireAnalyticsEvent]);
74
+
75
+ /**
76
+ * @deprecated Use trackAgentEvent() with typed payloads instead
77
+ */
66
78
  const trackAgentActionError = useCallback((action, error, attributes) => {
67
79
  fireAnalyticsEvent({
68
80
  actionSubject: 'rovoAgentError',
@@ -77,6 +89,7 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
77
89
  }, [fireAnalyticsEvent]);
78
90
  return {
79
91
  trackAgentAction,
92
+ trackAgentEvent,
80
93
  trackAgentActionError
81
94
  };
82
95
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Action Registry (Backwards Compatibility)
3
+ *
4
+ * This file contains deprecated exports for backwards compatibility
5
+ * with consumers using `trackAgentAction()`.
6
+ *
7
+ * For new code, use the payload types from each group file directly
8
+ * with `trackAgentEvent()`.
9
+ *
10
+ * @deprecated The registry pattern is deprecated. Use EventPayload from types.ts instead.
11
+ */
12
+
13
+ export const DefaultActionSubject = 'rovoAgent';
14
+
15
+ /**
16
+ * Combined attribute map (union of all groups).
17
+ * Used by the backward-compatible `trackAgentAction` helper.
18
+ *
19
+ * @deprecated Use EventPayload with trackAgentEvent() instead
20
+ */
@@ -0,0 +1,7 @@
1
+ /** Common library attribute injected into all events */
2
+ export const LIBRARY_ATTRIBUTE = 'agents-analytics';
3
+
4
+ /**
5
+ * Union of all event payload types.
6
+ * Use with `trackAgentEvent()` for typed event tracking.
7
+ */