@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
package/dist/cjs/create/index.js
CHANGED
|
@@ -4,27 +4,31 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useRovoAgentCreateAnalytics =
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
exports.useRovoAgentCreateAnalytics = void 0;
|
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
-
var _addToolsPrompt = require("../actions/groups/add-tools-prompt");
|
|
13
|
-
var _createFlow = require("../actions/groups/create-flow");
|
|
14
|
-
var _registry = require("../actions/registry");
|
|
15
12
|
var _constants = require("../common/constants");
|
|
16
13
|
var _csid = require("../common/csid");
|
|
17
14
|
var _utils = require("../common/utils");
|
|
18
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
var DefaultActionSubject = 'rovoAgent';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Union of all valid actions for the create agent analytics hook.
|
|
21
|
+
* Derived from the event payload types in the action group files.
|
|
22
|
+
* To add a new action, update the payload type in the relevant group file.
|
|
23
|
+
*/
|
|
24
|
+
|
|
23
25
|
var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
|
|
24
26
|
var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
|
|
25
27
|
var _useRovoAgentCSID = (0, _csid.useRovoAgentCSID)(),
|
|
26
28
|
_useRovoAgentCSID2 = (0, _slicedToArray2.default)(_useRovoAgentCSID, 2),
|
|
27
|
-
|
|
29
|
+
_useRovoAgentCSID2$ = _useRovoAgentCSID2[0],
|
|
30
|
+
csid = _useRovoAgentCSID2$.csid,
|
|
31
|
+
globalCSID = _useRovoAgentCSID2$.globalCSID,
|
|
28
32
|
refreshCSID = _useRovoAgentCSID2[1].refresh;
|
|
29
33
|
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
|
30
34
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
@@ -33,49 +37,56 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
33
37
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
34
38
|
var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
35
39
|
var attributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes), {}, {
|
|
36
|
-
|
|
40
|
+
actionGroup: 'createFlow',
|
|
37
41
|
referrer: referrer
|
|
38
42
|
});
|
|
39
43
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, globalEventConfig), event), {}, {
|
|
40
44
|
attributes: attributes
|
|
41
45
|
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
42
|
-
}, [createAnalyticsEvent,
|
|
46
|
+
}, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
|
|
43
47
|
);
|
|
44
48
|
|
|
45
49
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
50
|
+
* Fires an analytics event for a step in the create agent flow funnel.
|
|
51
|
+
* Uses the CSID from the URL query parameter.
|
|
48
52
|
*/
|
|
49
53
|
var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
|
|
50
54
|
fireAnalyticsEvent({
|
|
51
|
-
actionSubject:
|
|
55
|
+
actionSubject: DefaultActionSubject,
|
|
52
56
|
action: action,
|
|
53
|
-
attributes:
|
|
57
|
+
attributes: _objectSpread({
|
|
58
|
+
csid: globalCSID
|
|
59
|
+
}, attributes)
|
|
54
60
|
});
|
|
55
|
-
}, [fireAnalyticsEvent]);
|
|
61
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
56
62
|
|
|
57
63
|
/**
|
|
58
|
-
*
|
|
64
|
+
* Fires `createFlowStart` with the current CSID (matching the href),
|
|
65
|
+
* then refreshes the CSID for the next session.
|
|
66
|
+
* The component re-renders with the new CSID, updating any href attributes.
|
|
59
67
|
*/
|
|
60
68
|
var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
|
|
61
69
|
fireAnalyticsEvent({
|
|
62
|
-
actionSubject:
|
|
63
|
-
action:
|
|
64
|
-
attributes:
|
|
70
|
+
actionSubject: DefaultActionSubject,
|
|
71
|
+
action: 'createFlowStart',
|
|
72
|
+
attributes: _objectSpread({
|
|
73
|
+
csid: csid
|
|
74
|
+
}, attributes)
|
|
65
75
|
});
|
|
66
76
|
refreshCSID();
|
|
67
|
-
}, [fireAnalyticsEvent, refreshCSID]);
|
|
77
|
+
}, [fireAnalyticsEvent, refreshCSID, csid]);
|
|
68
78
|
var trackCreateSessionError = (0, _react.useCallback)(function (error, attributes) {
|
|
69
79
|
fireAnalyticsEvent({
|
|
70
|
-
actionSubject:
|
|
71
|
-
action:
|
|
80
|
+
actionSubject: DefaultActionSubject,
|
|
81
|
+
action: 'createFlowError',
|
|
72
82
|
attributes: _objectSpread({
|
|
73
83
|
error: {
|
|
74
84
|
message: error.message
|
|
75
|
-
}
|
|
85
|
+
},
|
|
86
|
+
csid: globalCSID
|
|
76
87
|
}, attributes)
|
|
77
88
|
});
|
|
78
|
-
}, [fireAnalyticsEvent]);
|
|
89
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
79
90
|
return [csid, {
|
|
80
91
|
trackCreateSession: trackCreateSession,
|
|
81
92
|
trackCreateSessionStart: trackCreateSessionStart,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Group: addToolsPrompt
|
|
3
|
-
*
|
|
4
|
-
* Add tools prompt modal — shown when a user tries to activate/publish an agent that has no tools.
|
|
5
|
-
* The user can browse tools or dismiss and proceed without them.
|
|
6
|
-
*
|
|
7
|
-
* This group is intentionally flow-agnostic so the action values stay stable
|
|
8
|
-
* regardless of whether the prompt fires from the create flow or a future publish flow.
|
|
9
|
-
*
|
|
10
|
-
* ## Adding a new action
|
|
11
|
-
* 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
|
|
12
|
-
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
13
|
-
* (see other files in this directory for the template)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Discriminated union payload type for add tools prompt events.
|
|
18
|
-
* Use with `trackAgentEvent()`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
// ============================================================================
|
|
22
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
23
|
-
// ============================================================================
|
|
24
|
-
|
|
25
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
26
|
-
export const ACTION_GROUP = 'addToolsPrompt';
|
|
27
|
-
|
|
28
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
29
|
-
export let AddToolsPromptActions = /*#__PURE__*/function (AddToolsPromptActions) {
|
|
30
|
-
/* Add tools prompt shown (agent has no tools) - https://data-portal.internal.atlassian.com/analytics/registry/98106 */
|
|
31
|
-
AddToolsPromptActions["SHOWN"] = "addToolsPromptShown";
|
|
32
|
-
/* User clicked "Browse skills" on the add tools prompt - https://data-portal.internal.atlassian.com/analytics/registry/98107 */
|
|
33
|
-
AddToolsPromptActions["BROWSE"] = "addToolsPromptBrowse";
|
|
34
|
-
/* User dismissed the add tools prompt ("No thanks") and proceeded anyway - https://data-portal.internal.atlassian.com/analytics/registry/98108 */
|
|
35
|
-
AddToolsPromptActions["DISMISS"] = "addToolsPromptDismiss";
|
|
36
|
-
return AddToolsPromptActions;
|
|
37
|
-
}({});
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Action Group: agentInteractions
|
|
3
|
-
*
|
|
4
|
-
* User-initiated interactions with an agent — typically from the overflow menu ("...")
|
|
5
|
-
* or agent profile surfaces (viewing, editing, deleting, duplicating, starring, sharing, verifying).
|
|
6
|
-
*
|
|
7
|
-
* NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
|
|
8
|
-
*
|
|
9
|
-
* ## Adding a new action
|
|
10
|
-
* 1. Add a new variant to the `AgentInteractionsEventPayload` union type below with a data-portal link
|
|
11
|
-
* 2. If this action doesn't fit user interactions, create a new group file instead
|
|
12
|
-
* (see other files in this directory for the template)
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Discriminated union payload type for agent interaction events.
|
|
17
|
-
* Use with `trackAgentEvent()`.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
22
|
-
// ============================================================================
|
|
23
|
-
|
|
24
|
-
/** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
|
|
25
|
-
export const ACTION_GROUP = 'agentInteractions';
|
|
26
|
-
|
|
27
|
-
/** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
|
|
28
|
-
export let AgentInteractionActions = /*#__PURE__*/function (AgentInteractionActions) {
|
|
29
|
-
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
30
|
-
AgentInteractionActions["VIEW"] = "view";
|
|
31
|
-
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
32
|
-
AgentInteractionActions["EDIT"] = "edit";
|
|
33
|
-
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
34
|
-
AgentInteractionActions["COPY_LINK"] = "copyLink";
|
|
35
|
-
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
36
|
-
AgentInteractionActions["DELETE"] = "delete";
|
|
37
|
-
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
38
|
-
AgentInteractionActions["DUPLICATE"] = "duplicate";
|
|
39
|
-
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
40
|
-
AgentInteractionActions["STAR"] = "star";
|
|
41
|
-
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
42
|
-
AgentInteractionActions["CHAT"] = "chat";
|
|
43
|
-
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
44
|
-
AgentInteractionActions["VERIFY"] = "verify";
|
|
45
|
-
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
46
|
-
AgentInteractionActions["UNVERIFY"] = "unverify";
|
|
47
|
-
return AgentInteractionActions;
|
|
48
|
-
}({});
|
|
49
|
-
|
|
50
|
-
/** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
|
|
1
|
+
export {};
|
|
@@ -1,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 const ACTION_GROUP = 'createFlow';
|
|
23
|
-
|
|
24
|
-
/** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
|
|
25
|
-
export let CreateFlowActions = /*#__PURE__*/function (CreateFlowActions) {
|
|
26
|
-
/* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
27
|
-
CreateFlowActions["START"] = "createFlowStart";
|
|
28
|
-
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
29
|
-
CreateFlowActions["SKIP_NL"] = "createFlowSkipNL";
|
|
30
|
-
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
31
|
-
CreateFlowActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
32
|
-
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
33
|
-
CreateFlowActions["ACTIVATE"] = "createFlowActivate";
|
|
34
|
-
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
35
|
-
CreateFlowActions["RESTART"] = "createFlowRestart";
|
|
36
|
-
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
37
|
-
CreateFlowActions["ERROR"] = "createFlowError";
|
|
38
|
-
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
39
|
-
CreateFlowActions["LAND"] = "createLandInStudio";
|
|
40
|
-
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
41
|
-
CreateFlowActions["DISCARD"] = "createDiscard";
|
|
42
|
-
/* Draft created from solution architect plan card - https://data-portal.internal.atlassian.com/analytics/registry/97924 */
|
|
43
|
-
CreateFlowActions["SA_DRAFT"] = "saDraft";
|
|
44
|
-
return CreateFlowActions;
|
|
45
|
-
}({});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Group: debug
|
|
3
|
-
*
|
|
4
|
-
* Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
|
|
5
|
-
*
|
|
6
|
-
* ## Adding a new action
|
|
7
|
-
* 1. Add a new variant to the `DebugEventPayload` union type below with a data-portal link
|
|
8
|
-
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
9
|
-
* (see other files in this directory for the template)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Discriminated union payload type for debug events.
|
|
14
|
-
* Use with `trackAgentEvent()`.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
19
|
-
// ============================================================================
|
|
20
|
-
|
|
21
|
-
/** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
|
|
22
|
-
export const ACTION_GROUP = 'debug';
|
|
23
|
-
|
|
24
|
-
/** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
|
|
25
|
-
export let AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
26
|
-
/* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
|
|
27
|
-
AgentDebugActions["VIEW"] = "debugView";
|
|
28
|
-
/* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
|
|
29
|
-
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
30
|
-
/* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
|
|
31
|
-
AgentDebugActions["COPY"] = "debugCopy";
|
|
32
|
-
/* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
|
|
33
|
-
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
34
|
-
return AgentDebugActions;
|
|
35
|
-
}({});
|
|
36
|
-
|
|
37
|
-
/** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Action Group: editing
|
|
3
|
-
*
|
|
4
|
-
* Agent editing/mutation events — fired when an agent's configuration is saved or modified.
|
|
5
|
-
* Unlike agentInteractions (user clicks), these track actual data changes.
|
|
6
|
-
*
|
|
7
|
-
* ## Adding a new action
|
|
8
|
-
* 1. Add a new variant to the `EditingEventPayload` union type below with a data-portal link
|
|
9
|
-
* 2. If this action doesn't fit editing/mutation events, create a new group file instead
|
|
10
|
-
* (see other files in this directory for the template)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
|
-
/** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
|
|
18
|
-
export const ACTION_GROUP = 'editing';
|
|
19
|
-
|
|
20
|
-
/** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
|
|
21
|
-
export let AgentEditingActions = /*#__PURE__*/function (AgentEditingActions) {
|
|
22
|
-
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
23
|
-
AgentEditingActions["UPDATED"] = "updated";
|
|
24
|
-
return AgentEditingActions;
|
|
25
|
-
}({});
|
|
26
|
-
|
|
27
|
-
/** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
|
|
1
|
+
export {};
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Action Group: tools
|
|
3
|
-
*
|
|
4
|
-
* Actions related to agent tool execution during chat
|
|
5
|
-
* (confirming, streaming, viewing results, errors).
|
|
6
|
-
*
|
|
7
|
-
* ## Adding a new action
|
|
8
|
-
* 1. Add a new variant to the `ToolsEventPayload` union type below with a data-portal link
|
|
9
|
-
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
10
|
-
* (see other files in this directory for the template)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
|
-
/** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
|
|
18
|
-
export const ACTION_GROUP = 'tools';
|
|
19
|
-
|
|
20
|
-
/** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
|
|
21
|
-
export let AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
|
|
22
|
-
/* When chatting with an agent, and tools confirmation being shown, then user click proceed with the possible actions (e.g. confirm, dismiss etc) https://data-portal.internal.atlassian.com/analytics/registry/97675 */
|
|
23
|
-
AgentToolActions["TOOLS_EXECUTION_CONFIRMED"] = "toolsExecutionConfirmed";
|
|
24
|
-
/* When tools execution result is being streamed and user stops the stream e.g. by clicking stop button https://data-portal.internal.atlassian.com/analytics/registry/97750 */
|
|
25
|
-
AgentToolActions["TOOLS_EXECUTION_STREAM_STOPPED"] = "toolsExecutionStreamStopped";
|
|
26
|
-
/* When tools execution result is done streaming and user sees the result https://data-portal.internal.atlassian.com/analytics/registry/97751*/
|
|
27
|
-
AgentToolActions["TOOLS_EXECUTION_RESULT_VIEWED"] = "toolsExecutionResultViewed";
|
|
28
|
-
/* When tools execution result streaming fails https://data-portal.internal.atlassian.com/analytics/registry/97752 */
|
|
29
|
-
AgentToolActions["TOOLS_EXECUTION_RESULT_ERROR"] = "toolsExecutionResultError";
|
|
30
|
-
return AgentToolActions;
|
|
31
|
-
}({});
|
|
32
|
-
|
|
33
|
-
/** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
|
|
34
|
-
|
|
35
|
-
/** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
|
|
36
|
-
|
|
37
|
-
/** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
92
|
-
trackAgentEvent,
|
|
93
|
-
trackAgentActionError
|
|
47
|
+
trackAgentEvent
|
|
94
48
|
};
|
|
95
49
|
};
|
|
@@ -1,46 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
2
|
import { CSID_QUERY_PARAM } from '../constants';
|
|
3
3
|
let CACHED_CSID = null;
|
|
4
4
|
const generateCSID = () => {
|
|
5
5
|
return crypto.randomUUID();
|
|
6
6
|
};
|
|
7
|
-
const retrieveCSID = () => {
|
|
8
|
-
if (CACHED_CSID) {
|
|
9
|
-
return CACHED_CSID;
|
|
10
|
-
}
|
|
11
|
-
const queryParams = new URLSearchParams(window.location.search);
|
|
12
|
-
const querySessionId = queryParams.get(CSID_QUERY_PARAM);
|
|
13
|
-
return querySessionId !== null && querySessionId !== void 0 ? querySessionId : generateCSID();
|
|
14
|
-
};
|
|
15
7
|
|
|
16
8
|
/**
|
|
17
|
-
* Hook to
|
|
18
|
-
*
|
|
9
|
+
* Hook to manage CSID state for entry point components.
|
|
10
|
+
* The returned csid is used in href attributes and by trackCreateSessionStart.
|
|
11
|
+
* After trackCreateSessionStart fires, it calls refresh() to generate a new CSID
|
|
12
|
+
* for the next session — the component re-renders and the href updates.
|
|
19
13
|
*/
|
|
20
14
|
export const useRovoAgentCSID = () => {
|
|
21
|
-
const [
|
|
15
|
+
const [csid, setCSID] = useState(CACHED_CSID || generateCSID());
|
|
16
|
+
const globalCSID = useMemo(() => {
|
|
17
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
18
|
+
return queryParams.get(CSID_QUERY_PARAM);
|
|
19
|
+
}, []);
|
|
22
20
|
const actions = useMemo(() => {
|
|
23
21
|
return {
|
|
24
22
|
refresh: () => {
|
|
25
23
|
const newCSID = generateCSID();
|
|
26
24
|
setCSID(newCSID);
|
|
25
|
+
CACHED_CSID = newCSID;
|
|
27
26
|
return newCSID;
|
|
28
|
-
},
|
|
29
|
-
clear: () => {
|
|
30
|
-
// remove CSID query parameter
|
|
31
|
-
const url = new URL(window.location.href);
|
|
32
|
-
url.searchParams.delete(CSID_QUERY_PARAM);
|
|
33
|
-
window.history.replaceState({}, '', url.toString());
|
|
34
|
-
|
|
35
|
-
// reset state
|
|
36
|
-
setCSID(null);
|
|
37
|
-
return null;
|
|
38
27
|
}
|
|
39
28
|
};
|
|
40
29
|
}, []);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
return [{
|
|
31
|
+
csid,
|
|
32
|
+
// generated CSID to be used in href and createFlowStart events
|
|
33
|
+
globalCSID // CSID from the URL query parameter
|
|
34
|
+
}, actions];
|
|
46
35
|
};
|
|
@@ -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,21 +1,22 @@
|
|
|
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 of all valid actions for the create agent analytics hook.
|
|
10
|
+
* Derived from the event payload types in the action group files.
|
|
11
|
+
* To add a new action, update the payload type in the relevant group file.
|
|
12
|
+
*/
|
|
9
13
|
|
|
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
14
|
const globalEventConfig = getDefaultTrackEventConfig();
|
|
17
15
|
export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
18
|
-
const [
|
|
16
|
+
const [{
|
|
17
|
+
csid,
|
|
18
|
+
globalCSID
|
|
19
|
+
}, {
|
|
19
20
|
refresh: refreshCSID
|
|
20
21
|
}] = useRovoAgentCSID();
|
|
21
22
|
const analyticsContext = useContext(AnalyticsReactContext);
|
|
@@ -29,7 +30,7 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
29
30
|
...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
|
|
30
31
|
...commonAttributesRef.current,
|
|
31
32
|
...event.attributes,
|
|
32
|
-
|
|
33
|
+
actionGroup: 'createFlow',
|
|
33
34
|
referrer
|
|
34
35
|
};
|
|
35
36
|
createAnalyticsEvent({
|
|
@@ -37,44 +38,53 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
37
38
|
...event,
|
|
38
39
|
attributes
|
|
39
40
|
}).fire(ANALYTICS_CHANNEL);
|
|
40
|
-
}, [createAnalyticsEvent,
|
|
41
|
+
}, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
|
|
41
42
|
);
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
45
|
+
* Fires an analytics event for a step in the create agent flow funnel.
|
|
46
|
+
* Uses the CSID from the URL query parameter.
|
|
46
47
|
*/
|
|
47
48
|
const trackCreateSession = useCallback((action, attributes) => {
|
|
48
49
|
fireAnalyticsEvent({
|
|
49
50
|
actionSubject: DefaultActionSubject,
|
|
50
51
|
action,
|
|
51
|
-
attributes
|
|
52
|
+
attributes: {
|
|
53
|
+
csid: globalCSID,
|
|
54
|
+
...attributes
|
|
55
|
+
}
|
|
52
56
|
});
|
|
53
|
-
}, [fireAnalyticsEvent]);
|
|
57
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
54
58
|
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
60
|
+
* Fires `createFlowStart` with the current CSID (matching the href),
|
|
61
|
+
* then refreshes the CSID for the next session.
|
|
62
|
+
* The component re-renders with the new CSID, updating any href attributes.
|
|
57
63
|
*/
|
|
58
64
|
const trackCreateSessionStart = useCallback(attributes => {
|
|
59
65
|
fireAnalyticsEvent({
|
|
60
66
|
actionSubject: DefaultActionSubject,
|
|
61
|
-
action:
|
|
62
|
-
attributes
|
|
67
|
+
action: 'createFlowStart',
|
|
68
|
+
attributes: {
|
|
69
|
+
csid,
|
|
70
|
+
...attributes
|
|
71
|
+
}
|
|
63
72
|
});
|
|
64
73
|
refreshCSID();
|
|
65
|
-
}, [fireAnalyticsEvent, refreshCSID]);
|
|
74
|
+
}, [fireAnalyticsEvent, refreshCSID, csid]);
|
|
66
75
|
const trackCreateSessionError = useCallback((error, attributes) => {
|
|
67
76
|
fireAnalyticsEvent({
|
|
68
77
|
actionSubject: DefaultActionSubject,
|
|
69
|
-
action:
|
|
78
|
+
action: 'createFlowError',
|
|
70
79
|
attributes: {
|
|
71
80
|
error: {
|
|
72
81
|
message: error.message
|
|
73
82
|
},
|
|
83
|
+
csid: globalCSID,
|
|
74
84
|
...attributes
|
|
75
85
|
}
|
|
76
86
|
});
|
|
77
|
-
}, [fireAnalyticsEvent]);
|
|
87
|
+
}, [fireAnalyticsEvent, globalCSID]);
|
|
78
88
|
return [csid, {
|
|
79
89
|
trackCreateSession,
|
|
80
90
|
trackCreateSessionStart,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Group: addToolsPrompt
|
|
3
|
-
*
|
|
4
|
-
* Add tools prompt modal — shown when a user tries to activate/publish an agent that has no tools.
|
|
5
|
-
* The user can browse tools or dismiss and proceed without them.
|
|
6
|
-
*
|
|
7
|
-
* This group is intentionally flow-agnostic so the action values stay stable
|
|
8
|
-
* regardless of whether the prompt fires from the create flow or a future publish flow.
|
|
9
|
-
*
|
|
10
|
-
* ## Adding a new action
|
|
11
|
-
* 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
|
|
12
|
-
* 2. If this action doesn't fit this group, consider creating a new group file instead
|
|
13
|
-
* (see other files in this directory for the template)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Discriminated union payload type for add tools prompt events.
|
|
18
|
-
* Use with `trackAgentEvent()`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
// ============================================================================
|
|
22
|
-
// BACKWARDS COMPAT (deprecated): Keep enum and attributes for trackAgentAction() consumers
|
|
23
|
-
// ============================================================================
|
|
24
|
-
|
|
25
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
26
|
-
export var ACTION_GROUP = 'addToolsPrompt';
|
|
27
|
-
|
|
28
|
-
/** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
|
|
29
|
-
export var AddToolsPromptActions = /*#__PURE__*/function (AddToolsPromptActions) {
|
|
30
|
-
/* Add tools prompt shown (agent has no tools) - https://data-portal.internal.atlassian.com/analytics/registry/98106 */
|
|
31
|
-
AddToolsPromptActions["SHOWN"] = "addToolsPromptShown";
|
|
32
|
-
/* User clicked "Browse skills" on the add tools prompt - https://data-portal.internal.atlassian.com/analytics/registry/98107 */
|
|
33
|
-
AddToolsPromptActions["BROWSE"] = "addToolsPromptBrowse";
|
|
34
|
-
/* User dismissed the add tools prompt ("No thanks") and proceeded anyway - https://data-portal.internal.atlassian.com/analytics/registry/98108 */
|
|
35
|
-
AddToolsPromptActions["DISMISS"] = "addToolsPromptDismiss";
|
|
36
|
-
return AddToolsPromptActions;
|
|
37
|
-
}({});
|