@atlaskit/rovo-agent-analytics 0.12.0 → 0.13.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 +14 -0
- package/README.md +96 -5
- package/dist/cjs/actions/index.js +34 -23
- package/dist/cjs/create/index.js +17 -8
- package/dist/es2019/actions/index.js +33 -22
- package/dist/es2019/create/index.js +17 -8
- package/dist/esm/actions/index.js +33 -22
- package/dist/esm/create/index.js +17 -8
- package/dist/types/actions/index.d.ts +30 -4
- package/dist/types/create/index.d.ts +1 -1
- package/dist/types-ts4.5/actions/index.d.ts +30 -4
- package/dist/types-ts4.5/create/index.d.ts +1 -1
- package/package.json +1 -1
- package/debug/package.json +0 -17
- package/dist/cjs/debug/index.js +0 -63
- package/dist/es2019/debug/index.js +0 -61
- package/dist/esm/debug/index.js +0 -56
- package/dist/types/debug/index.d.ts +0 -16
- package/dist/types-ts4.5/debug/index.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-analytics
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d6ab7edf41142`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d6ab7edf41142) -
|
|
8
|
+
Update agent analytics types
|
|
9
|
+
|
|
10
|
+
## 0.12.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`f2c0a49bc75c7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2c0a49bc75c7) -
|
|
15
|
+
Add comments to data-portal registry
|
|
16
|
+
|
|
3
17
|
## 0.12.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -11,14 +11,105 @@ Detailed docs and example usage can be found
|
|
|
11
11
|
|
|
12
12
|
## Examples
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
### Basic usage with common attributes
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { useRovoAgentActionAnalytics, AgentCommonActions } from '@atlaskit/rovo-agent-analytics';
|
|
16
18
|
|
|
17
19
|
const { trackAgentAction } = useRovoAgentActionAnalytics({
|
|
18
20
|
agentId,
|
|
19
|
-
|
|
20
|
-
touchPoint: 'browse-agent-list'
|
|
21
|
+
touchPoint: 'browse-agent-list',
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
// No additional attributes needed - agentId and touchPoint already provided
|
|
25
|
+
trackAgentAction(AgentCommonActions.DUPLICATE, {});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Usage with debug actions (no attributes required)
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { useRovoAgentActionAnalytics, AgentDebugActions } from '@atlaskit/rovo-agent-analytics';
|
|
32
|
+
|
|
33
|
+
const { trackAgentAction } = useRovoAgentActionAnalytics({});
|
|
34
|
+
|
|
35
|
+
// Debug actions don't require any attributes
|
|
36
|
+
trackAgentAction(AgentDebugActions.VIEW, {});
|
|
37
|
+
trackAgentAction(AgentDebugActions.COPY, {});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Adding New Actions
|
|
41
|
+
|
|
42
|
+
### Step 1: Add the action to the appropriate enum
|
|
43
|
+
|
|
44
|
+
Add your new action to either `AgentCommonActions` or `AgentDebugActions` in
|
|
45
|
+
`src/actions/index.tsx`:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
export enum AgentCommonActions {
|
|
49
|
+
// ... existing actions
|
|
50
|
+
/* My new action - https://data-portal.internal.atlassian.com/analytics/registry/XXXXX */
|
|
51
|
+
MY_NEW_ACTION = 'myNewAction',
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 2: Define attributes for the action
|
|
56
|
+
|
|
57
|
+
Add an entry to `ActionAttributes` to specify which attributes this action requires:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
type ActionAttributes = {
|
|
61
|
+
// ... existing actions
|
|
62
|
+
[AgentCommonActions.MY_NEW_ACTION]: CommonAnalyticsAttributes;
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Defining Custom Attributes Per Action
|
|
67
|
+
|
|
68
|
+
Each action can have its own specific attributes. The `trackAgentAction` function is generic and
|
|
69
|
+
will enforce the correct attributes based on the action you pass.
|
|
70
|
+
|
|
71
|
+
### Using CommonAnalyticsAttributes
|
|
72
|
+
|
|
73
|
+
For actions that only need `touchPoint` and `agentId`:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
type ActionAttributes = {
|
|
77
|
+
[AgentCommonActions.VIEW]: CommonAnalyticsAttributes;
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Using Custom Attributes
|
|
82
|
+
|
|
83
|
+
For actions that need additional attributes beyond the common ones:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
type ActionAttributes = {
|
|
87
|
+
[AgentCommonActions.STAR]: CommonAnalyticsAttributes & { isStarred: boolean };
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
When calling `trackAgentAction`, TypeScript will enforce the custom attributes:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// TypeScript will require isStarred to be provided
|
|
95
|
+
trackAgentAction(AgentCommonActions.STAR, { isStarred: true });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### How Type Inference Works
|
|
99
|
+
|
|
100
|
+
The `trackAgentAction` function uses generics to infer required attributes:
|
|
101
|
+
|
|
102
|
+
1. When you call `trackAgentAction(action, attributes)`, TypeScript infers the action type
|
|
103
|
+
2. It looks up `ActionAttributes[action]` to get the required attributes for that action
|
|
104
|
+
3. It subtracts any attributes already provided in `commonAttributes` (via `RemainingRequired`)
|
|
105
|
+
4. The remaining attributes must be provided in the `attributes` parameter
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// If commonAttributes already includes agentId
|
|
111
|
+
const { trackAgentAction } = useRovoAgentActionAnalytics({ agentId: '123' });
|
|
112
|
+
|
|
113
|
+
// Only touchPoint is required since agentId was already provided
|
|
114
|
+
trackAgentAction(AgentCommonActions.VIEW, { touchPoint: 'my-touchpoint' });
|
|
24
115
|
```
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useRovoAgentActionAnalytics = exports.
|
|
7
|
+
exports.useRovoAgentActionAnalytics = exports.AgentDebugActions = exports.AgentCommonActions = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
@@ -12,28 +12,39 @@ var _constants = require("../common/constants");
|
|
|
12
12
|
var _utils = require("../common/utils");
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
-
var
|
|
16
|
-
/* View
|
|
17
|
-
|
|
18
|
-
/*
|
|
19
|
-
|
|
20
|
-
/*
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
var AgentDebugActions = exports.AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
16
|
+
/* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
|
|
17
|
+
AgentDebugActions["VIEW"] = "debugView";
|
|
18
|
+
/* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
|
|
19
|
+
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
20
|
+
/* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
|
|
21
|
+
AgentDebugActions["COPY"] = "debugCopy";
|
|
22
|
+
/* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
|
|
23
|
+
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
24
|
+
return AgentDebugActions;
|
|
25
|
+
}({});
|
|
26
|
+
var AgentCommonActions = exports.AgentCommonActions = /*#__PURE__*/function (AgentCommonActions) {
|
|
27
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
28
|
+
AgentCommonActions["VIEW"] = "view";
|
|
29
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
30
|
+
AgentCommonActions["EDIT"] = "edit";
|
|
31
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
32
|
+
AgentCommonActions["UPDATED"] = "updated";
|
|
33
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
34
|
+
AgentCommonActions["COPY_LINK"] = "copyLink";
|
|
35
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
36
|
+
AgentCommonActions["DELETE"] = "delete";
|
|
37
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
38
|
+
AgentCommonActions["DUPLICATE"] = "duplicate";
|
|
39
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
40
|
+
AgentCommonActions["STAR"] = "star";
|
|
41
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
42
|
+
AgentCommonActions["CHAT"] = "chat";
|
|
43
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
44
|
+
AgentCommonActions["VERIFY"] = "verify";
|
|
45
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
46
|
+
AgentCommonActions["UNVERIFY"] = "unverify";
|
|
47
|
+
return AgentCommonActions;
|
|
37
48
|
}({});
|
|
38
49
|
var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
|
|
39
50
|
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
package/dist/cjs/create/index.js
CHANGED
|
@@ -15,21 +15,21 @@ var _utils = require("../common/utils");
|
|
|
15
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; }
|
|
16
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; }
|
|
17
17
|
var AgentCreateActions = exports.AgentCreateActions = /*#__PURE__*/function (AgentCreateActions) {
|
|
18
|
-
/* Start create flow when user clicks on "Create agent" button */
|
|
18
|
+
/* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
19
19
|
AgentCreateActions["START"] = "createFlowStart";
|
|
20
|
-
/* Skip natural language */
|
|
20
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
21
21
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
22
|
-
/* Review natural language */
|
|
22
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
23
23
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
24
|
-
/* Activate agent */
|
|
24
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
25
25
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
26
|
-
/* Restart create flow */
|
|
26
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
27
27
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
28
|
-
/* Error occurred */
|
|
28
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
29
29
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
30
|
-
/* Land in studio */
|
|
30
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
31
31
|
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
32
|
-
/* Discard agent */
|
|
32
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
33
33
|
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
34
34
|
return AgentCreateActions;
|
|
35
35
|
}({});
|
|
@@ -52,6 +52,11 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
52
52
|
}, commonAttributes), event.attributes)
|
|
53
53
|
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
54
54
|
}, [createAnalyticsEvent, eventConfig, csid, commonAttributes]);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* This will fire analytics event for intermediate steps in the create agent flow funnel
|
|
58
|
+
* To start the create agent flow, use trackCreateSessionStart
|
|
59
|
+
*/
|
|
55
60
|
var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
|
|
56
61
|
fireAnalyticsEvent({
|
|
57
62
|
actionSubject: 'rovoAgent',
|
|
@@ -59,6 +64,10 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
59
64
|
attributes: attributes
|
|
60
65
|
});
|
|
61
66
|
}, [fireAnalyticsEvent]);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* This should be used ONLY in the beginning of the funnel of create agent flow, it will create a new CSID (CSID = create session ID)
|
|
70
|
+
*/
|
|
62
71
|
var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
|
|
63
72
|
fireAnalyticsEvent({
|
|
64
73
|
actionSubject: 'rovoAgent',
|
|
@@ -2,28 +2,39 @@ import { useCallback, useContext, useMemo } from 'react';
|
|
|
2
2
|
import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
4
4
|
import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
|
|
5
|
-
export let
|
|
6
|
-
/* View
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
export let AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
6
|
+
/* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
|
|
7
|
+
AgentDebugActions["VIEW"] = "debugView";
|
|
8
|
+
/* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
|
|
9
|
+
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
10
|
+
/* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
|
|
11
|
+
AgentDebugActions["COPY"] = "debugCopy";
|
|
12
|
+
/* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
|
|
13
|
+
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
14
|
+
return AgentDebugActions;
|
|
15
|
+
}({});
|
|
16
|
+
export let AgentCommonActions = /*#__PURE__*/function (AgentCommonActions) {
|
|
17
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
18
|
+
AgentCommonActions["VIEW"] = "view";
|
|
19
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
20
|
+
AgentCommonActions["EDIT"] = "edit";
|
|
21
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
22
|
+
AgentCommonActions["UPDATED"] = "updated";
|
|
23
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
24
|
+
AgentCommonActions["COPY_LINK"] = "copyLink";
|
|
25
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
26
|
+
AgentCommonActions["DELETE"] = "delete";
|
|
27
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
28
|
+
AgentCommonActions["DUPLICATE"] = "duplicate";
|
|
29
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
30
|
+
AgentCommonActions["STAR"] = "star";
|
|
31
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
32
|
+
AgentCommonActions["CHAT"] = "chat";
|
|
33
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
34
|
+
AgentCommonActions["VERIFY"] = "verify";
|
|
35
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
36
|
+
AgentCommonActions["UNVERIFY"] = "unverify";
|
|
37
|
+
return AgentCommonActions;
|
|
27
38
|
}({});
|
|
28
39
|
export const useRovoAgentActionAnalytics = commonAttributes => {
|
|
29
40
|
const analyticsContext = useContext(AnalyticsReactContext);
|
|
@@ -4,21 +4,21 @@ import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
|
4
4
|
import { useRovoAgentCSID } from '../common/csid';
|
|
5
5
|
import { getDefaultTrackEventConfig } from '../common/utils';
|
|
6
6
|
export let AgentCreateActions = /*#__PURE__*/function (AgentCreateActions) {
|
|
7
|
-
/* Start create flow when user clicks on "Create agent" button */
|
|
7
|
+
/* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
8
8
|
AgentCreateActions["START"] = "createFlowStart";
|
|
9
|
-
/* Skip natural language */
|
|
9
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
10
10
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
11
|
-
/* Review natural language */
|
|
11
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
12
12
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
13
|
-
/* Activate agent */
|
|
13
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
14
14
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
15
|
-
/* Restart create flow */
|
|
15
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
16
16
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
17
|
-
/* Error occurred */
|
|
17
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
18
18
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
19
|
-
/* Land in studio */
|
|
19
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
20
20
|
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
21
|
-
/* Discard agent */
|
|
21
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
22
22
|
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
23
23
|
return AgentCreateActions;
|
|
24
24
|
}({});
|
|
@@ -43,6 +43,11 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
43
43
|
}
|
|
44
44
|
}).fire(ANALYTICS_CHANNEL);
|
|
45
45
|
}, [createAnalyticsEvent, eventConfig, csid, commonAttributes]);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* This will fire analytics event for intermediate steps in the create agent flow funnel
|
|
49
|
+
* To start the create agent flow, use trackCreateSessionStart
|
|
50
|
+
*/
|
|
46
51
|
const trackCreateSession = useCallback((action, attributes) => {
|
|
47
52
|
fireAnalyticsEvent({
|
|
48
53
|
actionSubject: 'rovoAgent',
|
|
@@ -50,6 +55,10 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
50
55
|
attributes
|
|
51
56
|
});
|
|
52
57
|
}, [fireAnalyticsEvent]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This should be used ONLY in the beginning of the funnel of create agent flow, it will create a new CSID (CSID = create session ID)
|
|
61
|
+
*/
|
|
53
62
|
const trackCreateSessionStart = useCallback(attributes => {
|
|
54
63
|
fireAnalyticsEvent({
|
|
55
64
|
actionSubject: 'rovoAgent',
|
|
@@ -5,28 +5,39 @@ import { useCallback, useContext, useMemo } from 'react';
|
|
|
5
5
|
import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
6
|
import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
7
7
|
import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
|
|
8
|
-
export var
|
|
9
|
-
/* View
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
export var AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
9
|
+
/* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
|
|
10
|
+
AgentDebugActions["VIEW"] = "debugView";
|
|
11
|
+
/* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
|
|
12
|
+
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
13
|
+
/* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
|
|
14
|
+
AgentDebugActions["COPY"] = "debugCopy";
|
|
15
|
+
/* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
|
|
16
|
+
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
17
|
+
return AgentDebugActions;
|
|
18
|
+
}({});
|
|
19
|
+
export var AgentCommonActions = /*#__PURE__*/function (AgentCommonActions) {
|
|
20
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
21
|
+
AgentCommonActions["VIEW"] = "view";
|
|
22
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
23
|
+
AgentCommonActions["EDIT"] = "edit";
|
|
24
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
25
|
+
AgentCommonActions["UPDATED"] = "updated";
|
|
26
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
27
|
+
AgentCommonActions["COPY_LINK"] = "copyLink";
|
|
28
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
29
|
+
AgentCommonActions["DELETE"] = "delete";
|
|
30
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
31
|
+
AgentCommonActions["DUPLICATE"] = "duplicate";
|
|
32
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
33
|
+
AgentCommonActions["STAR"] = "star";
|
|
34
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
35
|
+
AgentCommonActions["CHAT"] = "chat";
|
|
36
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
37
|
+
AgentCommonActions["VERIFY"] = "verify";
|
|
38
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
39
|
+
AgentCommonActions["UNVERIFY"] = "unverify";
|
|
40
|
+
return AgentCommonActions;
|
|
30
41
|
}({});
|
|
31
42
|
export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
|
|
32
43
|
var analyticsContext = useContext(AnalyticsReactContext);
|
package/dist/esm/create/index.js
CHANGED
|
@@ -8,21 +8,21 @@ import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
|
8
8
|
import { useRovoAgentCSID } from '../common/csid';
|
|
9
9
|
import { getDefaultTrackEventConfig } from '../common/utils';
|
|
10
10
|
export var AgentCreateActions = /*#__PURE__*/function (AgentCreateActions) {
|
|
11
|
-
/* Start create flow when user clicks on "Create agent" button */
|
|
11
|
+
/* Start create flow when user clicks on "Create agent" button - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
12
12
|
AgentCreateActions["START"] = "createFlowStart";
|
|
13
|
-
/* Skip natural language */
|
|
13
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
14
14
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
15
|
-
/* Review natural language */
|
|
15
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
16
16
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
17
|
-
/* Activate agent */
|
|
17
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
18
18
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
19
|
-
/* Restart create flow */
|
|
19
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
20
20
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
21
|
-
/* Error occurred */
|
|
21
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
22
22
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
23
|
-
/* Land in studio */
|
|
23
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
24
24
|
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
25
|
-
/* Discard agent */
|
|
25
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
26
26
|
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
27
27
|
return AgentCreateActions;
|
|
28
28
|
}({});
|
|
@@ -45,6 +45,11 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
|
|
|
45
45
|
}, commonAttributes), event.attributes)
|
|
46
46
|
})).fire(ANALYTICS_CHANNEL);
|
|
47
47
|
}, [createAnalyticsEvent, eventConfig, csid, commonAttributes]);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* This will fire analytics event for intermediate steps in the create agent flow funnel
|
|
51
|
+
* To start the create agent flow, use trackCreateSessionStart
|
|
52
|
+
*/
|
|
48
53
|
var trackCreateSession = useCallback(function (action, attributes) {
|
|
49
54
|
fireAnalyticsEvent({
|
|
50
55
|
actionSubject: 'rovoAgent',
|
|
@@ -52,6 +57,10 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
|
|
|
52
57
|
attributes: attributes
|
|
53
58
|
});
|
|
54
59
|
}, [fireAnalyticsEvent]);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* This should be used ONLY in the beginning of the funnel of create agent flow, it will create a new CSID (CSID = create session ID)
|
|
63
|
+
*/
|
|
55
64
|
var trackCreateSessionStart = useCallback(function (attributes) {
|
|
56
65
|
fireAnalyticsEvent({
|
|
57
66
|
actionSubject: 'rovoAgent',
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { RemainingRequired } from '../common/types';
|
|
2
|
-
export declare enum
|
|
2
|
+
export declare enum AgentDebugActions {
|
|
3
|
+
VIEW = "debugView",
|
|
4
|
+
COPY_ALL = "debugCopyAll",
|
|
5
|
+
COPY = "debugCopy",
|
|
6
|
+
TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
|
|
7
|
+
}
|
|
8
|
+
export declare enum AgentCommonActions {
|
|
3
9
|
VIEW = "view",
|
|
4
10
|
EDIT = "edit",
|
|
5
11
|
UPDATED = "updated",
|
|
@@ -15,8 +21,28 @@ type CommonAnalyticsAttributes = {
|
|
|
15
21
|
touchPoint: string;
|
|
16
22
|
agentId: string;
|
|
17
23
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
type EmptyAttributes = {};
|
|
25
|
+
type ActionAttributes = {
|
|
26
|
+
[AgentCommonActions.VIEW]: CommonAnalyticsAttributes;
|
|
27
|
+
[AgentCommonActions.EDIT]: CommonAnalyticsAttributes;
|
|
28
|
+
[AgentCommonActions.UPDATED]: CommonAnalyticsAttributes & {
|
|
29
|
+
agentType: string;
|
|
30
|
+
field: string;
|
|
31
|
+
};
|
|
32
|
+
[AgentCommonActions.COPY_LINK]: CommonAnalyticsAttributes;
|
|
33
|
+
[AgentCommonActions.DELETE]: CommonAnalyticsAttributes;
|
|
34
|
+
[AgentCommonActions.DUPLICATE]: CommonAnalyticsAttributes;
|
|
35
|
+
[AgentCommonActions.STAR]: CommonAnalyticsAttributes;
|
|
36
|
+
[AgentCommonActions.CHAT]: CommonAnalyticsAttributes;
|
|
37
|
+
[AgentCommonActions.VERIFY]: CommonAnalyticsAttributes;
|
|
38
|
+
[AgentCommonActions.UNVERIFY]: CommonAnalyticsAttributes;
|
|
39
|
+
[AgentDebugActions.COPY_ALL]: EmptyAttributes;
|
|
40
|
+
[AgentDebugActions.COPY]: EmptyAttributes;
|
|
41
|
+
[AgentDebugActions.TOGGLE_SKILL_INFO]: EmptyAttributes;
|
|
42
|
+
[AgentDebugActions.VIEW]: EmptyAttributes;
|
|
43
|
+
};
|
|
44
|
+
export declare const useRovoAgentActionAnalytics: <T extends {}>(commonAttributes: T) => {
|
|
45
|
+
trackAgentAction: <A extends keyof ActionAttributes>(action: A, attributes: RemainingRequired<ActionAttributes[A], T>) => void;
|
|
46
|
+
trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
|
|
21
47
|
};
|
|
22
48
|
export {};
|
|
@@ -12,7 +12,7 @@ export declare enum AgentCreateActions {
|
|
|
12
12
|
DISCARD = "createDiscard"
|
|
13
13
|
}
|
|
14
14
|
export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [string | null, {
|
|
15
|
-
readonly trackCreateSession: (action: AgentCreateActions, attributes?: CommonAnalyticsAttributes) => void;
|
|
15
|
+
readonly trackCreateSession: (action: Omit<AgentCreateActions, AgentCreateActions.START>, attributes?: CommonAnalyticsAttributes) => void;
|
|
16
16
|
readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
|
|
17
17
|
readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
|
|
18
18
|
}];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { RemainingRequired } from '../common/types';
|
|
2
|
-
export declare enum
|
|
2
|
+
export declare enum AgentDebugActions {
|
|
3
|
+
VIEW = "debugView",
|
|
4
|
+
COPY_ALL = "debugCopyAll",
|
|
5
|
+
COPY = "debugCopy",
|
|
6
|
+
TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
|
|
7
|
+
}
|
|
8
|
+
export declare enum AgentCommonActions {
|
|
3
9
|
VIEW = "view",
|
|
4
10
|
EDIT = "edit",
|
|
5
11
|
UPDATED = "updated",
|
|
@@ -15,8 +21,28 @@ type CommonAnalyticsAttributes = {
|
|
|
15
21
|
touchPoint: string;
|
|
16
22
|
agentId: string;
|
|
17
23
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
type EmptyAttributes = {};
|
|
25
|
+
type ActionAttributes = {
|
|
26
|
+
[AgentCommonActions.VIEW]: CommonAnalyticsAttributes;
|
|
27
|
+
[AgentCommonActions.EDIT]: CommonAnalyticsAttributes;
|
|
28
|
+
[AgentCommonActions.UPDATED]: CommonAnalyticsAttributes & {
|
|
29
|
+
agentType: string;
|
|
30
|
+
field: string;
|
|
31
|
+
};
|
|
32
|
+
[AgentCommonActions.COPY_LINK]: CommonAnalyticsAttributes;
|
|
33
|
+
[AgentCommonActions.DELETE]: CommonAnalyticsAttributes;
|
|
34
|
+
[AgentCommonActions.DUPLICATE]: CommonAnalyticsAttributes;
|
|
35
|
+
[AgentCommonActions.STAR]: CommonAnalyticsAttributes;
|
|
36
|
+
[AgentCommonActions.CHAT]: CommonAnalyticsAttributes;
|
|
37
|
+
[AgentCommonActions.VERIFY]: CommonAnalyticsAttributes;
|
|
38
|
+
[AgentCommonActions.UNVERIFY]: CommonAnalyticsAttributes;
|
|
39
|
+
[AgentDebugActions.COPY_ALL]: EmptyAttributes;
|
|
40
|
+
[AgentDebugActions.COPY]: EmptyAttributes;
|
|
41
|
+
[AgentDebugActions.TOGGLE_SKILL_INFO]: EmptyAttributes;
|
|
42
|
+
[AgentDebugActions.VIEW]: EmptyAttributes;
|
|
43
|
+
};
|
|
44
|
+
export declare const useRovoAgentActionAnalytics: <T extends {}>(commonAttributes: T) => {
|
|
45
|
+
trackAgentAction: <A extends keyof ActionAttributes>(action: A, attributes: RemainingRequired<ActionAttributes[A], T>) => void;
|
|
46
|
+
trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
|
|
21
47
|
};
|
|
22
48
|
export {};
|
|
@@ -14,7 +14,7 @@ export declare enum AgentCreateActions {
|
|
|
14
14
|
export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [
|
|
15
15
|
string | null,
|
|
16
16
|
{
|
|
17
|
-
readonly trackCreateSession: (action: AgentCreateActions, attributes?: CommonAnalyticsAttributes) => void;
|
|
17
|
+
readonly trackCreateSession: (action: Omit<AgentCreateActions, AgentCreateActions.START>, attributes?: CommonAnalyticsAttributes) => void;
|
|
18
18
|
readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
|
|
19
19
|
readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
|
|
20
20
|
}
|
package/package.json
CHANGED
package/debug/package.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/rovo-agent-analytics/debug",
|
|
3
|
-
"main": "../dist/cjs/debug/index.js",
|
|
4
|
-
"module": "../dist/esm/debug/index.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/debug/index.js",
|
|
6
|
-
"sideEffects": [
|
|
7
|
-
"*.compiled.css"
|
|
8
|
-
],
|
|
9
|
-
"types": "../dist/types/debug/index.d.ts",
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/debug/index.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
package/dist/cjs/debug/index.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useRovoAgentDebugAnalytics = exports.AgentDebugActions = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
|
-
var _constants = require("../common/constants");
|
|
12
|
-
var _utils = require("../common/utils");
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
var AgentDebugActions = exports.AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
16
|
-
/* View debug modal */
|
|
17
|
-
AgentDebugActions["VIEW"] = "debugView";
|
|
18
|
-
/* Copy all debug data */
|
|
19
|
-
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
20
|
-
/* Copy debug data */
|
|
21
|
-
AgentDebugActions["COPY"] = "debugCopy";
|
|
22
|
-
/* Toggle skill info */
|
|
23
|
-
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
24
|
-
/* Error occurred */
|
|
25
|
-
AgentDebugActions["ERROR"] = "debugError";
|
|
26
|
-
return AgentDebugActions;
|
|
27
|
-
}({});
|
|
28
|
-
var useRovoAgentDebugAnalytics = exports.useRovoAgentDebugAnalytics = function useRovoAgentDebugAnalytics(commonAttributes) {
|
|
29
|
-
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
|
30
|
-
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
31
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
32
|
-
var eventConfig = (0, _react.useMemo)(function () {
|
|
33
|
-
return (0, _utils.getDefaultTrackEventConfig)();
|
|
34
|
-
}, []);
|
|
35
|
-
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
36
|
-
var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
37
|
-
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
38
|
-
attributes: attributes
|
|
39
|
-
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
40
|
-
}, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
|
|
41
|
-
var trackAgentDebug = (0, _react.useCallback)(function (action, attributes) {
|
|
42
|
-
fireAnalyticsEvent({
|
|
43
|
-
actionSubject: 'rovoAgent',
|
|
44
|
-
action: action,
|
|
45
|
-
attributes: attributes
|
|
46
|
-
});
|
|
47
|
-
}, [fireAnalyticsEvent]);
|
|
48
|
-
var trackAgentDebugError = (0, _react.useCallback)(function (action, error, attributes) {
|
|
49
|
-
fireAnalyticsEvent({
|
|
50
|
-
actionSubject: 'rovoAgentError',
|
|
51
|
-
action: action,
|
|
52
|
-
attributes: _objectSpread(_objectSpread({}, attributes), error && {
|
|
53
|
-
error: {
|
|
54
|
-
message: error.message
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}, [fireAnalyticsEvent]);
|
|
59
|
-
return {
|
|
60
|
-
trackAgentDebug: trackAgentDebug,
|
|
61
|
-
trackAgentDebugError: trackAgentDebugError
|
|
62
|
-
};
|
|
63
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { useCallback, useContext, useMemo } from 'react';
|
|
2
|
-
import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
-
import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
4
|
-
import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
|
|
5
|
-
export let AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
6
|
-
/* View debug modal */
|
|
7
|
-
AgentDebugActions["VIEW"] = "debugView";
|
|
8
|
-
/* Copy all debug data */
|
|
9
|
-
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
10
|
-
/* Copy debug data */
|
|
11
|
-
AgentDebugActions["COPY"] = "debugCopy";
|
|
12
|
-
/* Toggle skill info */
|
|
13
|
-
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
14
|
-
/* Error occurred */
|
|
15
|
-
AgentDebugActions["ERROR"] = "debugError";
|
|
16
|
-
return AgentDebugActions;
|
|
17
|
-
}({});
|
|
18
|
-
export const useRovoAgentDebugAnalytics = commonAttributes => {
|
|
19
|
-
const analyticsContext = useContext(AnalyticsReactContext);
|
|
20
|
-
const {
|
|
21
|
-
createAnalyticsEvent
|
|
22
|
-
} = useAnalyticsEvents();
|
|
23
|
-
const eventConfig = useMemo(() => getDefaultTrackEventConfig(), []);
|
|
24
|
-
const fireAnalyticsEvent = useCallback(event => {
|
|
25
|
-
const attributes = {
|
|
26
|
-
...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
|
|
27
|
-
...commonAttributes,
|
|
28
|
-
...event.attributes
|
|
29
|
-
};
|
|
30
|
-
createAnalyticsEvent({
|
|
31
|
-
...eventConfig,
|
|
32
|
-
...event,
|
|
33
|
-
attributes
|
|
34
|
-
}).fire(ANALYTICS_CHANNEL);
|
|
35
|
-
}, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
|
|
36
|
-
const trackAgentDebug = useCallback((action, attributes) => {
|
|
37
|
-
fireAnalyticsEvent({
|
|
38
|
-
actionSubject: 'rovoAgent',
|
|
39
|
-
action,
|
|
40
|
-
attributes
|
|
41
|
-
});
|
|
42
|
-
}, [fireAnalyticsEvent]);
|
|
43
|
-
const trackAgentDebugError = useCallback((action, error, attributes) => {
|
|
44
|
-
fireAnalyticsEvent({
|
|
45
|
-
actionSubject: 'rovoAgentError',
|
|
46
|
-
action,
|
|
47
|
-
attributes: {
|
|
48
|
-
...attributes,
|
|
49
|
-
...(error && {
|
|
50
|
-
error: {
|
|
51
|
-
message: error.message
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, [fireAnalyticsEvent]);
|
|
57
|
-
return {
|
|
58
|
-
trackAgentDebug,
|
|
59
|
-
trackAgentDebugError
|
|
60
|
-
};
|
|
61
|
-
};
|
package/dist/esm/debug/index.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
import { useCallback, useContext, useMemo } from 'react';
|
|
5
|
-
import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
|
-
import { ANALYTICS_CHANNEL } from '../common/constants';
|
|
7
|
-
import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
|
|
8
|
-
export var AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
9
|
-
/* View debug modal */
|
|
10
|
-
AgentDebugActions["VIEW"] = "debugView";
|
|
11
|
-
/* Copy all debug data */
|
|
12
|
-
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
13
|
-
/* Copy debug data */
|
|
14
|
-
AgentDebugActions["COPY"] = "debugCopy";
|
|
15
|
-
/* Toggle skill info */
|
|
16
|
-
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
17
|
-
/* Error occurred */
|
|
18
|
-
AgentDebugActions["ERROR"] = "debugError";
|
|
19
|
-
return AgentDebugActions;
|
|
20
|
-
}({});
|
|
21
|
-
export var useRovoAgentDebugAnalytics = function useRovoAgentDebugAnalytics(commonAttributes) {
|
|
22
|
-
var analyticsContext = useContext(AnalyticsReactContext);
|
|
23
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
24
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
25
|
-
var eventConfig = useMemo(function () {
|
|
26
|
-
return getDefaultTrackEventConfig();
|
|
27
|
-
}, []);
|
|
28
|
-
var fireAnalyticsEvent = useCallback(function (event) {
|
|
29
|
-
var attributes = _objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
30
|
-
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
31
|
-
attributes: attributes
|
|
32
|
-
})).fire(ANALYTICS_CHANNEL);
|
|
33
|
-
}, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
|
|
34
|
-
var trackAgentDebug = useCallback(function (action, attributes) {
|
|
35
|
-
fireAnalyticsEvent({
|
|
36
|
-
actionSubject: 'rovoAgent',
|
|
37
|
-
action: action,
|
|
38
|
-
attributes: attributes
|
|
39
|
-
});
|
|
40
|
-
}, [fireAnalyticsEvent]);
|
|
41
|
-
var trackAgentDebugError = useCallback(function (action, error, attributes) {
|
|
42
|
-
fireAnalyticsEvent({
|
|
43
|
-
actionSubject: 'rovoAgentError',
|
|
44
|
-
action: action,
|
|
45
|
-
attributes: _objectSpread(_objectSpread({}, attributes), error && {
|
|
46
|
-
error: {
|
|
47
|
-
message: error.message
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
}, [fireAnalyticsEvent]);
|
|
52
|
-
return {
|
|
53
|
-
trackAgentDebug: trackAgentDebug,
|
|
54
|
-
trackAgentDebugError: trackAgentDebugError
|
|
55
|
-
};
|
|
56
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { RemainingRequired } from '../common/types';
|
|
2
|
-
export declare enum AgentDebugActions {
|
|
3
|
-
VIEW = "debugView",
|
|
4
|
-
COPY_ALL = "debugCopyAll",
|
|
5
|
-
COPY = "debugCopy",
|
|
6
|
-
TOGGLE_SKILL_INFO = "debugToggleSkillInfo",
|
|
7
|
-
ERROR = "debugError"
|
|
8
|
-
}
|
|
9
|
-
type CommonAnalyticsAttributes = {
|
|
10
|
-
agentId: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const useRovoAgentDebugAnalytics: <T extends Partial<CommonAnalyticsAttributes>>(commonAttributes?: T) => {
|
|
13
|
-
trackAgentDebug: (action: AgentDebugActions, attributes?: RemainingRequired<CommonAnalyticsAttributes, T extends undefined ? {} : T> & Record<string, any>) => void;
|
|
14
|
-
trackAgentDebugError: (action: AgentDebugActions, error?: Error, attributes?: RemainingRequired<CommonAnalyticsAttributes, T extends undefined ? {} : T> & Record<string, any>) => void;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { RemainingRequired } from '../common/types';
|
|
2
|
-
export declare enum AgentDebugActions {
|
|
3
|
-
VIEW = "debugView",
|
|
4
|
-
COPY_ALL = "debugCopyAll",
|
|
5
|
-
COPY = "debugCopy",
|
|
6
|
-
TOGGLE_SKILL_INFO = "debugToggleSkillInfo",
|
|
7
|
-
ERROR = "debugError"
|
|
8
|
-
}
|
|
9
|
-
type CommonAnalyticsAttributes = {
|
|
10
|
-
agentId: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const useRovoAgentDebugAnalytics: <T extends Partial<CommonAnalyticsAttributes>>(commonAttributes?: T) => {
|
|
13
|
-
trackAgentDebug: (action: AgentDebugActions, attributes?: RemainingRequired<CommonAnalyticsAttributes, T extends undefined ? {} : T> & Record<string, any>) => void;
|
|
14
|
-
trackAgentDebugError: (action: AgentDebugActions, error?: Error, attributes?: RemainingRequired<CommonAnalyticsAttributes, T extends undefined ? {} : T> & Record<string, any>) => void;
|
|
15
|
-
};
|
|
16
|
-
export {};
|