@atlaskit/rovo-agent-analytics 0.20.0 → 1.1.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 +15 -0
  2. package/README.md +44 -29
  3. package/dist/cjs/actions/groups/add-tools-prompt.js +1 -43
  4. package/dist/cjs/actions/groups/agent-interactions.js +1 -51
  5. package/dist/cjs/actions/groups/create-flow.js +1 -51
  6. package/dist/cjs/actions/groups/debug.js +1 -42
  7. package/dist/cjs/actions/groups/editing.js +1 -28
  8. package/dist/cjs/actions/groups/tools.js +1 -36
  9. package/dist/cjs/actions/index.js +2 -43
  10. package/dist/cjs/common/csid/index.js +16 -27
  11. package/dist/cjs/common/types.js +5 -0
  12. package/dist/cjs/create/index.js +36 -25
  13. package/dist/es2019/actions/groups/add-tools-prompt.js +0 -37
  14. package/dist/es2019/actions/groups/agent-interactions.js +1 -50
  15. package/dist/es2019/actions/groups/create-flow.js +0 -45
  16. package/dist/es2019/actions/groups/debug.js +0 -37
  17. package/dist/es2019/actions/groups/editing.js +1 -27
  18. package/dist/es2019/actions/groups/tools.js +1 -37
  19. package/dist/es2019/actions/index.js +1 -47
  20. package/dist/es2019/common/csid/index.js +16 -27
  21. package/dist/es2019/common/types.js +5 -0
  22. package/dist/es2019/create/index.js +32 -22
  23. package/dist/esm/actions/groups/add-tools-prompt.js +0 -37
  24. package/dist/esm/actions/groups/agent-interactions.js +1 -50
  25. package/dist/esm/actions/groups/create-flow.js +0 -45
  26. package/dist/esm/actions/groups/debug.js +0 -37
  27. package/dist/esm/actions/groups/editing.js +1 -27
  28. package/dist/esm/actions/groups/tools.js +1 -37
  29. package/dist/esm/actions/index.js +1 -43
  30. package/dist/esm/common/csid/index.js +17 -28
  31. package/dist/esm/common/types.js +5 -0
  32. package/dist/esm/create/index.js +31 -21
  33. package/dist/types/actions/groups/add-tools-prompt.d.ts +1 -14
  34. package/dist/types/actions/groups/agent-interactions.d.ts +0 -26
  35. package/dist/types/actions/groups/create-flow.d.ts +21 -15
  36. package/dist/types/actions/groups/debug.d.ts +0 -21
  37. package/dist/types/actions/groups/editing.d.ts +0 -13
  38. package/dist/types/actions/groups/tools.d.ts +0 -29
  39. package/dist/types/actions/index.d.ts +1 -20
  40. package/dist/types/common/constants.d.ts +1 -1
  41. package/dist/types/common/csid/index.d.ts +8 -4
  42. package/dist/types/common/types.d.ts +17 -5
  43. package/dist/types/create/index.d.ts +10 -18
  44. package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +1 -14
  45. package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +0 -26
  46. package/dist/types-ts4.5/actions/groups/create-flow.d.ts +21 -15
  47. package/dist/types-ts4.5/actions/groups/debug.d.ts +0 -21
  48. package/dist/types-ts4.5/actions/groups/editing.d.ts +0 -13
  49. package/dist/types-ts4.5/actions/groups/tools.d.ts +0 -29
  50. package/dist/types-ts4.5/actions/index.d.ts +1 -20
  51. package/dist/types-ts4.5/common/constants.d.ts +1 -1
  52. package/dist/types-ts4.5/common/csid/index.d.ts +8 -4
  53. package/dist/types-ts4.5/common/types.d.ts +17 -5
  54. package/dist/types-ts4.5/create/index.d.ts +10 -18
  55. package/package.json +13 -13
  56. package/actions/add-tools-prompt/package.json +0 -17
  57. package/actions/agent-interactions/package.json +0 -17
  58. package/actions/create-flow/package.json +0 -17
  59. package/actions/debug/package.json +0 -17
  60. package/actions/editing/package.json +0 -17
  61. package/actions/evaluation/package.json +0 -17
  62. package/actions/tool-actions/package.json +0 -17
  63. package/dist/cjs/actions/registry.js +0 -26
  64. package/dist/es2019/actions/registry.js +0 -20
  65. package/dist/esm/actions/registry.js +0 -20
  66. package/dist/types/actions/registry.d.ts +0 -23
  67. package/dist/types-ts4.5/actions/registry.d.ts +0 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/rovo-agent-analytics
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`cffd9dae547c3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cffd9dae547c3) -
8
+ Update rovo agents analytics funnel
9
+
10
+ ## 1.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - [`e4034958fc116`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4034958fc116) -
15
+ Adjust event tracking for agent analytics to use new trackAgentEvent() method. Remove deprecated
16
+ trackAgentAction() export and exported action const enums
17
+
3
18
  ## 0.20.0
4
19
 
5
20
  ### 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
+ ```
@@ -1,43 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AddToolsPromptActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: addToolsPrompt
9
- *
10
- * Add tools prompt modal — shown when a user tries to activate/publish an agent that has no tools.
11
- * The user can browse tools or dismiss and proceed without them.
12
- *
13
- * This group is intentionally flow-agnostic so the action values stay stable
14
- * regardless of whether the prompt fires from the create flow or a future publish flow.
15
- *
16
- * ## Adding a new action
17
- * 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
18
- * 2. If this action doesn't fit this group, consider creating a new group file instead
19
- * (see other files in this directory for the template)
20
- */
21
-
22
- /**
23
- * Discriminated union payload type for add tools prompt events.
24
- * Use with `trackAgentEvent()`.
25
- */
26
-
27
- // ============================================================================
28
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
29
- // ============================================================================
30
-
31
- /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
32
- var ACTION_GROUP = exports.ACTION_GROUP = 'addToolsPrompt';
33
-
34
- /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
35
- var AddToolsPromptActions = exports.AddToolsPromptActions = /*#__PURE__*/function (AddToolsPromptActions) {
36
- /* Add tools prompt shown (agent has no tools) - https://data-portal.internal.atlassian.com/analytics/registry/98106 */
37
- AddToolsPromptActions["SHOWN"] = "addToolsPromptShown";
38
- /* User clicked "Browse skills" on the add tools prompt - https://data-portal.internal.atlassian.com/analytics/registry/98107 */
39
- AddToolsPromptActions["BROWSE"] = "addToolsPromptBrowse";
40
- /* User dismissed the add tools prompt ("No thanks") and proceeded anyway - https://data-portal.internal.atlassian.com/analytics/registry/98108 */
41
- AddToolsPromptActions["DISMISS"] = "addToolsPromptDismiss";
42
- return AddToolsPromptActions;
43
- }({});
1
+ "use strict";
@@ -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,51 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CreateFlowActions = exports.ACTION_GROUP = void 0;
7
- /**
8
- * Action Group: createFlow
9
- *
10
- * Create agent funnel steps — from clicking "Create agent" through to activation or discard,
11
- *
12
- * ## Adding a new action
13
- * 1. Add a new variant to the `CreateFlowEventPayload` 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 create flow events.
20
- * Use with `trackAgentEvent()`.
21
- */
22
-
23
- // ============================================================================
24
- // BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
25
- // ============================================================================
26
-
27
- /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
28
- var ACTION_GROUP = exports.ACTION_GROUP = 'createFlow';
29
-
30
- /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
31
- var CreateFlowActions = exports.CreateFlowActions = /*#__PURE__*/function (CreateFlowActions) {
32
- /* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
33
- CreateFlowActions["START"] = "createFlowStart";
34
- /* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
35
- CreateFlowActions["SKIP_NL"] = "createFlowSkipNL";
36
- /* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
37
- CreateFlowActions["REVIEW_NL"] = "createFlowReviewNL";
38
- /* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
39
- CreateFlowActions["ACTIVATE"] = "createFlowActivate";
40
- /* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
41
- CreateFlowActions["RESTART"] = "createFlowRestart";
42
- /* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
43
- CreateFlowActions["ERROR"] = "createFlowError";
44
- /* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
45
- CreateFlowActions["LAND"] = "createLandInStudio";
46
- /* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
47
- CreateFlowActions["DISCARD"] = "createDiscard";
48
- /* Draft created from solution architect plan card - https://data-portal.internal.atlassian.com/analytics/registry/97924 */
49
- CreateFlowActions["SA_DRAFT"] = "saDraft";
50
- return CreateFlowActions;
51
- }({});
1
+ "use strict";
@@ -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
  };
