@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
@@ -3,20 +3,6 @@ import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-n
3
3
  import { ANALYTICS_CHANNEL } from '../common/constants';
4
4
  import { LIBRARY_ATTRIBUTE } from '../common/types';
5
5
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
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;
20
6
  const globalEventConfig = getDefaultTrackEventConfig();
21
7
  export const useRovoAgentActionAnalytics = commonAttributes => {
22
8
  const analyticsContext = useContext(AnalyticsReactContext);
@@ -39,20 +25,6 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
39
25
  }, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
40
26
  );
41
27
 
42
- /**
43
- * Simple tracking of just action + attributes only.
44
- * Uses default actionSubject ('rovoAgent').
45
- *
46
- * @deprecated Use trackAgentEvent() with typed payloads instead
47
- */
48
- const trackAgentAction = useCallback((action, attributes) => {
49
- fireAnalyticsEvent({
50
- actionSubject: DefaultActionSubject,
51
- action,
52
- attributes
53
- });
54
- }, [fireAnalyticsEvent]);
55
-
56
28
  /**
57
29
  * Fully-typed event tracking using discriminated union payload types.
58
30
  * The payload type enforces correct action, actionSubject, and attributes.
@@ -71,25 +43,7 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
71
43
  attributes
72
44
  });
73
45
  }, [fireAnalyticsEvent]);
74
-
75
- /**
76
- * @deprecated Use trackAgentEvent() with typed payloads instead
77
- */
78
- const trackAgentActionError = useCallback((action, error, attributes) => {
79
- fireAnalyticsEvent({
80
- actionSubject: 'rovoAgentError',
81
- action,
82
- attributes: {
83
- ...attributes,
84
- error: {
85
- message: error.message
86
- }
87
- }
88
- });
89
- }, [fireAnalyticsEvent]);
90
46
  return {
91
- trackAgentAction,
92
- trackAgentEvent,
93
- trackAgentActionError
47
+ trackAgentEvent
94
48
  };
95
49
  };
@@ -1,6 +1,11 @@
1
1
  /** Common library attribute injected into all events */
2
2
  export const LIBRARY_ATTRIBUTE = 'agents-analytics';
3
3
 
4
+ /**
5
+ * Generic error event payload type.
6
+ * Use with `trackAgentEvent()` to track error events.
7
+ */
8
+
4
9
  /**
5
10
  * Union of all event payload types.
6
11
  * Use with `trackAgentEvent()` for typed event tracking.
@@ -1,18 +1,29 @@
1
1
  import { useCallback, useContext, useRef } from 'react';
2
2
  import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { AddToolsPromptActions } from '../actions/groups/add-tools-prompt';
4
- import { CreateFlowActions } from '../actions/groups/create-flow';
5
- import { DefaultActionSubject } from '../actions/registry';
6
3
  import { ANALYTICS_CHANNEL } from '../common/constants';
7
4
  import { useRovoAgentCSID } from '../common/csid';
8
5
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
6
+ const DefaultActionSubject = 'rovoAgent';
7
+
8
+ /**
9
+ * Union type of all valid create agent flow actions.
10
+ * Includes both CreateFlow and AddToolsPrompt actions.
11
+ *
12
+ * Data portal registry links:
13
+ * - createFlowStart: https://data-portal.internal.atlassian.com/analytics/registry/97089
14
+ * - createFlowSkipNL: https://data-portal.internal.atlassian.com/analytics/registry/97127
15
+ * - createFlowReviewNL: https://data-portal.internal.atlassian.com/analytics/registry/97124
16
+ * - createFlowActivate: https://data-portal.internal.atlassian.com/analytics/registry/97123
17
+ * - createFlowRestart: https://data-portal.internal.atlassian.com/analytics/registry/97131
18
+ * - createFlowError: https://data-portal.internal.atlassian.com/analytics/registry/97132
19
+ * - createLandInStudio: https://data-portal.internal.atlassian.com/analytics/registry/97136
20
+ * - createDiscard: https://data-portal.internal.atlassian.com/analytics/registry/97137
21
+ * - saDraft: https://data-portal.internal.atlassian.com/analytics/registry/97924
22
+ * - addToolsPromptShown: https://data-portal.internal.atlassian.com/analytics/registry/98106
23
+ * - addToolsPromptBrowse: https://data-portal.internal.atlassian.com/analytics/registry/98107
24
+ * - addToolsPromptDismiss: https://data-portal.internal.atlassian.com/analytics/registry/98108
25
+ */
9
26
 
