@atlaskit/rovo-agent-analytics 0.10.0 → 0.11.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/rovo-agent-analytics
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d701db2f15d73`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d701db2f15d73) -
8
+ Rovo agents debug modal analytics
9
+
3
10
  ## 0.10.0
4
11
 
5
12
  ### Minor Changes
@@ -0,0 +1,17 @@
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
+ }
@@ -4,11 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useRovoAgentActionAnalytics = exports.AgentActions = exports.ANALYTICS_CHANNEL = void 0;
7
+ exports.useRovoAgentActionAnalytics = exports.AgentActions = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = require("react");
10
- var _analyticsListeners = require("@atlaskit/analytics-listeners");
11
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ 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; }
@@ -35,7 +35,6 @@ var AgentActions = exports.AgentActions = /*#__PURE__*/function (AgentActions) {
35
35
  AgentActions["UNVERIFY"] = "unverify";
36
36
  return AgentActions;
37
37
  }({});
38
- var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = _analyticsListeners.FabricChannel.aiMate;
39
38
  var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
40
39
  var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
41
40
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
@@ -45,7 +44,7 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
45
44
  var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
46
45
  createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
47
46
  attributes: attributes
48
- })).fire(ANALYTICS_CHANNEL);
47
+ })).fire(_constants.ANALYTICS_CHANNEL);
49
48
  }, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
50
49
  var trackAgentAction = (0, _react.useCallback)(function (action, attributes) {
51
50
  fireAnalyticsEvent({
@@ -0,0 +1,61 @@
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, _utils.getDefaultTrackEventConfig)();
33
+ var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
34
+ var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
35
+ createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
36
+ attributes: attributes
37
+ })).fire(_constants.ANALYTICS_CHANNEL);
38
+ }, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
39
+ var trackAgentDebug = (0, _react.useCallback)(function (action, attributes) {
40
+ fireAnalyticsEvent({
41
+ actionSubject: 'rovoAgent',
42
+ action: action,
43
+ attributes: attributes
44
+ });
45
+ }, [fireAnalyticsEvent]);
46
+ var trackAgentDebugError = (0, _react.useCallback)(function (action, error, attributes) {
47
+ fireAnalyticsEvent({
48
+ actionSubject: 'rovoAgentError',
49
+ action: action,
50
+ attributes: _objectSpread(_objectSpread({}, attributes), error && {
51
+ error: {
52
+ message: error.message
53
+ }
54
+ })
55
+ });
56
+ }, [fireAnalyticsEvent]);
57
+ return {
58
+ trackAgentDebug: trackAgentDebug,
59
+ trackAgentDebugError: trackAgentDebugError
60
+ };
61
+ };
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useContext } from 'react';
2
- import { FabricChannel } from '@atlaskit/analytics-listeners';
3
2
  import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
3
+ import { ANALYTICS_CHANNEL } from '../common/constants';
4
4
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
5
5
  export let AgentActions = /*#__PURE__*/function (AgentActions) {
6
6
  /* View agent clicked */
@@ -25,7 +25,6 @@ export let AgentActions = /*#__PURE__*/function (AgentActions) {
25
25
  AgentActions["UNVERIFY"] = "unverify";
26
26
  return AgentActions;
27
27
  }({});
28
- export const ANALYTICS_CHANNEL = FabricChannel.aiMate;
29
28
  export const useRovoAgentActionAnalytics = commonAttributes => {
30
29
  const analyticsContext = useContext(AnalyticsReactContext);
31
30
  const {
@@ -0,0 +1,61 @@
1
+ import { useCallback, useContext } 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 = 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
+ };
@@ -2,8 +2,8 @@ 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
4
  import { useCallback, useContext } from 'react';
5
- import { FabricChannel } from '@atlaskit/analytics-listeners';
6
5
  import { AnalyticsReactContext, useAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { ANALYTICS_CHANNEL } from '../common/constants';
7
7
  import { getAttributesFromContexts, getDefaultTrackEventConfig } from '../common/utils';
8
8
  export var AgentActions = /*#__PURE__*/function (AgentActions) {
9
9
  /* View agent clicked */
@@ -28,7 +28,6 @@ export var AgentActions = /*#__PURE__*/function (AgentActions) {
28
28
  AgentActions["UNVERIFY"] = "unverify";
29
29
  return AgentActions;
30
30
  }({});
31
- export var ANALYTICS_CHANNEL = FabricChannel.aiMate;
32
31
  export var useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
33
32
  var analyticsContext = useContext(AnalyticsReactContext);
34
33
  var _useAnalyticsEvents = useAnalyticsEvents(),
@@ -0,0 +1,54 @@
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 } 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 = getDefaultTrackEventConfig();
26
+ var fireAnalyticsEvent = useCallback(function (event) {
27
+ var attributes = _objectSpread(_objectSpread(_objectSpread({}, getAttributesFromContexts(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributes), event.attributes);
28
+ createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, eventConfig), event), {}, {
29
+ attributes: attributes
30
+ })).fire(ANALYTICS_CHANNEL);
31
+ }, [createAnalyticsEvent, eventConfig, commonAttributes, analyticsContext]);
32
+ var trackAgentDebug = useCallback(function (action, attributes) {
33
+ fireAnalyticsEvent({
34
+ actionSubject: 'rovoAgent',
35
+ action: action,
36
+ attributes: attributes
37
+ });
38
+ }, [fireAnalyticsEvent]);
39
+ var trackAgentDebugError = useCallback(function (action, error, attributes) {
40
+ fireAnalyticsEvent({
41
+ actionSubject: 'rovoAgentError',
42
+ action: action,
43
+ attributes: _objectSpread(_objectSpread({}, attributes), error && {
44
+ error: {
45
+ message: error.message
46
+ }
47
+ })
48
+ });
49
+ }, [fireAnalyticsEvent]);
50
+ return {
51
+ trackAgentDebug: trackAgentDebug,
52
+ trackAgentDebugError: trackAgentDebugError
53
+ };
54
+ };
@@ -1,4 +1,3 @@
1
- import { FabricChannel } from '@atlaskit/analytics-listeners';
2
1
  import type { RemainingRequired } from '../common/types';
3
2
  export declare enum AgentActions {
4
3
  VIEW = "view",
@@ -16,7 +15,6 @@ type CommonAnalyticsAttributes = {
16
15
  touchPoint: string;
17
16
  agentId: string;
18
17
  };
19
- export declare const ANALYTICS_CHANNEL = FabricChannel.aiMate;
20
18
  export declare const useRovoAgentActionAnalytics: <T extends Partial<CommonAnalyticsAttributes>>(commonAttributes: T) => {
21
19
  trackAgentAction: (action: AgentActions, attributes: RemainingRequired<CommonAnalyticsAttributes, T> & Record<string, any>) => void;
22
20
  trackAgentActionError: (action: AgentActions, error: Error, attributes?: RemainingRequired<CommonAnalyticsAttributes, T> & Record<string, any>) => void;
@@ -0,0 +1,16 @@
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,4 +1,3 @@
1
- import { FabricChannel } from '@atlaskit/analytics-listeners';
2
1
  import type { RemainingRequired } from '../common/types';
3
2
  export declare enum AgentActions {
4
3
  VIEW = "view",
@@ -16,7 +15,6 @@ type CommonAnalyticsAttributes = {
16
15
  touchPoint: string;
17
16
  agentId: string;
18
17
  };
19
- export declare const ANALYTICS_CHANNEL = FabricChannel.aiMate;
20
18
  export declare const useRovoAgentActionAnalytics: <T extends Partial<CommonAnalyticsAttributes>>(commonAttributes: T) => {
21
19
  trackAgentAction: (action: AgentActions, attributes: RemainingRequired<CommonAnalyticsAttributes, T> & Record<string, any>) => void;
22
20
  trackAgentActionError: (action: AgentActions, error: Error, attributes?: RemainingRequired<CommonAnalyticsAttributes, T> & Record<string, any>) => void;
@@ -0,0 +1,16 @@
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 {};
package/package.json CHANGED
@@ -83,7 +83,7 @@
83
83
  ]
84
84
  },
85
85
  "name": "@atlaskit/rovo-agent-analytics",
86
- "version": "0.10.0",
86
+ "version": "0.11.0",
87
87
  "description": "Rovo Agents analytics",
88
88
  "author": "Atlassian Pty Ltd",
89
89
  "license": "Apache-2.0",