@atlaskit/rovo-agent-analytics 0.20.0 → 1.0.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 (60) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +44 -29
  3. package/dist/cjs/actions/groups/agent-interactions.js +1 -51
  4. package/dist/cjs/actions/groups/debug.js +1 -42
  5. package/dist/cjs/actions/groups/editing.js +1 -28
  6. package/dist/cjs/actions/groups/tools.js +1 -36
  7. package/dist/cjs/actions/index.js +2 -43
  8. package/dist/cjs/common/types.js +5 -0
  9. package/dist/cjs/create/index.js +29 -13
  10. package/dist/es2019/actions/groups/agent-interactions.js +1 -50
  11. package/dist/es2019/actions/groups/debug.js +0 -37
  12. package/dist/es2019/actions/groups/editing.js +1 -27
  13. package/dist/es2019/actions/groups/tools.js +1 -37
  14. package/dist/es2019/actions/index.js +1 -47
  15. package/dist/es2019/common/types.js +5 -0
  16. package/dist/es2019/create/index.js +23 -11
  17. package/dist/esm/actions/groups/agent-interactions.js +1 -50
  18. package/dist/esm/actions/groups/debug.js +0 -37
  19. package/dist/esm/actions/groups/editing.js +1 -27
  20. package/dist/esm/actions/groups/tools.js +1 -37
  21. package/dist/esm/actions/index.js +1 -43
  22. package/dist/esm/common/types.js +5 -0
  23. package/dist/esm/create/index.js +24 -9
  24. package/dist/types/actions/groups/agent-interactions.d.ts +0 -26
  25. package/dist/types/actions/groups/debug.d.ts +0 -21
  26. package/dist/types/actions/groups/editing.d.ts +0 -13
  27. package/dist/types/actions/groups/tools.d.ts +0 -29
  28. package/dist/types/actions/index.d.ts +1 -20
  29. package/dist/types/common/types.d.ts +17 -5
  30. package/dist/types/create/index.d.ts +20 -17
  31. package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +0 -26
  32. package/dist/types-ts4.5/actions/groups/debug.d.ts +0 -21
  33. package/dist/types-ts4.5/actions/groups/editing.d.ts +0 -13
  34. package/dist/types-ts4.5/actions/groups/tools.d.ts +0 -29
  35. package/dist/types-ts4.5/actions/index.d.ts +1 -20
  36. package/dist/types-ts4.5/common/types.d.ts +17 -5
  37. package/dist/types-ts4.5/create/index.d.ts +20 -17
  38. package/package.json +1 -1
  39. package/actions/add-tools-prompt/package.json +0 -17
  40. package/actions/agent-interactions/package.json +0 -17
  41. package/actions/create-flow/package.json +0 -17
  42. package/actions/debug/package.json +0 -17
  43. package/actions/editing/package.json +0 -17
  44. package/actions/evaluation/package.json +0 -17
  45. package/actions/tool-actions/package.json +0 -17
  46. package/dist/cjs/actions/groups/add-tools-prompt.js +0 -43
  47. package/dist/cjs/actions/groups/create-flow.js +0 -51
  48. package/dist/cjs/actions/registry.js +0 -26
  49. package/dist/es2019/actions/groups/add-tools-prompt.js +0 -37
  50. package/dist/es2019/actions/groups/create-flow.js +0 -45
  51. package/dist/es2019/actions/registry.js +0 -20
  52. package/dist/esm/actions/groups/add-tools-prompt.js +0 -37
  53. package/dist/esm/actions/groups/create-flow.js +0 -45
  54. package/dist/esm/actions/registry.js +0 -20
  55. package/dist/types/actions/groups/add-tools-prompt.d.ts +0 -39
  56. package/dist/types/actions/groups/create-flow.d.ts +0 -65
  57. package/dist/types/actions/registry.d.ts +0 -23
  58. package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +0 -39
  59. package/dist/types-ts4.5/actions/groups/create-flow.d.ts +0 -65
  60. package/dist/types-ts4.5/actions/registry.d.ts +0 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/rovo-agent-analytics
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`e4034958fc116`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4034958fc116) -
8
+ Adjust event tracking for agent analytics to use new trackAgentEvent() method. Remove deprecated
9
+ trackAgentAction() export and exported action const enums
10
+
3
11
  ## 0.20.0
4
12
 
5
13
  ### Minor Changes
package/README.md CHANGED
@@ -6,6 +6,18 @@ Rovo Agents analytics library for composing and sending typed analytics events.
6
6
 
