@atlaskit/link-datasource 0.31.3 → 0.33.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +8 -0
  3. package/dist/cjs/analytics/generated/analytics.types.js +5 -0
  4. package/dist/cjs/analytics/generated/create-event-payload.js +46 -0
  5. package/dist/cjs/analytics/generated/use-analytics-events.js +32 -0
  6. package/dist/cjs/analytics/index.js +18 -0
  7. package/dist/cjs/ui/common/error-state/access-required.js +12 -3
  8. package/dist/cjs/ui/common/error-state/loading-error.js +20 -11
  9. package/dist/cjs/ui/common/error-state/modal-loading-error.js +21 -12
  10. package/dist/cjs/ui/common/error-state/no-results.js +48 -41
  11. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +2 -1
  12. package/dist/cjs/ui/issue-like-table/empty-state/index.js +24 -12
  13. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +8 -0
  14. package/dist/cjs/ui/jira-issues-modal/modal/index.js +31 -6
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/analytics/constants.js +1 -0
  17. package/dist/es2019/analytics/generated/analytics.types.js +1 -0
  18. package/dist/es2019/analytics/generated/create-event-payload.js +28 -0
  19. package/dist/es2019/analytics/generated/use-analytics-events.js +24 -0
  20. package/dist/es2019/analytics/index.js +3 -0
  21. package/dist/es2019/ui/common/error-state/access-required.js +10 -0
  22. package/dist/es2019/ui/common/error-state/loading-error.js +10 -0
  23. package/dist/es2019/ui/common/error-state/modal-loading-error.js +10 -0
  24. package/dist/es2019/ui/common/error-state/no-results.js +8 -0
  25. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +2 -1
  26. package/dist/es2019/ui/issue-like-table/empty-state/index.js +23 -12
  27. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +9 -0
  28. package/dist/es2019/ui/jira-issues-modal/modal/index.js +30 -3
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/analytics/constants.js +1 -0
  31. package/dist/esm/analytics/generated/analytics.types.js +1 -0
  32. package/dist/esm/analytics/generated/create-event-payload.js +38 -0
  33. package/dist/esm/analytics/generated/use-analytics-events.js +23 -0
  34. package/dist/esm/analytics/index.js +5 -0
  35. package/dist/esm/ui/common/error-state/access-required.js +9 -0
  36. package/dist/esm/ui/common/error-state/loading-error.js +9 -0
  37. package/dist/esm/ui/common/error-state/modal-loading-error.js +9 -0
  38. package/dist/esm/ui/common/error-state/no-results.js +7 -0
  39. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +2 -1
  40. package/dist/esm/ui/issue-like-table/empty-state/index.js +24 -12
  41. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +8 -0
  42. package/dist/esm/ui/jira-issues-modal/modal/index.js +30 -4
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/analytics/constants.d.ts +1 -0
  45. package/dist/types/analytics/generated/analytics.types.d.ts +49 -0
  46. package/dist/types/analytics/generated/create-event-payload.d.ts +27 -0
  47. package/dist/types/analytics/generated/use-analytics-events.d.ts +3 -0
  48. package/dist/types/analytics/index.d.ts +4 -0
  49. package/dist/types/ui/common/error-state/access-required.d.ts +0 -1
  50. package/dist/types/ui/common/error-state/loading-error.d.ts +0 -1
  51. package/dist/types/ui/common/error-state/modal-loading-error.d.ts +0 -1
  52. package/dist/types/ui/common/error-state/no-results.d.ts +0 -1
  53. package/dist/types/ui/issue-like-table/empty-state/index.d.ts +2 -1
  54. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  55. package/dist/types/ui/jira-issues-modal/modal/index.d.ts +3 -1
  56. package/dist/types-ts4.5/analytics/constants.d.ts +1 -0
  57. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +49 -0
  58. package/dist/types-ts4.5/analytics/generated/create-event-payload.d.ts +31 -0
  59. package/dist/types-ts4.5/analytics/generated/use-analytics-events.d.ts +7 -0
  60. package/dist/types-ts4.5/analytics/index.d.ts +8 -0
  61. package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +0 -1
  62. package/dist/types-ts4.5/ui/common/error-state/loading-error.d.ts +0 -1
  63. package/dist/types-ts4.5/ui/common/error-state/modal-loading-error.d.ts +0 -1
  64. package/dist/types-ts4.5/ui/common/error-state/no-results.d.ts +0 -1
  65. package/dist/types-ts4.5/ui/issue-like-table/empty-state/index.d.ts +2 -1
  66. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  67. package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +3 -1
  68. package/package.json +7 -2
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
12
  var _reactIntlNext = require("react-intl-next");
