@atlaskit/rovo-agent-analytics 0.11.0 → 0.12.1
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 +16 -0
- package/dist/cjs/actions/index.js +13 -11
- package/dist/cjs/create/index.js +25 -2
- package/dist/cjs/debug/index.js +3 -1
- package/dist/es2019/actions/index.js +12 -12
- package/dist/es2019/create/index.js +23 -2
- package/dist/es2019/debug/index.js +2 -2
- package/dist/esm/actions/index.js +14 -12
- package/dist/esm/create/index.js +26 -3
- package/dist/esm/debug/index.js +4 -2
- package/dist/types/create/index.d.ts +4 -2
- package/dist/types-ts4.5/create/index.d.ts +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-analytics
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f2c0a49bc75c7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2c0a49bc75c7) -
|
|
8
|
+
Add comments to data-portal registry
|
|
9
|
+
|
|
10
|
+
## 0.12.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`0c769648243fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c769648243fc) -
|
|
15
|
+
Update rovo agents analytics coverage
|
|
16
|
+
- [`442a9eacd5145`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/442a9eacd5145) -
|
|
17
|
+
Fix rovo agent debug modal view analytics
|
|
18
|
+
|
|
3
19
|
## 0.11.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -13,25 +13,25 @@ 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
15
|
var AgentActions = exports.AgentActions = /*#__PURE__*/function (AgentActions) {
|
|
16
|
-
/* View agent clicked */
|
|
16
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
17
17
|
AgentActions["VIEW"] = "view";
|
|
18
|
-
/* Edit agent clicked */
|
|
18
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
19
19
|
AgentActions["EDIT"] = "edit";
|
|
20
|
-
/* Agent updated */
|
|
20
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
21
21
|
AgentActions["UPDATED"] = "updated";
|
|
22
|
-
/* Copy link clicked */
|
|
22
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
23
23
|
AgentActions["COPY_LINK"] = "copyLink";
|
|
24
|
-
/* Delete agent clicked */
|
|
24
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
25
25
|
AgentActions["DELETE"] = "delete";
|
|
26
|
-
/* Duplicate agent clicked */
|
|
26
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
27
27
|
AgentActions["DUPLICATE"] = "duplicate";
|
|
28
|
-
/* Star agent clicked */
|
|
28
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
29
29
|
AgentActions["STAR"] = "star";
|
|
30
|
-
/* Chat with agent clicked */
|
|
30
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
31
31
|
AgentActions["CHAT"] = "chat";
|
|
32
|
-
/* Verify agent clicked */
|
|
32
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
33
33
|
AgentActions["VERIFY"] = "verify";
|
|
34
|
-
/* Unverify agent clicked */
|
|
34
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
35
35
|
AgentActions["UNVERIFY"] = "unverify";
|
|
36
36
|
return AgentActions;
|
|
37
37
|
}({});
|
|
@@ -39,7 +39,9 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
|
|
|
39
39
|
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
|
40
40
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
41
41
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
42
|
-
var eventConfig = (0,
|
|
42
|
+
var eventConfig = (0, _react.useMemo)(function () {
|
|
43
|
+
return (0, _utils.getDefaultTrackEventConfig)();
|
|
44
|
+
}, []);
|
|
43
45
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
44
46
|
var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
45
47
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
package/dist/cjs/create/index.js
CHANGED
|
@@ -15,12 +15,22 @@ 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 - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
18
19
|
AgentCreateActions["START"] = "createFlowStart";
|
|
20
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
19
21
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
22
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
20
23
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
24
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
21
25
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
26
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
22
27
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
28
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
23
29
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
30
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
31
|
+
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
32
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
33
|
+
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
24
34
|
return AgentCreateActions;
|
|
25
35
|
}({});
|
|
26
36
|
var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
|
|
@@ -30,14 +40,23 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
30
40
|
refreshCSID = _useRovoAgentCSID2[1].refresh;
|
|
31
41
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
32
42
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
33
|
-
var eventConfig = (0,
|
|
43
|
+
var eventConfig = (0, _react.useMemo)(function () {
|
|
44
|
+
return (0, _utils.getDefaultTrackEventConfig)();
|
|
45
|
+
}, []);
|
|
34
46
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
47
|
+
var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
35
48
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
36
49
|
attributes: _objectSpread(_objectSpread({
|
|
37
|
-
csid: csid
|
|
50
|
+
csid: csid,
|
|
51
|
+
referrer: referrer
|
|
38
52
|
}, commonAttributes), event.attributes)
|
|
39
53
|
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
40
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
|
+
*/
|
|
41
60
|
var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
|
|
42
61
|
fireAnalyticsEvent({
|
|
43
62
|
actionSubject: 'rovoAgent',
|
|
@@ -45,6 +64,10 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
45
64
|
attributes: attributes
|
|
46
65
|
});
|
|
47
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
|
+
*/
|
|
48
71
|
var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
|
|
49
72
|
fireAnalyticsEvent({
|
|
50
73
|
actionSubject: 'rovoAgent',
|
package/dist/cjs/debug/index.js
CHANGED
|
@@ -29,7 +29,9 @@ var useRovoAgentDebugAnalytics = exports.useRovoAgentDebugAnalytics = function u
|
|
|
29
29
|
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
|
30
30
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
31
31
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
32
|
-
var eventConfig = (0,
|
|
32
|
+
var eventConfig = (0, _react.useMemo)(function () {
|
|
33
|
+
return (0, _utils.getDefaultTrackEventConfig)();
|
|
34
|
+
}, []);
|
|
33
35
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
34
36
|
var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
35
37
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useCallback, useContext } from 'react';
|
|
1
|
+
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
5
|
export let AgentActions = /*#__PURE__*/function (AgentActions) {
|
|
6
|
-
/* View agent clicked */
|
|
6
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
7
7
|
AgentActions["VIEW"] = "view";
|
|
8
|
-
/* Edit agent clicked */
|
|
8
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
9
9
|
AgentActions["EDIT"] = "edit";
|
|
10
|
-
/* Agent updated */
|
|
10
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
11
11
|
AgentActions["UPDATED"] = "updated";
|
|
12
|
-
/* Copy link clicked */
|
|
12
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
13
13
|
AgentActions["COPY_LINK"] = "copyLink";
|
|
14
|
-
/* Delete agent clicked */
|
|
14
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
15
15
|
AgentActions["DELETE"] = "delete";
|
|
16
|
-
/* Duplicate agent clicked */
|
|
16
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
17
17
|
AgentActions["DUPLICATE"] = "duplicate";
|
|
18
|
-
/* Star agent clicked */
|
|
18
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
19
19
|
AgentActions["STAR"] = "star";
|
|
20
|
-
/* Chat with agent clicked */
|
|
20
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
21
21
|
AgentActions["CHAT"] = "chat";
|
|
22
|
-
/* Verify agent clicked */
|
|
22
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
23
23
|
AgentActions["VERIFY"] = "verify";
|
|
24
|
-
/* Unverify agent clicked */
|
|
24
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
25
25
|
AgentActions["UNVERIFY"] = "unverify";
|
|
26
26
|
return AgentActions;
|
|
27
27
|
}({});
|
|
@@ -30,7 +30,7 @@ export const useRovoAgentActionAnalytics = commonAttributes => {
|
|
|
30
30
|
const {
|
|
31
31
|
createAnalyticsEvent
|
|
32
32
|
} = useAnalyticsEvents();
|
|
33
|
-
const eventConfig = getDefaultTrackEventConfig();
|
|
33
|
+
const eventConfig = useMemo(() => getDefaultTrackEventConfig(), []);
|
|
34
34
|
const fireAnalyticsEvent = useCallback(event => {
|
|
35
35
|
const attributes = {
|
|
36
36
|
...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
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 - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
7
8
|
AgentCreateActions["START"] = "createFlowStart";
|
|
9
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
8
10
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
11
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
9
12
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
13
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
10
14
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
15
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
11
16
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
17
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
12
18
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
19
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
20
|
+
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
21
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
22
|
+
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
13
23
|
return AgentCreateActions;
|
|
14
24
|
}({});
|
|
15
25
|
export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
@@ -19,18 +29,25 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
19
29
|
const {
|
|
20
30
|
createAnalyticsEvent
|
|
21
31
|
} = useAnalyticsEvents();
|
|
22
|
-
const eventConfig = getDefaultTrackEventConfig();
|
|
32
|
+
const eventConfig = useMemo(() => getDefaultTrackEventConfig(), []);
|
|
23
33
|
const fireAnalyticsEvent = useCallback(event => {
|
|
34
|
+
const referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
24
35
|
createAnalyticsEvent({
|
|
25
36
|
...eventConfig,
|
|
26
37
|
...event,
|
|
27
38
|
attributes: {
|
|
28
39
|
csid,
|
|
40
|
+
referrer,
|
|
29
41
|
...commonAttributes,
|
|
30
42
|
...event.attributes
|
|
31
43
|
}
|
|
32
44
|
}).fire(ANALYTICS_CHANNEL);
|
|
33
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
|
+
*/
|
|
34
51
|
const trackCreateSession = useCallback((action, attributes) => {
|
|
35
52
|
fireAnalyticsEvent({
|
|
36
53
|
actionSubject: 'rovoAgent',
|
|
@@ -38,6 +55,10 @@ export const useRovoAgentCreateAnalytics = commonAttributes => {
|
|
|
38
55
|
attributes
|
|
39
56
|
});
|
|
40
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
|
+
*/
|
|
41
62
|
const trackCreateSessionStart = useCallback(attributes => {
|
|
42
63
|
fireAnalyticsEvent({
|
|
43
64
|
actionSubject: 'rovoAgent',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useContext } from 'react';
|
|
1
|
+
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';
|
|
@@ -20,7 +20,7 @@ export const useRovoAgentDebugAnalytics = commonAttributes => {
|
|
|
20
20
|
const {
|
|
21
21
|
createAnalyticsEvent
|
|
22
22
|
} = useAnalyticsEvents();
|
|
23
|
-
const eventConfig = getDefaultTrackEventConfig();
|
|
23
|
+
const eventConfig = useMemo(() => getDefaultTrackEventConfig(), []);
|
|
24
24
|
const fireAnalyticsEvent = useCallback(event => {
|
|
25
25
|
const attributes = {
|
|
26
26
|
...getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext()),
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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
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 } from 'react';
|
|
4
|
+
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
8
|
export var AgentActions = /*#__PURE__*/function (AgentActions) {
|
|
9
|
-
/* View agent clicked */
|
|
9
|
+
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
10
10
|
AgentActions["VIEW"] = "view";
|
|
11
|
-
/* Edit agent clicked */
|
|
11
|
+
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
12
12
|
AgentActions["EDIT"] = "edit";
|
|
13
|
-
/* Agent updated */
|
|
13
|
+
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
14
14
|
AgentActions["UPDATED"] = "updated";
|
|
15
|
-
/* Copy link clicked */
|
|
15
|
+
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
16
16
|
AgentActions["COPY_LINK"] = "copyLink";
|
|
17
|
-
/* Delete agent clicked */
|
|
17
|
+
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
18
18
|
AgentActions["DELETE"] = "delete";
|
|
19
|
-
/* Duplicate agent clicked */
|
|
19
|
+
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
20
20
|
AgentActions["DUPLICATE"] = "duplicate";
|
|
21
|
-
/* Star agent clicked */
|
|
21
|
+
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
22
22
|
AgentActions["STAR"] = "star";
|
|
23
|
-
/* Chat with agent clicked */
|
|
23
|
+
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
24
24
|
AgentActions["CHAT"] = "chat";
|
|
25
|
-
/* Verify agent clicked */
|
|
25
|
+
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
26
26
|
AgentActions["VERIFY"] = "verify";
|
|
27
|
-
/* Unverify agent clicked */
|
|
27
|
+
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
28
28
|
AgentActions["UNVERIFY"] = "unverify";
|
|
29
29
|
return AgentActions;
|
|
30
30
|
}({});
|
|
@@ -32,7 +32,9 @@ export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(co
|
|
|
32
32
|
var analyticsContext = useContext(AnalyticsReactContext);
|
|
33
33
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
34
34
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
35
|
-
var eventConfig =
|
|
35
|
+
var eventConfig = useMemo(function () {
|
|
36
|
+
return getDefaultTrackEventConfig();
|
|
37
|
+
}, []);
|
|
36
38
|
var fireAnalyticsEvent = useCallback(function (event) {
|
|
37
39
|
var attributes = _objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
38
40
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
package/dist/esm/create/index.js
CHANGED
|
@@ -2,18 +2,28 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
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
|
-
import { useCallback } from 'react';
|
|
5
|
+
import { useCallback, useMemo } from 'react';
|
|
6
6
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
7
|
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 - https://data-portal.internal.atlassian.com/analytics/registry/97089 */
|
|
11
12
|
AgentCreateActions["START"] = "createFlowStart";
|
|
13
|
+
/* Skip natural language - https://data-portal.internal.atlassian.com/analytics/registry/97127 */
|
|
12
14
|
AgentCreateActions["SKIP_NL"] = "createFlowSkipNL";
|
|
15
|
+
/* Review natural language - https://data-portal.internal.atlassian.com/analytics/registry/97124 */
|
|
13
16
|
AgentCreateActions["REVIEW_NL"] = "createFlowReviewNL";
|
|
17
|
+
/* Activate agent - https://data-portal.internal.atlassian.com/analytics/registry/97123 */
|
|
14
18
|
AgentCreateActions["ACTIVATE"] = "createFlowActivate";
|
|
19
|
+
/* Restart create flow - https://data-portal.internal.atlassian.com/analytics/registry/97131 */
|
|
15
20
|
AgentCreateActions["RESTART"] = "createFlowRestart";
|
|
21
|
+
/* Error occurred - https://data-portal.internal.atlassian.com/analytics/registry/97132 */
|
|
16
22
|
AgentCreateActions["ERROR"] = "createFlowError";
|
|
23
|
+
/* Land in studio - https://data-portal.internal.atlassian.com/analytics/registry/97136 */
|
|
24
|
+
AgentCreateActions["LAND"] = "createLandInStudio";
|
|
25
|
+
/* Discard agent - https://data-portal.internal.atlassian.com/analytics/registry/97137 */
|
|
26
|
+
AgentCreateActions["DISCARD"] = "createDiscard";
|
|
17
27
|
return AgentCreateActions;
|
|
18
28
|
}({});
|
|
19
29
|
export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
|
|
@@ -23,14 +33,23 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
|
|
|
23
33
|
refreshCSID = _useRovoAgentCSID2[1].refresh;
|
|
24
34
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
25
35
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
26
|
-
var eventConfig =
|
|
36
|
+
var eventConfig = useMemo(function () {
|
|
37
|
+
return getDefaultTrackEventConfig();
|
|
38
|
+
}, []);
|
|
27
39
|
var fireAnalyticsEvent = useCallback(function (event) {
|
|
40
|
+
var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
28
41
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
29
42
|
attributes: _objectSpread(_objectSpread({
|
|
30
|
-
csid: csid
|
|
43
|
+
csid: csid,
|
|
44
|
+
referrer: referrer
|
|
31
45
|
}, commonAttributes), event.attributes)
|
|
32
46
|
})).fire(ANALYTICS_CHANNEL);
|
|
33
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
|
+
*/
|
|
34
53
|
var trackCreateSession = useCallback(function (action, attributes) {
|
|
35
54
|
fireAnalyticsEvent({
|
|
36
55
|
actionSubject: 'rovoAgent',
|
|
@@ -38,6 +57,10 @@ export var useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(co
|
|
|
38
57
|
attributes: attributes
|
|
39
58
|
});
|
|
40
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
|
+
*/
|
|
41
64
|
var trackCreateSessionStart = useCallback(function (attributes) {
|
|
42
65
|
fireAnalyticsEvent({
|
|
43
66
|
actionSubject: 'rovoAgent',
|
package/dist/esm/debug/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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
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 } from 'react';
|
|
4
|
+
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';
|
|
@@ -22,7 +22,9 @@ export var useRovoAgentDebugAnalytics = function useRovoAgentDebugAnalytics(comm
|
|
|
22
22
|
var analyticsContext = useContext(AnalyticsReactContext);
|
|
23
23
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
24
24
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
25
|
-
var eventConfig =
|
|
25
|
+
var eventConfig = useMemo(function () {
|
|
26
|
+
return getDefaultTrackEventConfig();
|
|
27
|
+
}, []);
|
|
26
28
|
var fireAnalyticsEvent = useCallback(function (event) {
|
|
27
29
|
var attributes = _objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
|
|
28
30
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
|
|
@@ -7,10 +7,12 @@ export declare enum AgentCreateActions {
|
|
|
7
7
|
REVIEW_NL = "createFlowReviewNL",
|
|
8
8
|
ACTIVATE = "createFlowActivate",
|
|
9
9
|
RESTART = "createFlowRestart",
|
|
10
|
-
ERROR = "createFlowError"
|
|
10
|
+
ERROR = "createFlowError",
|
|
11
|
+
LAND = "createLandInStudio",
|
|
12
|
+
DISCARD = "createDiscard"
|
|
11
13
|
}
|
|
12
14
|
export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [string | null, {
|
|
13
|
-
readonly trackCreateSession: (action: AgentCreateActions, attributes?: CommonAnalyticsAttributes) => void;
|
|
15
|
+
readonly trackCreateSession: (action: Omit<AgentCreateActions, AgentCreateActions.START>, attributes?: CommonAnalyticsAttributes) => void;
|
|
14
16
|
readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
|
|
15
17
|
readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
|
|
16
18
|
}];
|
|
@@ -7,12 +7,14 @@ export declare enum AgentCreateActions {
|
|
|
7
7
|
REVIEW_NL = "createFlowReviewNL",
|
|
8
8
|
ACTIVATE = "createFlowActivate",
|
|
9
9
|
RESTART = "createFlowRestart",
|
|
10
|
-
ERROR = "createFlowError"
|
|
10
|
+
ERROR = "createFlowError",
|
|
11
|
+
LAND = "createLandInStudio",
|
|
12
|
+
DISCARD = "createDiscard"
|
|
11
13
|
}
|
|
12
14
|
export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [
|
|
13
15
|
string | null,
|
|
14
16
|
{
|
|
15
|
-
readonly trackCreateSession: (action: AgentCreateActions, attributes?: CommonAnalyticsAttributes) => void;
|
|
17
|
+
readonly trackCreateSession: (action: Omit<AgentCreateActions, AgentCreateActions.START>, attributes?: CommonAnalyticsAttributes) => void;
|
|
16
18
|
readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
|
|
17
19
|
readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
|
|
18
20
|
}
|