7
7
  ```typescript
8
8
  import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
9
+
10
+ const { trackAgentEvent } = useRovoAgentActionAnalytics({});
11
+
12
+ // Full control over event properties — all fields are type-checked
13
+ trackAgentEvent({
14
+ action: 'view',
15
+ actionSubject: 'rovoAgent',
16
+ attributes: {
17
+ agentId: 'agent-123',
18
+ touchPoint: 'browse-agent-list',
19
+ },
20
+ });
9
21
  ```
10
22
 
11
23
  Detailed docs and example usage can be found
@@ -13,27 +25,27 @@ Detailed docs and example usage can be found
13
25
 
14
26
  ## Examples
15
27
 
16
- ### Basic usage with `trackAgentAction()` (deprecated)
28
+ ### Basic Event Tracking
17
29
 
18
- For simple actions with default `actionSubject: 'rovoAgent'`:
30
+ For fully-typed events with explicit `action`, `actionSubject`, and `attributes`:
19
31
 
20
32
  ```typescript
21
- import { useRovoAgentActionAnalytics, AgentCommonActions } from '@atlaskit/rovo-agent-analytics';
33
+ import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
22
34
 
23
- const { trackAgentAction } = useRovoAgentActionAnalytics({
24
- agentId,
25
- touchPoint: 'browse-agent-list',
35
+ const { trackAgentEvent } = useRovoAgentActionAnalytics({
36
+ agentId,
37
+ touchPoint: 'browse-agent-list',
26
38
  });
27
39
 
28
- // No additional attributes needed - agentId and touchPoint already provided
29
- trackAgentAction(AgentCommonActions.DUPLICATE, {});
40
+ // Track a user interaction
41
+ trackAgentEvent({
42
+ action: 'duplicate',
43
+ actionSubject: 'rovoAgent',
44
+ attributes: {},
45
+ });
30
46
  ```
31
47
 
32
- > **Note:** `trackAgentAction()` is deprecated. Prefer `trackAgentEvent()` for new code.
33
-
34
- ### Full Event Tracking with `trackAgentEvent()` (recommended)
35
-
36
- For fully-typed events with explicit `action`, `actionSubject`, and `attributes`:
48
+ ### Event Tracking with Custom Attributes
37
49
 
38
50
  ```typescript
39
51
  import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
@@ -52,15 +64,6 @@ trackAgentEvent({
52
64
  });
53
65
  ```
54
66
 
55
- ### When to use `trackAgentEvent()` vs `trackAgentAction()`
56
-
57
- | Use Case | Function |
58
- | --- | --- |
59
- | New code (recommended) | `trackAgentEvent()` |
60
- | Events with custom `actionSubject` | `trackAgentEvent()` |
61
- | Events with `source`, `objectType`, `objectId`, etc. | `trackAgentEvent()` |
62
- | Legacy code with default `actionSubject: 'rovoAgent'` | `trackAgentAction()` (deprecated) |
63
-
64
67
  ## Payload Types
65
68
 
66
69
  Each group file in `src/actions/groups/` exports a **discriminated union payload type** that defines all valid event shapes for that group.
@@ -148,13 +151,25 @@ For actions that need additional attributes:
148
151
  }
149
152
  ```
150
153
 
151
- ## Backwards Compatibility
154
+ ## Entry Points
155
+
156
+ | Entry Point | Description |
157
+ | --- | --- |
158
+ | `@atlaskit/rovo-agent-analytics/actions` | Main entry point — exports `useRovoAgentActionAnalytics` hook |
159
+ | `@atlaskit/rovo-agent-analytics/create` | Create agent flow analytics — exports `useRovoAgentCreateAnalytics` hook and `AgentCreateAction` type |
160
+
161
+ ### Create Flow Analytics
162
+
163
+ The `useRovoAgentCreateAnalytics` hook is used for tracking the agent creation funnel:
152
164
 
153
- The following exports are **deprecated** but still available for existing consumers:
165
+ ```typescript
166
+ import { useRovoAgentCreateAnalytics } from '@atlaskit/rovo-agent-analytics/create';
154
167
 
155
- - `trackAgentAction()` use `trackAgentEvent()` instead
156
- - `trackAgentActionError()` — use `trackAgentEvent()` instead
157
- - Enum exports (e.g. `AgentEditingActions`, `AgentEvalActions`) — use string literals instead
158
- - `ActionAttributes` type — use `EventPayload` instead
168
+ const [csid, { trackCreateSession, trackCreateSessionStart }] = useRovoAgentCreateAnalytics({
169
+ touchPoint: 'agent-studio',
170
+ });
159
171
 