13
+ var _analytics = require("../../../analytics");
13
14
  var _basicSearchInput = require("../basic-search-input");
14
15
  var _jqlEditor = require("../jql-editor");
15
16
  var _modeSwitcher = require("../mode-switcher");
@@ -57,6 +58,8 @@ var JiraSearchContainer = function JiraSearchContainer(props) {
57
58
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
58
59
  orderDirection = _useState10[0],
59
60
  setOrderDirection = _useState10[1];
61
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
62
+ fireEvent = _useDatasourceAnalyti.fireEvent;
60
63
  var onSearchModeChange = function onSearchModeChange(searchMode) {
61
64
  setCurrentSearchMode(searchMode);
62
65
  };
@@ -90,6 +93,11 @@ var JiraSearchContainer = function JiraSearchContainer(props) {
90
93
  onSearch({
91
94
  jql: jql
92
95
  });
96
+ if (currentSearchMode === basicModeValue) {
97
+ fireEvent('ui.form.submitted.basicSearch', {});
98
+ } else if (currentSearchMode === jqlModeValue) {
99
+ fireEvent('ui.jqlEditor.searched', {});
100
+ }
93
101
  };
94
102
  return (0, _react2.jsx)("div", {
95
103
  css: inputContainerStyles
@@ -5,19 +5,23 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.JiraIssuesConfigModal = void 0;
8
+ exports.PlainJiraIssuesConfigModal = exports.JiraIssuesConfigModal = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
14
  var _react = require("react");
14
15
  var _react2 = require("@emotion/react");
15
16
  var _reactIntlNext = require("react-intl-next");
17
+ var _analyticsNext = require("@atlaskit/analytics-next");
16
18
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
17
19
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
18
20
  var _colors = require("@atlaskit/theme/colors");
21
+ var _analytics = require("../../../analytics");
19
22
  var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
20
23
  var _getAvailableJiraSites = require("../../../services/getAvailableJiraSites");
24
+ var _version = require("../../../version.json");
21
25
  var _accessRequired = require("../../common/error-state/access-required");
22
26
  var _modalLoadingError = require("../../common/error-state/modal-loading-error");
23
27
  var _noResults = require("../../common/error-state/no-results");
@@ -29,8 +33,8 @@ var _siteSelector = require("../site-selector");
29
33
  var _messages = require("./messages");
30
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
35
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
32
- /** @jsx jsx */
33
-
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
34
38
  var dropdownContainerStyles = (0, _react2.css)({
35
39
  display: 'flex',
36
40
  gap: "var(--ds-space-100, 0.5rem)"
@@ -56,7 +60,7 @@ var issueCountStyles = (0, _react2.css)({
56
60
  var smartLinkContainerStyles = (0, _react2.css)({
57
61
  paddingLeft: '1px'
58
62
  });
59
- var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
63
+ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
60
64
  var datasourceId = props.datasourceId,
61
65
  initialParameters = props.parameters,
62
66
  initialVisibleColumnKeys = props.visibleColumnKeys,
@@ -105,6 +109,8 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
105
109
  totalCount = _useDatasourceTableSt.totalCount;
106
110
  var _useIntl = (0, _reactIntlNext.useIntl)(),
107
111
  formatMessage = _useIntl.formatMessage;
112
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
113
+ fireEvent = _useDatasourceAnalyti.fireEvent;
108
114
  var selectedJiraSite = (0, _react.useMemo)(function () {
109
115
  return availableSites.find(function (jiraSite) {
110
116
  return jiraSite.cloudId === cloudId;
@@ -114,6 +120,9 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
114
120
  var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
115
121
  var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
116
122
  var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
123
+ (0, _react.useEffect)(function () {
124
+ fireEvent('screen.datasourceModalDialog.viewed', {});
125
+ }, [fireEvent]);
117
126
  (0, _react.useEffect)(function () {
118
127
  var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
119
128
  setVisibleColumnKeys(newVisibleColumnKeys);
@@ -130,7 +139,10 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
130
139
  case 2:
131
140
  jiraSites = _context.sent;
132
141
  setAvailableSites(jiraSites);
133
- case 4:
142
+ fireEvent('ui.modal.ready.datasource', {
143
+ instancesCount: jiraSites.length
144
+ });
145
+ case 5:
134
146
  case "end":
135
147
  return _context.stop();
136
148
  }
@@ -141,7 +153,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
141
153
  };
142
154
  }();
143
155
  void fetchSiteDisplayNames();
144
- }, []);
156
+ }, [fireEvent]);
145
157
  (0, _react.useEffect)(function () {
146
158
  if (!cloudId && selectedJiraSite) {
147
159
  setCloudId(selectedJiraSite.cloudId);
@@ -327,4 +339,17 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
327
339
  testId: 'jira-jql-datasource-modal--insert-button'
328
340
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesButtonText)))));
329
341
  };
342
+ exports.PlainJiraIssuesConfigModal = PlainJiraIssuesConfigModal;
343
+ var analyticsContextAttributes = {
344
+ dataProvider: 'jira-issues'
345
+ };
346
+ var analyticsContextData = {
347
+ packageName: _version.name,
348
+ packageVersion: _version.version,
349
+ source: 'datasourceConfigModal'
350
+ };
351
+ var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
352
+ attributes: _objectSpread({}, analyticsContextAttributes)
353
+ });
354
+ var JiraIssuesConfigModal = (0, _analyticsNext.withAnalyticsContext)(contextData)(PlainJiraIssuesConfigModal);
330
355
  exports.JiraIssuesConfigModal = JiraIssuesConfigModal;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.3",
3
+ "version": "0.33.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export const EVENT_CHANNEL = 'media';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Generates Typescript types for analytics events from analytics.spec.yaml
5
+ *
6
+ * @codegen <<SignedSource::819168596ba17484cadda969f8ecf82d>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+
10
+ const createEventPayload = (eventKey, ...[attributes]) => {
11
+ const [eventType, actionSubject, action, actionSubjectId] = eventKey.split('.');
12
+ if (eventType === 'screen') {
13
+ return {
14
+ eventType,
15
+ name: actionSubject,
16
+ action: 'viewed',
17
+ attributes: attributes
18
+ };
19
+ }
20
+ return {
21
+ eventType,
22
+ actionSubject,
23
+ action,
24
+ actionSubjectId,
25
+ attributes: attributes
26
+ };
27
+ };
28
+ export default createEventPayload;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Generates Typescript types for analytics events from analytics.spec.yaml
5
+ *
6
+ * @codegen <<SignedSource::415836762b378b7d79f3aff4ba051c14>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+ import { useCallback } from 'react';
10
+ import { useAnalyticsEvents as useAnalyticsNextEvents } from '@atlaskit/analytics-next';
11
+ import { EVENT_CHANNEL } from '../constants';
12
+ import createEventPayload from './create-event-payload';
13
+ export const useAnalyticsEvents = () => {
14
+ const {
15
+ createAnalyticsEvent
16
+ } = useAnalyticsNextEvents();
17
+ const fireEvent = useCallback((...params) => {
18
+ const event = createAnalyticsEvent(createEventPayload(...params));
19
+ event.fire(EVENT_CHANNEL);
20
+ }, [createAnalyticsEvent]);
21
+ return {
22
+ fireEvent
23
+ };
24
+ };
@@ -0,0 +1,3 @@
1
+ export { EVENT_CHANNEL } from './constants';
2
+ import { useAnalyticsEvents } from './generated/use-analytics-events';
3
+ export const useDatasourceAnalyticsEvents = () => useAnalyticsEvents();
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { jsx } from '@emotion/react';
3
4
  import { useIntl } from 'react-intl-next';
4
5
  import EmptyState from '@atlaskit/empty-state';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { AccessRequiredSVG } from './access-required-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  export const AccessRequired = ({
@@ -10,6 +12,14 @@ export const AccessRequired = ({
10
12
  const {
11
13
  formatMessage
12
14
  } = useIntl();
15
+ const {
16
+ fireEvent
17
+ } = useDatasourceAnalyticsEvents();
18
+ useEffect(() => {
19
+ fireEvent('ui.error.shown', {
20
+ reason: 'access'
21
+ });
22
+ }, [fireEvent]);
13
23
  return jsx(EmptyState, {
14
24
  header: siteName ? formatMessage(loadingErrorMessages.accessRequiredWithSite, {
15
25
  siteName
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import Button from '@atlaskit/button/standard-button';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  const errorContainerStyles = css({
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
25
27
  export const LoadingError = ({
26
28
  onRefresh
27
29
  }) => {
30
+ const {
31
+ fireEvent
32
+ } = useDatasourceAnalyticsEvents();
33
+ useEffect(() => {
34
+ fireEvent('ui.error.shown', {
35
+ reason: 'network'
36
+ });
37
+ }, [fireEvent]);
28
38
  return jsx("div", {
29
39
  css: errorContainerStyles,
30
40
  "data-testid": "jira-jql-datasource--loading-error"
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
+ import { useEffect } from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { FormattedMessage } from 'react-intl-next';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  const errorContainerStyles = css({
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
25
27
  export const ModalLoadingError = ({
26
28
  url
27
29
  }) => {
30
+ const {
31
+ fireEvent
32
+ } = useDatasourceAnalyticsEvents();
33
+ useEffect(() => {
34
+ fireEvent('ui.error.shown', {
35
+ reason: 'network'
36
+ });
37
+ }, [fireEvent]);
28
38
  return jsx("div", {
29
39
  css: errorContainerStyles,
30
40
  "data-testid": "jira-jql-datasource-modal--loading-error"
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import Button from '@atlaskit/button/standard-button';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { loadingErrorMessages } from './messages';
6
8
  const noResultsContainerStyles = css({
7
9
  display: 'grid',
@@ -21,6 +23,12 @@ const noResultsMessageStyles = css({
21
23
  export const NoResults = ({
22
24
  onRefresh
23
25
  }) => {
26
+ const {
27
+ fireEvent
28
+ } = useDatasourceAnalyticsEvents();
29
+ useEffect(() => {
30
+ fireEvent('ui.emptyResult.shown.datasource', {});
31
+ }, [fireEvent]);
24
32
  return jsx("div", {
25
33
  css: noResultsContainerStyles,
26
34
  "data-testid": "jira-jql-datasource-modal--no-results"
@@ -66,7 +66,8 @@ export const DatasourceTableView = ({
66
66
  scrollableContainerHeight: 590
67
67
  }) : jsx(EmptyState, {
68
68
  testId: "datasource-table-view-skeleton",
69
- isCompact: true
69
+ isCompact: true,
70
+ isLoading: !isDataReady || status === 'loading'
70
71
  }), jsx(TableFooter, {
71
72
  issueCount: isDataReady ? totalCount : undefined,
72
73
  onRefresh: reset,
@@ -63,13 +63,15 @@ const renderItem = ({
63
63
  type,
64
64
  summaryWidth,
65
65
  statusWidth
66
- }) => {
66
+ }, isShimmering) => {
67
67
  switch (key) {
68
68
  case 'assignee':
69
69
  return jsx(UserType, null, jsx(Skeleton, {
70
- width: width,
70
+ borderRadius: 8,
71
+ testId: "empty-state-skeleton",
71
72
  height: 13,
72
- borderRadius: 8
73
+ isShimmering: isShimmering,
74
+ width: width
73
75
  }));
74
76
  case 'priority':
75
77
  return jsx(Priority, {
@@ -82,27 +84,34 @@ const renderItem = ({
82
84
  case 'summary':
83
85
  return jsx(Skeleton, {
84
86
  appearance: "blue",
85
- width: summaryWidth,
86
87
  borderRadius: 10,
87
- height: 13
88
+ testId: "empty-state-skeleton",
89
+ height: 13,
90
+ isShimmering: isShimmering,
91
+ width: summaryWidth
88
92
  });
89
93
  case 'status':
90
94
  return jsx(Skeleton, {
91
95
  appearance: "blue",
92
- width: statusWidth,
96
+ borderRadius: 3,
97
+ testId: "empty-state-skeleton",
93
98
  height: 16,
94
- borderRadius: 3
99
+ isShimmering: isShimmering,
100
+ width: statusWidth
95
101
  });
96
102
  default:
97
103
  return jsx(Skeleton, {
98
- width: width,
104
+ borderRadius: 8,
105
+ testId: "empty-state-skeleton",
99
106
  height: 13,
100
- borderRadius: 8
107
+ isShimmering: isShimmering,
108
+ width: width
101
109
  });
102
110
  }
103
111
  };
104
112
  export default (({
105
113
  isCompact,
114
+ isLoading = false,
106
115
  testId
107
116
  }) => {
108
117
  const columnsToRender = isCompact ? baseColumns.slice(0, 6) : baseColumns;
@@ -118,9 +127,11 @@ export default (({
118
127
  }
119
128
  }, jsx(Skeleton, {
120
129
  appearance: "darkGray",
121
- width: width,
130
+ borderRadius: 8,
131
+ testId: "empty-state-skeleton",
132
+ isShimmering: isLoading,
122
133
  height: 13,
123
- borderRadius: 8
134
+ width: width
124
135
  }))))), jsx("tbody", {
125
136
  css: tableBodyStyles
126
137
  }, rows.map(row => jsx("tr", {
@@ -128,5 +139,5 @@ export default (({
128
139
  }, columnsToRender.map(column => jsx("td", {
129
140
  css: cellStyles,
130
141
  key: column.key
131
- }, renderItem(column, row)))))));
142
+ }, renderItem(column, row, isLoading)))))));
132
143
  });
@@ -2,6 +2,7 @@
2
2
  import React, { useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { useIntl } from 'react-intl-next';
5
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
6
  import { BasicSearchInput } from '../basic-search-input';
6
7
  import { JiraJQLEditor } from '../jql-editor';
7
8
  import { ModeSwitcher } from '../mode-switcher';
@@ -34,6 +35,9 @@ export const JiraSearchContainer = props => {
34
35
  const [jql, setJql] = useState(initialJql || DEFAULT_JQL_QUERY);
35
36
  const [orderKey, setOrderKey] = useState();
36
37
  const [orderDirection, setOrderDirection] = useState();
38
+ const {
39
+ fireEvent
40
+ } = useDatasourceAnalyticsEvents();
37
41
  const onSearchModeChange = searchMode => {
38
42
  setCurrentSearchMode(searchMode);
39
43
  };
@@ -65,6 +69,11 @@ export const JiraSearchContainer = props => {
65
69
  onSearch({
66
70
  jql
67
71
  });
72
+ if (currentSearchMode === basicModeValue) {
73
+ fireEvent('ui.form.submitted.basicSearch', {});
74
+ } else if (currentSearchMode === jqlModeValue) {
75
+ fireEvent('ui.jqlEditor.searched', {});
76
+ }
68
77
  };
69
78
  return jsx("div", {
70
79
  css: inputContainerStyles
@@ -3,11 +3,14 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import { useCallback, useEffect, useMemo, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
6
+ import { withAnalyticsContext } from '@atlaskit/analytics-next';
6
7
  import Button from '@atlaskit/button/standard-button';
7
8
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
8
9
  import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
10
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
9
11
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
10
12
  import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
13
+ import { name as packageName, version as packageVersion } from '../../../version.json';
11
14
  import { AccessRequired } from '../../common/error-state/access-required';
12
15
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
13
16
  import { NoResults } from '../../common/error-state/no-results';
@@ -42,7 +45,7 @@ const issueCountStyles = css({
42
45
  const smartLinkContainerStyles = css({
43
46
  paddingLeft: '1px'
44
47
  });
45
- export const JiraIssuesConfigModal = props => {
48
+ export const PlainJiraIssuesConfigModal = props => {
46
49
  const {
47
50
  datasourceId,
48
51
  parameters: initialParameters,
@@ -78,11 +81,17 @@ export const JiraIssuesConfigModal = props => {
78
81
  const {
79
82
  formatMessage
80
83
  } = useIntl();
84
+ const {
85
+ fireEvent
86
+ } = useDatasourceAnalyticsEvents();
81
87
  const selectedJiraSite = useMemo(() => availableSites.find(jiraSite => jiraSite.cloudId === cloudId) || availableSites[0], [availableSites, cloudId]);
82
88
  const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
83
89
  const jqlUrl = selectedJiraSite && jql && `${selectedJiraSite.url}/issues/?jql=${encodeURI(jql)}`;
84
90
  const isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
85
91
  const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
92
+ useEffect(() => {
93
+ fireEvent('screen.datasourceModalDialog.viewed', {});
94
+ }, [fireEvent]);
86
95
  useEffect(() => {
87
96
  const newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
88
97
  setVisibleColumnKeys(newVisibleColumnKeys);
@@ -91,9 +100,12 @@ export const JiraIssuesConfigModal = props => {
91
100
  const fetchSiteDisplayNames = async () => {
92
101
  const jiraSites = await getAvailableJiraSites();
93
102
  setAvailableSites(jiraSites);
103
+ fireEvent('ui.modal.ready.datasource', {
104
+ instancesCount: jiraSites.length
105
+ });
94
106
  };
95
107
  void fetchSiteDisplayNames();
96
- }, []);
108
+ }, [fireEvent]);
97
109
  useEffect(() => {
98
110
  if (!cloudId && selectedJiraSite) {
99
111
  setCloudId(selectedJiraSite.cloudId);
@@ -273,4 +285,19 @@ export const JiraIssuesConfigModal = props => {
273
285
  isDisabled: isInsertDisabled,
274
286
  testId: 'jira-jql-datasource-modal--insert-button'
275
287
  }, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
276
- };
288
+ };
289
+ const analyticsContextAttributes = {
290
+ dataProvider: 'jira-issues'
291
+ };
292
+ const analyticsContextData = {
293
+ packageName,
294
+ packageVersion,
295
+ source: 'datasourceConfigModal'
296
+ };
297
+ const contextData = {
298
+ ...analyticsContextData,
299
+ attributes: {
300
+ ...analyticsContextAttributes
301
+ }
302
+ };
303
+ export const JiraIssuesConfigModal = withAnalyticsContext(contextData)(PlainJiraIssuesConfigModal);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.3",
3
+ "version": "0.33.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export var EVENT_CHANNEL = 'media';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ /**
3
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
4
+ *
5
+ * Generates Typescript types for analytics events from analytics.spec.yaml
6
+ *
7
+ * @codegen <<SignedSource::819168596ba17484cadda969f8ecf82d>>
8
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
9
+ */
10
+
11
+ var createEventPayload = function createEventPayload(eventKey) {
12
+ for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13
+ _ref[_key - 1] = arguments[_key];
14
+ }
15
+ var attributes = _ref[0];
16
+ var _eventKey$split = eventKey.split('.'),
17
+ _eventKey$split2 = _slicedToArray(_eventKey$split, 4),
18
+ eventType = _eventKey$split2[0],
19
+ actionSubject = _eventKey$split2[1],
20
+ action = _eventKey$split2[2],
21
+ actionSubjectId = _eventKey$split2[3];
22
+ if (eventType === 'screen') {
23
+ return {
24
+ eventType: eventType,
25
+ name: actionSubject,
26
+ action: 'viewed',
27
+ attributes: attributes
28
+ };
29
+ }
30
+ return {
31
+ eventType: eventType,
32
+ actionSubject: actionSubject,
33
+ action: action,
34
+ actionSubjectId: actionSubjectId,
35
+ attributes: attributes
36
+ };
37
+ };
38
+ export default createEventPayload;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Generates Typescript types for analytics events from analytics.spec.yaml
5
+ *
6
+ * @codegen <<SignedSource::415836762b378b7d79f3aff4ba051c14>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+ import { useCallback } from 'react';
10
+ import { useAnalyticsEvents as useAnalyticsNextEvents } from '@atlaskit/analytics-next';
11
+ import { EVENT_CHANNEL } from '../constants';
12
+ import createEventPayload from './create-event-payload';
13
+ export var useAnalyticsEvents = function useAnalyticsEvents() {
14
+ var _useAnalyticsNextEven = useAnalyticsNextEvents(),
15
+ createAnalyticsEvent = _useAnalyticsNextEven.createAnalyticsEvent;
16
+ var fireEvent = useCallback(function () {
17
+ var event = createAnalyticsEvent(createEventPayload.apply(void 0, arguments));
18
+ event.fire(EVENT_CHANNEL);
19
+ }, [createAnalyticsEvent]);
20
+ return {
21
+ fireEvent: fireEvent
22
+ };
23
+ };
@@ -0,0 +1,5 @@
1
+ export { EVENT_CHANNEL } from './constants';
2
+ import { useAnalyticsEvents } from './generated/use-analytics-events';
3
+ export var useDatasourceAnalyticsEvents = function useDatasourceAnalyticsEvents() {
4
+ return useAnalyticsEvents();
5
+ };
@@ -1,13 +1,22 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { jsx } from '@emotion/react';
3
4
  import { useIntl } from 'react-intl-next';
4
5
  import EmptyState from '@atlaskit/empty-state';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { AccessRequiredSVG } from './access-required-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  export var AccessRequired = function AccessRequired(_ref) {
8
10
  var siteName = _ref.siteName;
9
11
  var _useIntl = useIntl(),
10
12
  formatMessage = _useIntl.formatMessage;
13
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
14
+ fireEvent = _useDatasourceAnalyti.fireEvent;
15
+ useEffect(function () {
16
+ fireEvent('ui.error.shown', {
17
+ reason: 'access'
18
+ });
19
+ }, [fireEvent]);
11
20
  return jsx(EmptyState, {
12
21
  header: siteName ? formatMessage(loadingErrorMessages.accessRequiredWithSite, {
13
22
  siteName: siteName
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import Button from '@atlaskit/button/standard-button';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  var errorContainerStyles = css({
@@ -24,6 +26,13 @@ var errorDescriptionStyles = css({
24
26
  });
25
27
  export var LoadingError = function LoadingError(_ref) {
26
28
  var onRefresh = _ref.onRefresh;
29
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
30
+ fireEvent = _useDatasourceAnalyti.fireEvent;
31
+ useEffect(function () {
32
+ fireEvent('ui.error.shown', {
33
+ reason: 'network'
34
+ });
35
+ }, [fireEvent]);
27
36
  return jsx("div", {
28
37
  css: errorContainerStyles,
29
38
  "data-testid": "jira-jql-datasource--loading-error"
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
+ import { useEffect } from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { FormattedMessage } from 'react-intl-next';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  var errorContainerStyles = css({
@@ -24,6 +26,13 @@ var errorDescriptionStyles = css({
24
26
  });
25
27
  export var ModalLoadingError = function ModalLoadingError(_ref) {
26
28
  var url = _ref.url;
29
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
30
+ fireEvent = _useDatasourceAnalyti.fireEvent;
31
+ useEffect(function () {
32
+ fireEvent('ui.error.shown', {
33
+ reason: 'network'
34
+ });
35
+ }, [fireEvent]);
27
36
  return jsx("div", {
28
37
  css: errorContainerStyles,
29
38
  "data-testid": "jira-jql-datasource-modal--loading-error"