@@ -12,46 +12,35 @@ var CACHED_CSID = null;
12
12
  var generateCSID = function generateCSID() {
13
13
  return crypto.randomUUID();
14
14
  };
15
- var retrieveCSID = function retrieveCSID() {
16
- if (CACHED_CSID) {
17
- return CACHED_CSID;
18
- }
19
- var queryParams = new URLSearchParams(window.location.search);
20
- var querySessionId = queryParams.get(_constants.CSID_QUERY_PARAM);
21
- return querySessionId !== null && querySessionId !== void 0 ? querySessionId : generateCSID();
22
- };
23
15
 
24
16
  /**
25
- * Hook to get Rovo Agent Create Session ID (CSID) from the query parameters or generate a new one if not found.
26
- * @returns Rovo Agent CSID as a string.
17
+ * Hook to manage CSID state for entry point components.
18
+ * The returned csid is used in href attributes and by trackCreateSessionStart.
19
+ * After trackCreateSessionStart fires, it calls refresh() to generate a new CSID
20
+ * for the next session — the component re-renders and the href updates.
27
21
  */
28
22
  var useRovoAgentCSID = exports.useRovoAgentCSID = function useRovoAgentCSID() {
29
- var _useState = (0, _react.useState)(retrieveCSID()),
23
+ var _useState = (0, _react.useState)(CACHED_CSID || generateCSID()),
30
24
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
31
- CSID = _useState2[0],
25
+ csid = _useState2[0],
32
26
  setCSID = _useState2[1];
27
+ var globalCSID = (0, _react.useMemo)(function () {
28
+ var queryParams = new URLSearchParams(window.location.search);
29
+ return queryParams.get(_constants.CSID_QUERY_PARAM);
30
+ }, []);
33
31
  var actions = (0, _react.useMemo)(function () {
34
32
  return {
35
33
  refresh: function refresh() {
36
34
  var newCSID = generateCSID();
37
35
  setCSID(newCSID);
36
+ CACHED_CSID = newCSID;
38
37
  return newCSID;
39
- },
40
- clear: function clear() {
41
- // remove CSID query parameter
42
- var url = new URL(window.location.href);
43
- url.searchParams.delete(_constants.CSID_QUERY_PARAM);
44
- window.history.replaceState({}, '', url.toString());
45
-
46
- // reset state
47
- setCSID(null);
48
- return null;
49
38
  }
50
39
  };
51
40
  }, []);
52
- (0, _react.useEffect)(function () {
53
- // sync cache on state change
54
- CACHED_CSID = CSID;
55
- }, [CSID]);
56
- return [CSID, actions];
41
+ return [{
42
+ csid: csid,
43
+ // generated CSID to be used in href and createFlowStart events
44
+ globalCSID: globalCSID // CSID from the URL query parameter
45
+ }, actions];
57
46
  };
@@ -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.