@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.
- package/CHANGELOG.md +15 -0
- package/README.md +44 -29
- package/dist/cjs/actions/groups/add-tools-prompt.js +1 -43
- package/dist/cjs/actions/groups/agent-interactions.js +1 -51
- package/dist/cjs/actions/groups/create-flow.js +1 -51
- package/dist/cjs/actions/groups/debug.js +1 -42
- package/dist/cjs/actions/groups/editing.js +1 -28
- package/dist/cjs/actions/groups/tools.js +1 -36
- package/dist/cjs/actions/index.js +2 -43
- package/dist/cjs/common/csid/index.js +16 -27
- package/dist/cjs/common/types.js +5 -0
- package/dist/cjs/create/index.js +36 -25
- package/dist/es2019/actions/groups/add-tools-prompt.js +0 -37
- package/dist/es2019/actions/groups/agent-interactions.js +1 -50
- package/dist/es2019/actions/groups/create-flow.js +0 -45
- package/dist/es2019/actions/groups/debug.js +0 -37
- package/dist/es2019/actions/groups/editing.js +1 -27
- package/dist/es2019/actions/groups/tools.js +1 -37
- package/dist/es2019/actions/index.js +1 -47
- package/dist/es2019/common/csid/index.js +16 -27
- package/dist/es2019/common/types.js +5 -0
- package/dist/es2019/create/index.js +32 -22
- package/dist/esm/actions/groups/add-tools-prompt.js +0 -37
- package/dist/esm/actions/groups/agent-interactions.js +1 -50
- package/dist/esm/actions/groups/create-flow.js +0 -45
- package/dist/esm/actions/groups/debug.js +0 -37
- package/dist/esm/actions/groups/editing.js +1 -27
- package/dist/esm/actions/groups/tools.js +1 -37
- package/dist/esm/actions/index.js +1 -43
- package/dist/esm/common/csid/index.js +17 -28
- package/dist/esm/common/types.js +5 -0
- package/dist/esm/create/index.js +31 -21
- package/dist/types/actions/groups/add-tools-prompt.d.ts +1 -14
- package/dist/types/actions/groups/agent-interactions.d.ts +0 -26
- package/dist/types/actions/groups/create-flow.d.ts +21 -15
- package/dist/types/actions/groups/debug.d.ts +0 -21
- package/dist/types/actions/groups/editing.d.ts +0 -13
- package/dist/types/actions/groups/tools.d.ts +0 -29
- package/dist/types/actions/index.d.ts +1 -20
- package/dist/types/common/constants.d.ts +1 -1
- package/dist/types/common/csid/index.d.ts +8 -4
- package/dist/types/common/types.d.ts +17 -5
- package/dist/types/create/index.d.ts +10 -18
- package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +1 -14
- package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +0 -26
- package/dist/types-ts4.5/actions/groups/create-flow.d.ts +21 -15
- package/dist/types-ts4.5/actions/groups/debug.d.ts +0 -21
- package/dist/types-ts4.5/actions/groups/editing.d.ts +0 -13
- package/dist/types-ts4.5/actions/groups/tools.d.ts +0 -29
- package/dist/types-ts4.5/actions/index.d.ts +1 -20
- package/dist/types-ts4.5/common/constants.d.ts +1 -1
- package/dist/types-ts4.5/common/csid/index.d.ts +8 -4
- package/dist/types-ts4.5/common/types.d.ts +17 -5
- package/dist/types-ts4.5/create/index.d.ts +10 -18
- package/package.json +13 -13
- package/actions/add-tools-prompt/package.json +0 -17
- package/actions/agent-interactions/package.json +0 -17
- package/actions/create-flow/package.json +0 -17
- package/actions/debug/package.json +0 -17
- package/actions/editing/package.json +0 -17
- package/actions/evaluation/package.json +0 -17
- package/actions/tool-actions/package.json +0 -17
- package/dist/cjs/actions/registry.js +0 -26
- package/dist/es2019/actions/registry.js +0 -20
- package/dist/esm/actions/registry.js +0 -20
- package/dist/types/actions/registry.d.ts +0 -23
- package/dist/types-ts4.5/actions/registry.d.ts +0 -23
|
@@ -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,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Group: createFlow
|
|
3
|
-
*
|
|
4
|
-
* Create agent funnel steps — from clicking "Create agent" through to activation or discard,
|
|
5
|
-
*
|
|
6
|
-
* ## Adding a new action
|
|
7
|
-
* 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
|
|
8
|
-
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
9
|
-
* (see other files in this directory for the template)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Discriminated union payload type for create flow events.
|
|
14
|
-
* Use with `trackAgentEvent()`.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
19
|
-
// ============================================================================
|
|
20
|
-
|
|
21
|
-
/** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
|
|
22
|
-
export var ACTION_GROUP = 'createFlow';
|
|
23
|
-
|
|
24
|
-
/** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
|
|
25
|
-
export var CreateFlowActions = /*#__PURE__*/function (CreateFlowActions) {
|
|
26
|
-
/* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
27
|
-
CreateFlowActions["START"] = "createFlowStart";
|
|
28
|
-
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
29
|
-
CreateFlowActions["SKIP_NL"] = "createFlowSkipNL";
|
|
30
|
-
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
31
|
-
CreateFlowActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
32
|
-
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
33
|
-
CreateFlowActions["ACTIVATE"] = "createFlowActivate";
|
|
34
|
-
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
35
|
-
CreateFlowActions["RESTART"] = "createFlowRestart";
|
|
36
|
-
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
37
|
-
CreateFlowActions["ERROR"] = "createFlowError";
|
|
38
|
-
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
39
|
-
CreateFlowActions["LAND"] = "createLandInStudio";
|
|
40
|
-
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
41
|
-
CreateFlowActions["DISCARD"] = "createDiscard";
|
|
42
|
-
/* Draft created from solution architect plan card - https://data-portal.internal.atlassian.com/analytics/registry/97924 */
|
|
43
|
-
CreateFlowActions["SA_DRAFT"] = "saDraft";
|
|
44
|
-
return CreateFlowActions;
|
|
45
|
-
}({});
|
|
@@ -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
|
-
|
|
85
|
-
trackAgentEvent: trackAgentEvent,
|
|
86
|
-
trackAgentActionError: trackAgentActionError
|
|
44
|
+
trackAgentEvent: trackAgentEvent
|
|
87
45
|
};
|
|
88
46
|
};
|
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
3
|
import { CSID_QUERY_PARAM } from '../constants';
|
|
4
4
|
var CACHED_CSID = null;
|
|
5
5
|
var generateCSID = function generateCSID() {
|
|
6
6
|
return crypto.randomUUID();
|
|
7
7
|
};
|
|
8
|
-
var retrieveCSID = function retrieveCSID() {
|
|
9
|
-
if (CACHED_CSID) {
|
|
10
|
-
return CACHED_CSID;
|
|
11
|
-
}
|
|
12
|
-
var queryParams = new URLSearchParams(window.location.search);
|
|
13
|
-
var querySessionId = queryParams.get(CSID_QUERY_PARAM);
|
|
14
|
-
return querySessionId !== null && querySessionId !== void 0 ? querySessionId : generateCSID();
|
|
15
|
-
};
|
|
16
8
|
|
|
17
9
|
/**
|
|
18
|
-
* Hook to
|
|
19
|
-
*
|
|
10
|
+
* Hook to manage CSID state for entry point components.
|
|
11
|
+
* The returned csid is used in href attributes and by trackCreateSessionStart.
|
|
12
|
+
* After trackCreateSessionStart fires, it calls refresh() to generate a new CSID
|
|
13
|
+
* for the next session — the component re-renders and the href updates.
|
|
20
14
|
*/
|
|
21
15
|
export var useRovoAgentCSID = function useRovoAgentCSID() {
|
|
22
|
-
var _useState = useState(
|
|
16
|
+
var _useState = useState(CACHED_CSID || generateCSID()),
|
|
23
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
-
|
|
18
|
+
csid = _useState2[0],
|
|
25
19
|
setCSID = _useState2[1];
|
|
20
|
+
var globalCSID = useMemo(function () {
|
|
21
|
+
var queryParams = new URLSearchParams(window.location.search);
|
|
22
|
+
return queryParams.get(CSID_QUERY_PARAM);
|
|
23
|
+
}, []);
|
|
26
24
|
var actions = useMemo(function () {
|
|
27
25
|
return {
|
|
28
26
|
refresh: function refresh() {
|
|
29
27
|
var newCSID = generateCSID();
|
|
30
28
|
setCSID(newCSID);
|
|
29
|
+
CACHED_CSID = newCSID;
|
|
31
30
|
return newCSID;
|
|
32
|
-
},
|
|
33
|
-
clear: function clear() {
|
|
34
|
-
// remove CSID query parameter
|
|
35
|
-
var url = new URL(window.location.href);
|
|
36
|
-
url.searchParams.delete(CSID_QUERY_PARAM);
|
|
37
|
-
window.history.replaceState({}, '', url.toString());
|
|
38
|
-
|
|
39
|
-
// reset state
|
|
40
|
-
setCSID(null);
|
|
41
|
-
return null;
|
|
42
31
|
}
|
|
43
32
|
};
|
|
44
33
|
}, []);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
return [{
|
|
35
|
+
csid: csid,
|
|
36
|
+
// generated CSID to be used in href and createFlowStart events
|
|
37
|
+
globalCSID: globalCSID // CSID from the URL query parameter
|
|
38
|
+
}, actions];
|
|
50
39
|
};
|
package/dist/esm/common/types.js
CHANGED
|
@@ -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.
|
package/dist/esm/create/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
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 of all valid actions for the create agent analytics hook.
|
|
14
|
+
* Derived from the event payload types in the action group files.
|
|
15
|
+
* To add a new action, update the payload type in the relevant group file.
|
|
16
|
+
*/
|
|
13
17
|
|
|
14
|
-
// Backward-compatible alias
|
|
15
|
-
// TODO: migrate consumers to use CreateFlowActions / AddToolsPromptActions directly, then remove
|
|
16
|
-
export var AgentCreateActions = _objectSpread(_objectSpread({}, CreateFlowActions), AddToolsPromptActions);
|
|
17
18
|
var globalEventConfig = getDefaultTrackEventConfig();
|
|
18
19
|
export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
|
|
19
20
|
var _useRovoAgentCSID = useRovoAgentCSID(),
|
|
20
21
|
_useRovoAgentCSID2 = _slicedToArray(_useRovoAgentCSID, 2),
|
|
21
|
-
|
|
22
|
+
_useRovoAgentCSID2$ = _useRovoAgentCSID2[0],
|
|
23
|
+
csid = _useRovoAgentCSID2$.csid,
|
|
24
|
+
globalCSID = _useRovoAgentCSID2$.globalCSID,
|
|
22
25
|
refreshCSID = _useRovoAgentCSID2[1].refresh;
|
|
23
26
|
var analyticsContext = useContext(AnalyticsReactContext);
|
|
24
27
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
@@ -27,49 +30,56 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
|
|
|
27
30
|
var fireAnalyticsEvent = useCallback(function (event) {
|
|
28
31
|
var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
29
32
|
var attributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes), {}, {
|
|
30
|
-
|
|
33
|
+
actionGroup: 'createFlow',
|
|
31
34
|
referrer: referrer
|
|
32
35
|
});
|
|
33
36
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, globalEventConfig), event), {}, {
|
|
34
37
|
attributes: attributes
|
|
35
38
|
})).fire(ANALYTICS_CHANNEL);
|
|
36
|
-
}, [createAnalyticsEvent,
|
|
39
|
+
}, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
|
|
37
40
|
);
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
43
|
+
* Fires an analytics event for a step in the create agent flow funnel.
|
|
44
|
+
* Uses the CSID from the URL query parameter.
|
|
42
45
|
*/
|
|
43
46
|
var trackCreateSession = useCallback(function (action, attributes) {
|
|
44
47
|
fireAnalyticsEvent({
|
|
45
48
|
actionSubject: DefaultActionSubject,
|
|
46
49
|
action: action,
|
|
47
|
-
attributes:
|
|
50
|
+
attributes: _objectSpread({
|
|
51
|
+
csid: globalCSID
|
|
52
|
+
}, attributes)
|
|
48
53
|
});
|
|
49
|
-
}, [fireAnalyticsEvent]);
|
|
54
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
50
55
|
|
|
51
56
|
/**
|
|
52
|
-
*
|
|
57
|
+
* Fires `createFlowStart` with the current CSID (matching the href),
|
|
58
|
+
* then refreshes the CSID for the next session.
|
|
59
|
+
* The component re-renders with the new CSID, updating any href attributes.
|
|
53
60
|
*/
|
|
54
61
|
var trackCreateSessionStart = useCallback(function (attributes) {
|
|
55
62
|
fireAnalyticsEvent({
|
|
56
63
|
actionSubject: DefaultActionSubject,
|
|
57
|
-
action:
|
|
58
|
-
attributes:
|
|
64
|
+
action: 'createFlowStart',
|
|
65
|
+
attributes: _objectSpread({
|
|
66
|
+
csid: csid
|
|
67
|
+
}, attributes)
|
|
59
68
|
});
|
|
60
69
|
refreshCSID();
|
|
61
|
-
}, [fireAnalyticsEvent, refreshCSID]);
|
|
70
|
+
}, [fireAnalyticsEvent, refreshCSID, csid]);
|
|
62
71
|
var trackCreateSessionError = useCallback(function (error, attributes) {
|
|
63
72
|
fireAnalyticsEvent({
|
|
64
73
|
actionSubject: DefaultActionSubject,
|
|
65
|
-
action:
|
|
74
|
+
action: 'createFlowError',
|
|
66
75
|
attributes: _objectSpread({
|
|
67
76
|
error: {
|
|
68
77
|
message: error.message
|
|
69
|
-
}
|
|
78
|
+
},
|
|
79
|
+
csid: globalCSID
|
|
70
80
|
}, attributes)
|
|
71
81
|
});
|
|
72
|
-
}, [fireAnalyticsEvent]);
|
|
82
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
73
83
|
return [csid, {
|
|
74
84
|
trackCreateSession: trackCreateSession,
|
|
75
85
|
trackCreateSessionStart: trackCreateSessionStart,
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Action Group: addToolsPrompt
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* The user can browse tools or dismiss and proceed without them.
|
|
6
|
-
*
|
|
7
|
-
* This group is intentionally flow-agnostic so the action values stay stable
|
|
8
|
-
* regardless of whether the prompt fires from the create flow or a future publish flow.
|
|
4
|
+
* Events related to the "Add Tools" prompt shown during agent creation.
|
|
9
5
|
*
|
|
10
6
|
* ## Adding a new action
|
|
11
7
|
* 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
|
|
12
8
|
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
13
|
-
* (see other files in this directory for the template)
|
|
14
9
|
*/
|
|
15
10
|
/**
|
|
16
11
|
* Discriminated union payload type for add tools prompt events.
|
|
@@ -29,11 +24,3 @@ export type AddToolsPromptEventPayload = {
|
|
|
29
24
|
action: 'addToolsPromptDismiss';
|
|
30
25
|
attributes: {};
|
|
31
26
|
};
|
|
32
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
33
|
-
export declare const ACTION_GROUP: "addToolsPrompt";
|
|
34
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
35
|
-
export declare enum AddToolsPromptActions {
|
|
36
|
-
SHOWN = "addToolsPromptShown",
|
|
37
|
-
BROWSE = "addToolsPromptBrowse",
|
|
38
|
-
DISMISS = "addToolsPromptDismiss"
|
|
39
|
-
}
|
|
@@ -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
|
-
};
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Action Group: createFlow
|
|
3
3
|
*
|
|
4
|
-
* Create agent funnel steps — from clicking "Create agent" through to activation or discard
|
|
4
|
+
* Create agent funnel steps — from clicking "Create agent" through to activation or discard.
|
|
5
|
+
*
|
|
6
|
+
* ## Funnel overview
|
|
7
|
+
*
|
|
8
|
+
* | Step | v1 (NL flow) event | v2 (SA flow) event | CSID behavior |
|
|
9
|
+
* |-----------------------|------------------------|------------------------|----------------------------------|
|
|
10
|
+
* | Intent to create | createFlowStart | saDraft | Uses existing CSID |
|
|
11
|
+
* | Land in NL page | createLandInStudio | (skipped) | Uses existing CSID |
|
|
12
|
+
* | NL interaction | REVIEW_NL / SKIP_NL | (skipped) | Uses existing CSID |
|
|
13
|
+
* | Land in configure | createLandInConfigure | createLandInConfigure | Uses existing CSID |
|
|
14
|
+
* | Activate agent | createFlowActivate | createFlowActivate | Uses existing CSID |
|
|
15
|
+
*
|
|
16
|
+
* ## CSID (Create Session ID)
|
|
17
|
+
*
|
|
18
|
+
* CSID links all events in a single agent creation session.
|
|
19
|
+
* - `trackCreateSessionStart()` fires `createFlowStart` with the current CSID
|
|
20
|
+
* - `trackCreateSession()` uses the existing CSID (for all other steps including `saDraft`)
|
|
5
21
|
*
|
|
6
22
|
* ## Adding a new action
|
|
7
23
|
* 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
|
|
@@ -48,18 +64,8 @@ export type CreateFlowEventPayload = {
|
|
|
48
64
|
actionSubject: 'rovoAgent';
|
|
49
65
|
action: 'saDraft';
|
|
50
66
|
attributes: {};
|
|
67
|
+
} | {
|
|
68
|
+
actionSubject: 'rovoAgent';
|
|
69
|
+
action: 'createLandInConfigure';
|
|
70
|
+
attributes: {};
|
|
51
71
|
};
|
|
52
|
-
/** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
|
|
53
|
-
export declare const ACTION_GROUP: "createFlow";
|
|
54
|
-
/** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
|
|
55
|
-
export declare enum CreateFlowActions {
|
|
56
|
-
START = "createFlowStart",
|
|
57
|
-
SKIP_NL = "createFlowSkipNL",
|
|
58
|
-
REVIEW_NL = "createFlowReviewNL",
|
|
59
|
-
ACTIVATE = "createFlowActivate",
|
|
60
|
-
RESTART = "createFlowRestart",
|
|
61
|
-
ERROR = "createFlowError",
|
|
62
|
-
LAND = "createLandInStudio",
|
|
63
|
-
DISCARD = "createDiscard",
|
|
64
|
-
SA_DRAFT = "saDraft"
|
|
65
|
-
}
|
|
@@ -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 {};
|