10
- // Backward-compatible alias
11
- // TODO: migrate consumers to use CreateFlowActions / AddToolsPromptActions directly, then remove
12
- export const AgentCreateActions = {
13
- ...CreateFlowActions,
14
- ...AddToolsPromptActions
15
- };
16
27
  const globalEventConfig = getDefaultTrackEventConfig();
17
28
  export const useRovoAgentCreateAnalytics = commonAttributes => {
18
29
  const [csid, {
@@ -29,6 +40,7 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
29
40
  ...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
30
41
  ...commonAttributesRef.current,
31
42
  ...event.attributes,
43
+ actionGroup: 'createFlow',
32
44
  csid,
33
45
  referrer
34
46
  };
@@ -58,7 +70,7 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
58
70
  const trackCreateSessionStart = useCallback(attributes => {
59
71
  fireAnalyticsEvent({
60
72
  actionSubject: DefaultActionSubject,
61
- action: CreateFlowActions.START,
73
+ action: 'createFlowStart',
62
74
  attributes
63
75
  });
64
76
  refreshCSID();
@@ -66,7 +78,7 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
66
78
  const trackCreateSessionError = useCallback((error, attributes) => {
67
79
  fireAnalyticsEvent({
68
80
  actionSubject: DefaultActionSubject,
69
- action: CreateFlowActions.ERROR,
81
+ action: 'createFlowError',
70
82
  attributes: {
71
83
  error: {
72
84
  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 var ACTION_GROUP = 'agentInteractions';
26
-
27
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
28
- export var 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 var ACTION_GROUP = 'debug';
23
-
24
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
25
- export var 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 var ACTION_GROUP = 'editing';
19
-
20
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
21
- export var 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 var ACTION_GROUP = 'tools';
19
-
20
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
21
- export var 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 {};
@@ -8,17 +8,6 @@ import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-n
8
8
  import { ANALYTICS_CHANNEL } from '../common/constants';
9
9
  import { LIBRARY_ATTRIBUTE } from '../common/types';
10
10
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
11
- import { AgentInteractionActions } from './groups/agent-interactions';
12
- import { AgentDebugActions as AgentDebugActionsEnum } from './groups/debug';
13
- import { AgentEditingActions } from './groups/editing';
14
- import { DefaultActionSubject } from './registry';
15
-
16
- // Backward-compatible aliases
17
- // TODO: migrate consumers to use group-specific imports, then remove
18
- export var AgentCommonActions = _objectSpread(_objectSpread({}, AgentInteractionActions), AgentEditingActions);
19
-
20
- // TODO: Remove the alias, will be breaking change, this is just for backward compatibility
21
- export var AgentDebugActions = AgentDebugActionsEnum;
22
11
  var globalEventConfig = getDefaultTrackEventConfig();
23
12
  export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
24
13
  var analyticsContext = useContext(AnalyticsReactContext);
@@ -35,20 +24,6 @@ export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(co
35
24
  }, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
36
25
  );
37
26
 
38
- /**
39
- * Simple tracking of just action + attributes only.
40
- * Uses default actionSubject ('rovoAgent').
41
- *
42
- * @deprecated Use trackAgentEvent() with typed payloads instead
43
- */
44
- var trackAgentAction = useCallback(function (action, attributes) {
45
- fireAnalyticsEvent({
46
- actionSubject: DefaultActionSubject,
47
- action: action,
48
- attributes: attributes
49
- });
50
- }, [fireAnalyticsEvent]);
51
-
52
27
  /**
53
28
  * Fully-typed event tracking using discriminated union payload types.
54
29
  * The payload type enforces correct action, actionSubject, and attributes.
@@ -65,24 +40,7 @@ export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(co
65
40
  attributes: attributes
66
41
  }));
67
42
  }, [fireAnalyticsEvent]);
68
-
69
- /**
70
- * @deprecated Use trackAgentEvent() with typed payloads instead
71
- */
72
- var trackAgentActionError = useCallback(function (action, error, attributes) {
73
- fireAnalyticsEvent({
74
- actionSubject: 'rovoAgentError',
75
- action: action,
76
- attributes: _objectSpread(_objectSpread({}, attributes), {}, {
77
- error: {
78
- message: error.message
79
- }
80
- })
81
- });
82
- }, [fireAnalyticsEvent]);
83
43
  return {
84
- trackAgentAction: trackAgentAction,
85
- trackAgentEvent: trackAgentEvent,
86
- trackAgentActionError: trackAgentActionError
44
+ trackAgentEvent: trackAgentEvent
87
45
  };
88
46
  };
@@ -1,6 +1,11 @@
1
1
  /** Common library attribute injected into all events */
2
2
  export var LIBRARY_ATTRIBUTE = 'agents-analytics';
3
3
 
4
+ /**
5
+ * Generic error event payload type.
6
+ * Use with `trackAgentEvent()` to track error events.
7
+ */
8
+
4
9
  /**
5
10
  * Union of all event payload types.
6
11
  * Use with `trackAgentEvent()` for typed event tracking.
@@ -1,19 +1,33 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  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; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { useCallback, useContext, useRef } from 'react';
6
6
  import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
7
- import { AddToolsPromptActions } from '../actions/groups/add-tools-prompt';
8
- import { CreateFlowActions } from '../actions/groups/create-flow';
9
- import { DefaultActionSubject } from '../actions/registry';
10
7
  import { ANALYTICS_CHANNEL } from '../common/constants';
11
8
  import { useRovoAgentCSID } from '../common/csid';
12
9
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
10
+ var DefaultActionSubject = 'rovoAgent';
11
+
12
+ /**
13
+ * Union type of all valid create agent flow actions.
14
+ * Includes both CreateFlow and AddToolsPrompt actions.
15
+ *
16
+ * Data portal registry links:
17
+ * - createFlowStart: https://data-portal.internal.atlassian.com/analytics/registry/97089
18
+ * - createFlowSkipNL: https://data-portal.internal.atlassian.com/analytics/registry/97127
19
+ * - createFlowReviewNL: https://data-portal.internal.atlassian.com/analytics/registry/97124
20
+ * - createFlowActivate: https://data-portal.internal.atlassian.com/analytics/registry/97123
21
+ * - createFlowRestart: https://data-portal.internal.atlassian.com/analytics/registry/97131
22
+ * - createFlowError: https://data-portal.internal.atlassian.com/analytics/registry/97132
23
+ * - createLandInStudio: https://data-portal.internal.atlassian.com/analytics/registry/97136
24
+ * - createDiscard: https://data-portal.internal.atlassian.com/analytics/registry/97137
25
+ * - saDraft: https://data-portal.internal.atlassian.com/analytics/registry/97924
26
+ * - addToolsPromptShown: https://data-portal.internal.atlassian.com/analytics/registry/98106
27
+ * - addToolsPromptBrowse: https://data-portal.internal.atlassian.com/analytics/registry/98107
28
+ * - addToolsPromptDismiss: https://data-portal.internal.atlassian.com/analytics/registry/98108
29
+ */
13
30
 
14
- // Backward-compatible alias
15
- // TODO: migrate consumers to use CreateFlowActions / AddToolsPromptActions directly, then remove
16
- export var AgentCreateActions = _objectSpread(_objectSpread({}, CreateFlowActions), AddToolsPromptActions);
17
31
  var globalEventConfig = getDefaultTrackEventConfig();
18
32
  export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
19
33
  var _useRovoAgentCSID = useRovoAgentCSID(),
@@ -27,6 +41,7 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
27
41
  var fireAnalyticsEvent = useCallback(function (event) {
28
42
  var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
29
43
  var attributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes), {}, {
44
+ actionGroup: 'createFlow',
30
45
  csid: csid,
31
46
  referrer: referrer
32
47
  });
@@ -54,7 +69,7 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
54
69
  var trackCreateSessionStart = useCallback(function (attributes) {
55
70
  fireAnalyticsEvent({
56
71
  actionSubject: DefaultActionSubject,
57
- action: CreateFlowActions.START,
72
+ action: 'createFlowStart',
58
73
  attributes: attributes
59
74
  });
60
75
  refreshCSID();
@@ -62,7 +77,7 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
62
77
  var trackCreateSessionError = useCallback(function (error, attributes) {
63
78
  fireAnalyticsEvent({
64
79
  actionSubject: DefaultActionSubject,
65
- action: CreateFlowActions.ERROR,
80
+ action: 'createFlowError',
66
81
  attributes: _objectSpread({
67
82
  error: {
68
83
  message: error.message
@@ -53,29 +53,3 @@ export type AgentInteractionsEventPayload = {
53
53
  action: 'unverify';
54
54
  attributes: BaseAgentAnalyticsAttributes;
55
55
  };
56
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
57
- export declare const ACTION_GROUP: "agentInteractions";
58
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
59
- export declare enum AgentInteractionActions {
60
- VIEW = "view",
61
- EDIT = "edit",
62
- COPY_LINK = "copyLink",
63
- DELETE = "delete",
64
- DUPLICATE = "duplicate",
65
- STAR = "star",
66
- CHAT = "chat",
67
- VERIFY = "verify",
68
- UNVERIFY = "unverify"
69
- }
70
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
71
- export type AgentInteractionAttributes = {
72
- [AgentInteractionActions.VIEW]: BaseAgentAnalyticsAttributes;
73
- [AgentInteractionActions.EDIT]: BaseAgentAnalyticsAttributes;
74
- [AgentInteractionActions.COPY_LINK]: BaseAgentAnalyticsAttributes;
75
- [AgentInteractionActions.DELETE]: BaseAgentAnalyticsAttributes;
76
- [AgentInteractionActions.DUPLICATE]: BaseAgentAnalyticsAttributes;
77
- [AgentInteractionActions.STAR]: BaseAgentAnalyticsAttributes;
78
- [AgentInteractionActions.CHAT]: BaseAgentAnalyticsAttributes;
79
- [AgentInteractionActions.VERIFY]: BaseAgentAnalyticsAttributes;
80
- [AgentInteractionActions.UNVERIFY]: BaseAgentAnalyticsAttributes;
81
- };
@@ -32,24 +32,3 @@ export type DebugEventPayload = {
32
32
  isExpanded: boolean;
33
33
  };
34
34
  };
35
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
36
- export declare const ACTION_GROUP: "debug";
37
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
38
- export declare enum AgentDebugActions {
39
- VIEW = "debugView",
40
- COPY_ALL = "debugCopyAll",
41
- COPY = "debugCopy",
42
- TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
43
- }
44
- type EmptyAttributes = {};
45
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
46
- export type DebugActionAttributes = {
47
- [AgentDebugActions.COPY_ALL]: EmptyAttributes;
48
- [AgentDebugActions.COPY]: EmptyAttributes;
49
- [AgentDebugActions.TOGGLE_SKILL_INFO]: {
50
- toolId: string;
51
- isExpanded: boolean;
52
- };
53
- [AgentDebugActions.VIEW]: EmptyAttributes;
54
- };
55
- export {};
@@ -18,16 +18,3 @@ export type EditingEventPayload = {
18
18
  field: string;
19
19
  };
20
20
  };
21
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
22
- export declare const ACTION_GROUP: "editing";
23
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
24
- export declare enum AgentEditingActions {
25
- UPDATED = "updated"
26
- }
27
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
28
- export type EditingActionAttributes = {
29
- [AgentEditingActions.UPDATED]: BaseAgentAnalyticsAttributes & {
30
- agentType: string;
31
- field: string;
32
- };
33
- };
@@ -37,33 +37,4 @@ export type ToolsEventPayload = {
37
37
  action: 'toolsExecutionResultError';
38
38
  attributes: ToolsExecutionAttributesBase;
39
39
  };
40
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
41
- export declare const ACTION_GROUP: "tools";
42
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
43
- export declare enum AgentToolActions {
44
- TOOLS_EXECUTION_CONFIRMED = "toolsExecutionConfirmed",
45
- TOOLS_EXECUTION_STREAM_STOPPED = "toolsExecutionStreamStopped",
46
- TOOLS_EXECUTION_RESULT_VIEWED = "toolsExecutionResultViewed",
47
- TOOLS_EXECUTION_RESULT_ERROR = "toolsExecutionResultError"
48
- }
49
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
50
- export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
51
- tools: {
52
- toolId: string;
53
- toolSource: string;
54
- resolutionType: string;
55
- }[];
56
- singleInstrumentationId: string | undefined;
57
- };
58
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
59
- export type ToolsExecutionResultAttributes = ToolsExecutionAttributes & {
60
- scenarioId: string | null | undefined;
61
- };
62
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
63
- export type ToolsActionAttributes = {
64
- [AgentToolActions.TOOLS_EXECUTION_CONFIRMED]: ToolsExecutionAttributes;
65
- [AgentToolActions.TOOLS_EXECUTION_STREAM_STOPPED]: ToolsExecutionAttributes;
66
- [AgentToolActions.TOOLS_EXECUTION_RESULT_VIEWED]: ToolsExecutionResultAttributes;
67
- [AgentToolActions.TOOLS_EXECUTION_RESULT_ERROR]: ToolsExecutionAttributes;
68
- };
69
40
  export {};
@@ -1,23 +1,4 @@
1
- import { type EventPayload, type RemainingRequired } from '../common/types';
2
- import { AgentInteractionActions } from './groups/agent-interactions';
3
- import { AgentDebugActions as AgentDebugActionsEnum } from './groups/debug';
4
- import { AgentEditingActions } from './groups/editing';
5
- import type { ActionAttributes } from './registry';
6
- export declare const AgentCommonActions: {
7
- readonly UPDATED: AgentEditingActions.UPDATED;
8
- readonly VIEW: AgentInteractionActions.VIEW;
9
- readonly EDIT: AgentInteractionActions.EDIT;
10
- readonly COPY_LINK: AgentInteractionActions.COPY_LINK;
11
- readonly DELETE: AgentInteractionActions.DELETE;
12
- readonly DUPLICATE: AgentInteractionActions.DUPLICATE;
13
- readonly STAR: AgentInteractionActions.STAR;
14
- readonly CHAT: AgentInteractionActions.CHAT;
15
- readonly VERIFY: AgentInteractionActions.VERIFY;
16
- readonly UNVERIFY: AgentInteractionActions.UNVERIFY;
17
- };
18
- export declare const AgentDebugActions: typeof AgentDebugActionsEnum;
1
+ import { type EventPayload } from '../common/types';
19
2
  export declare const useRovoAgentActionAnalytics: <T extends {}>(commonAttributes: T) => {
20
- trackAgentAction: <A extends keyof ActionAttributes>(action: A, attributes: RemainingRequired<ActionAttributes[A], T>) => void;
21
3
  trackAgentEvent: (payload: EventPayload) => void;
22
- trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
23
4
  };
@@ -1,19 +1,31 @@
1
- import type { AddToolsPromptEventPayload } from '../actions/groups/add-tools-prompt';
2
1
  import type { AgentInteractionsEventPayload } from '../actions/groups/agent-interactions';
3
- import type { CreateFlowEventPayload } from '../actions/groups/create-flow';
4
2
  import type { DebugEventPayload } from '../actions/groups/debug';
5
3
  import type { EditingEventPayload } from '../actions/groups/editing';
6
4
  import type { EvaluationEventPayload } from '../actions/groups/evaluation';
7
5
  import type { ToolsEventPayload } from '../actions/groups/tools';
8
6
  export type RemainingRequired<T, P extends Partial<T>> = Required<Omit<T, keyof P>>;
9
7
  export type BaseAgentAnalyticsAttributes = {
10
- touchPoint: string;
11
- agentId: string;
8
+ touchPoint?: string;
9
+ agentId?: string;
12
10
  };
13
11
  /** Common library attribute injected into all events */
14
12
  export declare const LIBRARY_ATTRIBUTE: "agents-analytics";
13
+ /**
14
+ * Generic error event payload type.
15
+ * Use with `trackAgentEvent()` to track error events.
16
+ */
17
+ export type ErrorEventPayload = {
18
+ actionSubject: 'rovoAgentError';
19
+ action: string;
20
+ attributes: {
21
+ error: {
22
+ message: string;
23
+ };
24
+ [key: string]: unknown;
25
+ };
26
+ };
15
27
  /**
16
28
  * Union of all event payload types.
17
29
  * Use with `trackAgentEvent()` for typed event tracking.
18
30
  */
19
- export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | CreateFlowEventPayload | AddToolsPromptEventPayload;
31
+ export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | ErrorEventPayload;