160
- These will be removed in a future major version.
172
+ // Track funnel steps using string literal actions
173
+ trackCreateSession('createFlowStart');
174
+ trackCreateSession('createFlowActivate', { agentType: 'custom' });
175
+ ```
@@ -2,54 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
6
- exports.AgentInteractionActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: agentInteractions
9
- *
10
- * User-initiated interactions with an agent — typically from the overflow menu ("...")
11
- * or agent profile surfaces (viewing, editing, deleting, duplicating, starring, sharing, verifying).
12
- *
13
- * NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
14
- *
15
- * ## Adding a new action
16
- * 1. Add a new variant to the `AgentInteractionsEventPayload` union type below with a data-portal link
17
- * 2. If this action doesn't fit user interactions, create a new group file instead
18
- * (see other files in this directory for the template)
19
- */
20
-
21
- /**
22
- * Discriminated union payload type for agent interaction events.
23
- * Use with `trackAgentEvent()`.
24
- */
25
-
26
- // ============================================================================
27
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
28
- // ============================================================================
29
-
30
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
31
- var ACTION_GROUP = exports.ACTION_GROUP = 'agentInteractions';
32
-
33
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
34
- var AgentInteractionActions = exports.AgentInteractionActions = /*#__PURE__*/function (AgentInteractionActions) {
35
- /* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
36
- AgentInteractionActions["VIEW"] = "view";
37
- /* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
38
- AgentInteractionActions["EDIT"] = "edit";
39
- /* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
40
- AgentInteractionActions["COPY_LINK"] = "copyLink";
41
- /* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
42
- AgentInteractionActions["DELETE"] = "delete";
43
- /* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
44
- AgentInteractionActions["DUPLICATE"] = "duplicate";
45
- /* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
46
- AgentInteractionActions["STAR"] = "star";
47
- /* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
48
- AgentInteractionActions["CHAT"] = "chat";
49
- /* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
50
- AgentInteractionActions["VERIFY"] = "verify";
51
- /* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
52
- AgentInteractionActions["UNVERIFY"] = "unverify";
53
- return AgentInteractionActions;
54
- }({});
55
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
5
+ });
@@ -1,42 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AgentDebugActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: debug
9
- *
10
- * Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
11
- *
12
- * ## Adding a new action
13
- * 1. Add a new variant to the `DebugEventPayload` union type below with a data-portal link
14
- * 2. If this action doesn't fit this group, consider creating a new group file instead
15
- * (see other files in this directory for the template)
16
- */
17
-
18
- /**
19
- * Discriminated union payload type for debug events.
20
- * Use with `trackAgentEvent()`.
21
- */
22
-
23
- // ============================================================================
24
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
25
- // ============================================================================
26
-
27
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
28
- var ACTION_GROUP = exports.ACTION_GROUP = 'debug';
29
-
30
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
31
- var AgentDebugActions = exports.AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
32
- /* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
33
- AgentDebugActions["VIEW"] = "debugView";
34
- /* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
35
- AgentDebugActions["COPY_ALL"] = "debugCopyAll";
36
- /* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
37
- AgentDebugActions["COPY"] = "debugCopy";
38
- /* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
39
- AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
40
- return AgentDebugActions;
41
- }({});
42
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
1
+ "use strict";
@@ -2,31 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
6
- exports.AgentEditingActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: editing
9
- *
10
- * Agent editing/mutation events — fired when an agent's configuration is saved or modified.
11
- * Unlike agentInteractions (user clicks), these track actual data changes.
12
- *
13
- * ## Adding a new action
14
- * 1. Add a new variant to the `EditingEventPayload` union type below with a data-portal link
15
- * 2. If this action doesn't fit editing/mutation events, create a new group file instead
16
- * (see other files in this directory for the template)
17
- */
18
-
19
- // ============================================================================
20
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
21
- // ============================================================================
22
-
23
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
24
- var ACTION_GROUP = exports.ACTION_GROUP = 'editing';
25
-
26
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
27
- var AgentEditingActions = exports.AgentEditingActions = /*#__PURE__*/function (AgentEditingActions) {
28
- /* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
29
- AgentEditingActions["UPDATED"] = "updated";
30
- return AgentEditingActions;
31
- }({});
32
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
5
+ });
@@ -2,39 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
6
- exports.AgentToolActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: tools
9
- *
10
- * Actions related to agent tool execution during chat
11
- * (confirming, streaming, viewing results, errors).
12
- *
13
- * ## Adding a new action
14
- * 1. Add a new variant to the `ToolsEventPayload` union type below with a data-portal link
15
- * 2. If this action doesn't fit this group, consider creating a new group file instead
16
- * (see other files in this directory for the template)
17
- */
18
-
19
- // ============================================================================
20
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
21
- // ============================================================================
22
-
23
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
24
- var ACTION_GROUP = exports.ACTION_GROUP = 'tools';
25
-
26
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
27
- var AgentToolActions = exports.AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
28
- /* 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 */
29
- AgentToolActions["TOOLS_EXECUTION_CONFIRMED"] = "toolsExecutionConfirmed";
30
- /* When tools execution result is being streamed and user stops the stream e.g. by clicking stop button https://data-portal.internal.atlassian.com/analytics/registry/97750 */
31
- AgentToolActions["TOOLS_EXECUTION_STREAM_STOPPED"] = "toolsExecutionStreamStopped";
32
- /* When tools execution result is done streaming and user sees the result https://data-portal.internal.atlassian.com/analytics/registry/97751*/
33
- AgentToolActions["TOOLS_EXECUTION_RESULT_VIEWED"] = "toolsExecutionResultViewed";
34
- /* When tools execution result streaming fails https://data-portal.internal.atlassian.com/analytics/registry/97752 */
35
- AgentToolActions["TOOLS_EXECUTION_RESULT_ERROR"] = "toolsExecutionResultError";
36
- return AgentToolActions;
37
- }({});
38
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
39
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
40
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
5
+ });
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useRovoAgentActionAnalytics = exports.AgentDebugActions = exports.AgentCommonActions = void 0;
7
+ exports.useRovoAgentActionAnalytics = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = require("react");
@@ -12,19 +12,9 @@ var _analyticsNext = require("@atlaskit/analytics-next");
12
12
  var _constants = require("../common/constants");
13
13
  var _types = require("../common/types");
14
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
15
  var _excluded = ["action", "actionSubject", "attributes"];
20
16
  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
17
  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; }
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;
28
18
  var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
29
19
  var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
30
20
  var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
@@ -41,20 +31,6 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
41
31
  }, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
42
32
  );
43
33
 
44
- /**
45
- * Simple tracking of just action + attributes only.
46
- * Uses default actionSubject ('rovoAgent').
47
- *
48
- * @deprecated Use trackAgentEvent() with typed payloads instead
49
- */
50
- var trackAgentAction = (0, _react.useCallback)(function (action, attributes) {
51
- fireAnalyticsEvent({
52
- actionSubject: _registry.DefaultActionSubject,
53
- action: action,
54
- attributes: attributes
55
- });
56
- }, [fireAnalyticsEvent]);
57
-
58
34
  /**
59
35
  * Fully-typed event tracking using discriminated union payload types.
60
36
  * The payload type enforces correct action, actionSubject, and attributes.
@@ -71,24 +47,7 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
71
47
  attributes: attributes
72
48
  }));
73
49
  }, [fireAnalyticsEvent]);
74
-
75
- /**
76
- * @deprecated Use trackAgentEvent() with typed payloads instead
77
- */
78
- var trackAgentActionError = (0, _react.useCallback)(function (action, error, attributes) {
79
- fireAnalyticsEvent({
80
- actionSubject: 'rovoAgentError',
81
- action: action,
82
- attributes: _objectSpread(_objectSpread({}, attributes), {}, {
83
- error: {
84
- message: error.message
85
- }
86
- })
87
- });
88
- }, [fireAnalyticsEvent]);
89
50
  return {
90
- trackAgentAction: trackAgentAction,
91
- trackAgentEvent: trackAgentEvent,
92
- trackAgentActionError: trackAgentActionError
51
+ trackAgentEvent: trackAgentEvent
93
52
  };
94
53
  };
@@ -7,6 +7,11 @@ exports.LIBRARY_ATTRIBUTE = void 0;
7
7
  /** Common library attribute injected into all events */
8
8
  var LIBRARY_ATTRIBUTE = exports.LIBRARY_ATTRIBUTE = 'agents-analytics';
9
9
 
10
+ /**
11
+ * Generic error event payload type.
12
+ * Use with `trackAgentEvent()` to track error events.
13
+ */
14
+
10
15
  /**
11
16
  * Union of all event payload types.
12
17
  * Use with `trackAgentEvent()` for typed event tracking.
@@ -4,22 +4,37 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useRovoAgentCreateAnalytics = exports.AgentCreateActions = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
7
+ exports.useRovoAgentCreateAnalytics = void 0;
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
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");
15
12
  var _constants = require("../common/constants");
16
13
  var _csid = require("../common/csid");
17
14
  var _utils = require("../common/utils");
18
15
  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; }
19
16
  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; }
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);
17
+ var DefaultActionSubject = 'rovoAgent';
18
+
19
+ /**
20
+ * Union type of all valid create agent flow actions.
21
+ * Includes both CreateFlow and AddToolsPrompt actions.
22
+ *
23
+ * Data portal registry links:
24
+ * - createFlowStart: https://data-portal.internal.atlassian.com/analytics/registry/97089
25
+ * - createFlowSkipNL: https://data-portal.internal.atlassian.com/analytics/registry/97127
26
+ * - createFlowReviewNL: https://data-portal.internal.atlassian.com/analytics/registry/97124
27
+ * - createFlowActivate: https://data-portal.internal.atlassian.com/analytics/registry/97123
28
+ * - createFlowRestart: https://data-portal.internal.atlassian.com/analytics/registry/97131
29
+ * - createFlowError: https://data-portal.internal.atlassian.com/analytics/registry/97132
30
+ * - createLandInStudio: https://data-portal.internal.atlassian.com/analytics/registry/97136
31
+ * - createDiscard: https://data-portal.internal.atlassian.com/analytics/registry/97137
32
+ * - saDraft: https://data-portal.internal.atlassian.com/analytics/registry/97924
33
+ * - addToolsPromptShown: https://data-portal.internal.atlassian.com/analytics/registry/98106
34
+ * - addToolsPromptBrowse: https://data-portal.internal.atlassian.com/analytics/registry/98107
35
+ * - addToolsPromptDismiss: https://data-portal.internal.atlassian.com/analytics/registry/98108
36
+ */
37
+
23
38
  var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
24
39
  var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
25
40
  var _useRovoAgentCSID = (0, _csid.useRovoAgentCSID)(),
@@ -33,6 +48,7 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
33
48
  var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
34
49
  var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
35
50
  var attributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes), {}, {
51
+ actionGroup: 'createFlow',
36
52
  csid: csid,
37
53
  referrer: referrer
38
54
  });
@@ -48,7 +64,7 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
48
64
  */
49
65
  var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
50
66
  fireAnalyticsEvent({
51
- actionSubject: _registry.DefaultActionSubject,
67
+ actionSubject: DefaultActionSubject,
52
68
  action: action,
53
69
  attributes: attributes
54
70
  });
@@ -59,16 +75,16 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
59
75
  */
60
76
  var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
61
77
  fireAnalyticsEvent({
62
- actionSubject: _registry.DefaultActionSubject,
63
- action: _createFlow.CreateFlowActions.START,
78
+ actionSubject: DefaultActionSubject,
79
+ action: 'createFlowStart',
64
80
  attributes: attributes
65
81
  });
66
82
  refreshCSID();
67
83
  }, [fireAnalyticsEvent, refreshCSID]);
68
84
  var trackCreateSessionError = (0, _react.useCallback)(function (error, attributes) {
69
85
  fireAnalyticsEvent({
70
- actionSubject: _registry.DefaultActionSubject,
71
- action: _createFlow.CreateFlowActions.ERROR,
86
+ actionSubject: DefaultActionSubject,
87
+ action: 'createFlowError',
72
88
  attributes: _objectSpread({
73
89
  error: {
74
90
  message: error.message
@@ -1,50 +1 @@
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 */
1
+ export {};
@@ -1,37 +0,0 @@
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 */
@@ -1,27 +1 @@
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 */
1
+ export {};
@@ -1,37 +1 @@
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 */
21
- export let AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
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 */
23
- AgentToolActions["TOOLS_EXECUTION_CONFIRMED"] = "toolsExecutionConfirmed";
24
- /* When tools execution result is being streamed and user stops the stream e.g. by clicking stop button https://data-portal.internal.atlassian.com/analytics/registry/97750 */
25
- AgentToolActions["TOOLS_EXECUTION_STREAM_STOPPED"] = "toolsExecutionStreamStopped";
26
- /* When tools execution result is done streaming and user sees the result https://data-portal.internal.atlassian.com/analytics/registry/97751*/
27
- AgentToolActions["TOOLS_EXECUTION_RESULT_VIEWED"] = "toolsExecutionResultViewed";
28
- /* When tools execution result streaming fails https://data-portal.internal.atlassian.com/analytics/registry/97752 */
29
- AgentToolActions["TOOLS_EXECUTION_RESULT_ERROR"] = "toolsExecutionResultError";
30
- return AgentToolActions;
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
+ export {};