@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
@@ -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
  var noResultsContainerStyles = css({
7
9
  display: 'grid',
@@ -20,6 +22,11 @@ var noResultsMessageStyles = css({
20
22
  });
21
23
  export var NoResults = function NoResults(_ref) {
22
24
  var onRefresh = _ref.onRefresh;
25
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
26
+ fireEvent = _useDatasourceAnalyti.fireEvent;
27
+ useEffect(function () {
28
+ fireEvent('ui.emptyResult.shown.datasource', {});
29
+ }, [fireEvent]);
23
30
  return jsx("div", {
24
31
  css: noResultsContainerStyles,
25
32
  "data-testid": "jira-jql-datasource-modal--no-results"
@@ -64,7 +64,8 @@ export var DatasourceTableView = function DatasourceTableView(_ref) {
64
64
  scrollableContainerHeight: 590
65
65
  }) : jsx(EmptyState, {
66
66
  testId: "datasource-table-view-skeleton",
67
- isCompact: true
67
+ isCompact: true,
68
+ isLoading: !isDataReady || status === 'loading'
68
69
  }), jsx(TableFooter, {
69
70
  issueCount: isDataReady ? totalCount : undefined,
70
71
  onRefresh: reset,
@@ -57,7 +57,7 @@ var cellStyles = css({
57
57
  paddingRight: "var(--ds-space-100, 8px)"
58
58
  }
59
59
  });
60
- var renderItem = function renderItem(_ref, _ref2) {
60
+ var renderItem = function renderItem(_ref, _ref2, isShimmering) {
61
61
  var key = _ref.key,
62
62
  width = _ref.width;
63
63
  var priority = _ref2.priority,
@@ -67,9 +67,11 @@ var renderItem = function renderItem(_ref, _ref2) {
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,35 @@ var renderItem = function renderItem(_ref, _ref2) {
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 (function (_ref3) {
105
113
  var isCompact = _ref3.isCompact,
114
+ _ref3$isLoading = _ref3.isLoading,
115
+ isLoading = _ref3$isLoading === void 0 ? false : _ref3$isLoading,
106
116
  testId = _ref3.testId;
107
117
  var columnsToRender = isCompact ? baseColumns.slice(0, 6) : baseColumns;
108
118
  return jsx("table", {
@@ -117,9 +127,11 @@ export default (function (_ref3) {
117
127
  }
118
128
  }, jsx(Skeleton, {
119
129
  appearance: "darkGray",
120
- width: width,
130
+ borderRadius: 8,
131
+ testId: "empty-state-skeleton",
132
+ isShimmering: isLoading,
121
133
  height: 13,
122
- borderRadius: 8
134
+ width: width
123
135
  }));
124
136
  }))), jsx("tbody", {
125
137
  css: tableBodyStyles
@@ -130,7 +142,7 @@ export default (function (_ref3) {
130
142
  return jsx("td", {
131
143
  css: cellStyles,
132
144
  key: column.key
133
- }, renderItem(column, row));
145
+ }, renderItem(column, row, isLoading));
134
146
  }));
135
147
  })));
136
148
  });
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { useIntl } from 'react-intl-next';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
6
7
  import { BasicSearchInput } from '../basic-search-input';
7
8
  import { JiraJQLEditor } from '../jql-editor';
8
9
  import { ModeSwitcher } from '../mode-switcher';
@@ -46,6 +47,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
46
47
  _useState10 = _slicedToArray(_useState9, 2),
47
48
  orderDirection = _useState10[0],
48
49
  setOrderDirection = _useState10[1];
50
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
51
+ fireEvent = _useDatasourceAnalyti.fireEvent;
49
52
  var onSearchModeChange = function onSearchModeChange(searchMode) {
50
53
  setCurrentSearchMode(searchMode);
51
54
  };
@@ -79,6 +82,11 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
79
82
  onSearch({
80
83
  jql: jql
81
84
  });
85
+ if (currentSearchMode === basicModeValue) {
86
+ fireEvent('ui.form.submitted.basicSearch', {});
87
+ } else if (currentSearchMode === jqlModeValue) {
88
+ fireEvent('ui.jqlEditor.searched', {});
89
+ }
82
90
  };
83
91
  return jsx("div", {
84
92
  css: inputContainerStyles
@@ -1,16 +1,22 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ 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; }
6
+ 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) { _defineProperty(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; }
4
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
8
  /** @jsx jsx */
6
9
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
10
  import { css, jsx } from '@emotion/react';
8
11
  import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
12
+ import { withAnalyticsContext } from '@atlaskit/analytics-next';
9
13
  import Button from '@atlaskit/button/standard-button';
10
14
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
11
15
  import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
16
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
12
17
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
13
18
  import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
19
+ import { name as packageName, version as packageVersion } from '../../../version.json';
14
20
  import { AccessRequired } from '../../common/error-state/access-required';
15
21
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
16
22
  import { NoResults } from '../../common/error-state/no-results';
@@ -45,7 +51,7 @@ var issueCountStyles = css({
45
51
  var smartLinkContainerStyles = css({
46
52
  paddingLeft: '1px'
47
53
  });
48
- export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
54
+ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
49
55
  var datasourceId = props.datasourceId,
50
56
  initialParameters = props.parameters,
51
57
  initialVisibleColumnKeys = props.visibleColumnKeys,
@@ -94,6 +100,8 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
94
100
  totalCount = _useDatasourceTableSt.totalCount;
95
101
  var _useIntl = useIntl(),
96
102
  formatMessage = _useIntl.formatMessage;
103
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
104
+ fireEvent = _useDatasourceAnalyti.fireEvent;
97
105
  var selectedJiraSite = useMemo(function () {
98
106
  return availableSites.find(function (jiraSite) {
99
107
  return jiraSite.cloudId === cloudId;
@@ -103,6 +111,9 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
103
111
  var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
104
112
  var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
105
113
  var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
114
+ useEffect(function () {
115
+ fireEvent('screen.datasourceModalDialog.viewed', {});
116
+ }, [fireEvent]);
106
117
  useEffect(function () {
107
118
  var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
108
119
  setVisibleColumnKeys(newVisibleColumnKeys);
@@ -119,7 +130,10 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
119
130
  case 2:
120
131
  jiraSites = _context.sent;
121
132
  setAvailableSites(jiraSites);
122
- case 4:
133
+ fireEvent('ui.modal.ready.datasource', {
134
+ instancesCount: jiraSites.length
135
+ });
136
+ case 5:
123
137
  case "end":
124
138
  return _context.stop();
125
139
  }
@@ -130,7 +144,7 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
130
144
  };
131
145
  }();
132
146
  void fetchSiteDisplayNames();
133
- }, []);
147
+ }, [fireEvent]);
134
148
  useEffect(function () {
135
149
  if (!cloudId && selectedJiraSite) {
136
150
  setCloudId(selectedJiraSite.cloudId);
@@ -315,4 +329,16 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
315
329
  isDisabled: isInsertDisabled,
316
330
  testId: 'jira-jql-datasource-modal--insert-button'
317
331
  }, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
318
- };
332
+ };
333
+ var analyticsContextAttributes = {
334
+ dataProvider: 'jira-issues'
335
+ };
336
+ var analyticsContextData = {
337
+ packageName: packageName,
338
+ packageVersion: packageVersion,
339
+ source: 'datasourceConfigModal'
340
+ };
341
+ var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
342
+ attributes: _objectSpread({}, analyticsContextAttributes)
343
+ });
344
+ export var 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 declare const EVENT_CHANNEL = "media";
@@ -0,0 +1,49 @@
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::75446f307933096c01c4784a1d7f2aa9>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+ export type PackageMetaDataType = {
10
+ packageName: '@atlaskit/link-datasource';
11
+ packageVersion: string;
12
+ };
13
+ export type AnalyticsContextType = {
14
+ source: 'datasourceConfigModal' | 'datasourceConfluenceEditor';
15
+ };
16
+ export type AnalyticsContextAttributesType = {
17
+ dataProvider: 'jira-issues';
18
+ };
19
+ export type DatasourceModalDialogViewedAttributesType = {};
20
+ export type ModalReadyDatasourceAttributesType = {
21
+ instancesCount: number;
22
+ };
23
+ export type JqlEditorSearchedAttributesType = {};
24
+ export type FormSubmittedBasicSearchAttributesType = {};
25
+ export type EmptyResultShownDatasourceAttributesType = {};
26
+ export type ErrorShownAttributesType = {
27
+ reason: 'network' | 'access';
28
+ };
29
+ export type AnalyticsEventAttributes = {
30
+ /**
31
+ * Fires when user sees modal dialog. */
32
+ 'screen.datasourceModalDialog.viewed': DatasourceModalDialogViewedAttributesType;
33
+ /**
34
+ * Fires when the datasource modal is ready for searching and displaying search results. */
35
+ 'ui.modal.ready.datasource': ModalReadyDatasourceAttributesType;
36
+ /**
37
+ * Fires when search is initiated via the search icon or enter key press for jql editor input field. */
38
+ 'ui.jqlEditor.searched': JqlEditorSearchedAttributesType;
39
+ /**
40
+ * Fires when search is initiated via the search icon or enter key press from the basic input textfield. */
41
+ 'ui.form.submitted.basicSearch': FormSubmittedBasicSearchAttributesType;
42
+ /**
43
+ * Fires when datasource results are empty. */
44
+ 'ui.emptyResult.shown.datasource': EmptyResultShownDatasourceAttributesType;
45
+ /**
46
+ * Fires when datasource errors state is shown. */
47
+ 'ui.error.shown': ErrorShownAttributesType;
48
+ };
49
+ export type EventKey = keyof AnalyticsEventAttributes;
@@ -0,0 +1,27 @@
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
+ import { AnalyticsEventAttributes, EventKey } from './analytics.types';
10
+ type OptionalIfUndefined<T> = undefined extends T ? [param?: T] : [param: T];
11
+ export type EventPayloadAttributes<K extends EventKey> = OptionalIfUndefined<AnalyticsEventAttributes[K]>;
12
+ type EventTypes = 'ui' | 'track' | 'operational' | 'screen';
13
+ type ScreenEventPayload<K extends EventKey> = {
14
+ eventType: 'screen';
15
+ name: string;
16
+ action: 'viewed';
17
+ attributes?: AnalyticsEventAttributes[K];
18
+ };
19
+ type EventPayload<K extends EventKey> = {
20
+ eventType: Omit<EventTypes, 'screen'>;
21
+ actionSubject: string;
22
+ action: string;
23
+ actionSubjectId?: string;
24
+ attributes?: AnalyticsEventAttributes[K];
25
+ };
26
+ declare const createEventPayload: <K extends keyof AnalyticsEventAttributes>(eventKey: K, ...[attributes]: OptionalIfUndefined<AnalyticsEventAttributes[K]>) => ScreenEventPayload<K> | EventPayload<K>;
27
+ export default createEventPayload;
@@ -0,0 +1,3 @@
1
+ export declare const useAnalyticsEvents: () => {
2
+ fireEvent: <K extends keyof import("./analytics.types").AnalyticsEventAttributes>(params_0: K, ...params_1: undefined extends import("./analytics.types").AnalyticsEventAttributes[K] ? [param?: import("./analytics.types").AnalyticsEventAttributes[K] | undefined] : [param: import("./analytics.types").AnalyticsEventAttributes[K]]) => void;
3
+ };
@@ -0,0 +1,4 @@
1
+ export { EVENT_CHANNEL } from './constants';
2
+ export declare const useDatasourceAnalyticsEvents: () => {
3
+ fireEvent: <K extends keyof import("./generated/analytics.types").AnalyticsEventAttributes>(params_0: K, ...params_1: undefined extends import("./generated/analytics.types").AnalyticsEventAttributes[K] ? [param?: import("./generated/analytics.types").AnalyticsEventAttributes[K] | undefined] : [param: import("./generated/analytics.types").AnalyticsEventAttributes[K]]) => void;
4
+ };
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface AccessRequiredProps {
4
3
  siteName?: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface LoadingErrorProps {
4
3
  onRefresh?: () => void;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface ModalLoadingErrorProps {
4
3
  url?: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface NoResultsProps {
4
3
  onRefresh?: () => void;
@@ -2,7 +2,8 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  export interface Props {
4
4
  isCompact?: boolean;
5
+ isLoading?: boolean;
5
6
  testId?: string;
6
7
  }
7
- declare const _default: ({ isCompact, testId }: Props) => jsx.JSX.Element;
8
+ declare const _default: ({ isCompact, isLoading, testId }: Props) => jsx.JSX.Element;
8
9
  export default _default;
@@ -13,4 +13,4 @@ export interface RowCellType {
13
13
  maxWidth?: number;
14
14
  }
15
15
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
16
- export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
16
+ export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
1
2
  import { jsx } from '@emotion/react';
2
3
  import { JiraIssuesConfigModalProps } from '../types';
3
- export declare const JiraIssuesConfigModal: (props: JiraIssuesConfigModalProps) => jsx.JSX.Element;
4
+ export declare const PlainJiraIssuesConfigModal: (props: JiraIssuesConfigModalProps) => jsx.JSX.Element;
5
+ export declare const JiraIssuesConfigModal: import("react").ForwardRefExoticComponent<JiraIssuesConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
@@ -0,0 +1 @@
1
+ export declare const EVENT_CHANNEL = "media";
@@ -0,0 +1,49 @@
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::75446f307933096c01c4784a1d7f2aa9>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+ export type PackageMetaDataType = {
10
+ packageName: '@atlaskit/link-datasource';
11
+ packageVersion: string;
12
+ };
13
+ export type AnalyticsContextType = {
14
+ source: 'datasourceConfigModal' | 'datasourceConfluenceEditor';
15
+ };
16
+ export type AnalyticsContextAttributesType = {
17
+ dataProvider: 'jira-issues';
18
+ };
19
+ export type DatasourceModalDialogViewedAttributesType = {};
20
+ export type ModalReadyDatasourceAttributesType = {
21
+ instancesCount: number;
22
+ };
23
+ export type JqlEditorSearchedAttributesType = {};
24
+ export type FormSubmittedBasicSearchAttributesType = {};
25
+ export type EmptyResultShownDatasourceAttributesType = {};
26
+ export type ErrorShownAttributesType = {
27
+ reason: 'network' | 'access';
28
+ };
29
+ export type AnalyticsEventAttributes = {
30
+ /**
31
+ * Fires when user sees modal dialog. */
32
+ 'screen.datasourceModalDialog.viewed': DatasourceModalDialogViewedAttributesType;
33
+ /**
34
+ * Fires when the datasource modal is ready for searching and displaying search results. */
35
+ 'ui.modal.ready.datasource': ModalReadyDatasourceAttributesType;
36
+ /**
37
+ * Fires when search is initiated via the search icon or enter key press for jql editor input field. */
38
+ 'ui.jqlEditor.searched': JqlEditorSearchedAttributesType;
39
+ /**
40
+ * Fires when search is initiated via the search icon or enter key press from the basic input textfield. */
41
+ 'ui.form.submitted.basicSearch': FormSubmittedBasicSearchAttributesType;
42
+ /**
43
+ * Fires when datasource results are empty. */
44
+ 'ui.emptyResult.shown.datasource': EmptyResultShownDatasourceAttributesType;
45
+ /**
46
+ * Fires when datasource errors state is shown. */
47
+ 'ui.error.shown': ErrorShownAttributesType;
48
+ };
49
+ export type EventKey = keyof AnalyticsEventAttributes;
@@ -0,0 +1,31 @@
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
+ import { AnalyticsEventAttributes, EventKey } from './analytics.types';
10
+ type OptionalIfUndefined<T> = undefined extends T ? [
11
+ param?: T
12
+ ] : [
13
+ param: T
14
+ ];
15
+ export type EventPayloadAttributes<K extends EventKey> = OptionalIfUndefined<AnalyticsEventAttributes[K]>;
16
+ type EventTypes = 'ui' | 'track' | 'operational' | 'screen';
17
+ type ScreenEventPayload<K extends EventKey> = {
18
+ eventType: 'screen';
19
+ name: string;
20
+ action: 'viewed';
21
+ attributes?: AnalyticsEventAttributes[K];
22
+ };
23
+ type EventPayload<K extends EventKey> = {
24
+ eventType: Omit<EventTypes, 'screen'>;
25
+ actionSubject: string;
26
+ action: string;
27
+ actionSubjectId?: string;
28
+ attributes?: AnalyticsEventAttributes[K];
29
+ };
30
+ declare const createEventPayload: <K extends keyof AnalyticsEventAttributes>(eventKey: K, ...[attributes]: OptionalIfUndefined<AnalyticsEventAttributes[K]>) => ScreenEventPayload<K> | EventPayload<K>;
31
+ export default createEventPayload;
@@ -0,0 +1,7 @@
1
+ export declare const useAnalyticsEvents: () => {
2
+ fireEvent: <K extends keyof import("./analytics.types").AnalyticsEventAttributes>(params_0: K, ...params_1: undefined extends import("./analytics.types").AnalyticsEventAttributes[K] ? [
3
+ param?: import("./analytics.types").AnalyticsEventAttributes[K] | undefined
4
+ ] : [
5
+ param: import("./analytics.types").AnalyticsEventAttributes[K]
6
+ ]) => void;
7
+ };
@@ -0,0 +1,8 @@
1
+ export { EVENT_CHANNEL } from './constants';
2
+ export declare const useDatasourceAnalyticsEvents: () => {
3
+ fireEvent: <K extends keyof import("./generated/analytics.types").AnalyticsEventAttributes>(params_0: K, ...params_1: undefined extends import("./generated/analytics.types").AnalyticsEventAttributes[K] ? [
4
+ param?: import("./generated/analytics.types").AnalyticsEventAttributes[K] | undefined
5
+ ] : [
6
+ param: import("./generated/analytics.types").AnalyticsEventAttributes[K]
7
+ ]) => void;
8
+ };
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface AccessRequiredProps {
4
3
  siteName?: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface LoadingErrorProps {
4
3
  onRefresh?: () => void;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface ModalLoadingErrorProps {
4
3
  url?: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  interface NoResultsProps {
4
3
  onRefresh?: () => void;
@@ -2,7 +2,8 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  export interface Props {
4
4
  isCompact?: boolean;
5
+ isLoading?: boolean;
5
6
  testId?: string;
6
7
  }
7
- declare const _default: ({ isCompact, testId }: Props) => jsx.JSX.Element;
8
+ declare const _default: ({ isCompact, isLoading, testId }: Props) => jsx.JSX.Element;
8
9
  export default _default;
@@ -13,4 +13,4 @@ export interface RowCellType {
13
13
  maxWidth?: number;
14
14
  }
15
15
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
16
- export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
16
+ export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
1
2
  import { jsx } from '@emotion/react';
2
3
  import { JiraIssuesConfigModalProps } from '../types';
3
- export declare const JiraIssuesConfigModal: (props: JiraIssuesConfigModalProps) => jsx.JSX.Element;
4
+ export declare const PlainJiraIssuesConfigModal: (props: JiraIssuesConfigModalProps) => jsx.JSX.Element;
5
+ export declare const JiraIssuesConfigModal: import("react").ForwardRefExoticComponent<JiraIssuesConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.3",
3
+ "version": "0.33.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,11 @@
26
26
  "inPublicMirror": false,
27
27
  "releaseModel": "continuous"
28
28
  },
29
+ "scripts": {
30
+ "analytics:codegen": "yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource --output ./src/analytics/generated"
31
+ },
29
32
  "dependencies": {
33
+ "@atlaskit/analytics-next": "^9.1.3",
30
34
  "@atlaskit/avatar": "^21.3.0",
31
35
  "@atlaskit/button": "^16.8.0",
32
36
  "@atlaskit/dropdown-menu": "^11.11.0",
@@ -51,7 +55,7 @@
51
55
  "@atlaskit/tag": "^11.5.0",
52
56
  "@atlaskit/textfield": "5.6.3",
53
57
  "@atlaskit/theme": "^12.5.0",
54
- "@atlaskit/tokens": "^1.13.0",
58
+ "@atlaskit/tokens": "^1.14.0",
55
59
  "@atlassianlabs/jql-editor": "^2.0.1",
56
60
  "@atlassianlabs/jql-editor-autocomplete-rest": "^1.1.2",
57
61
  "@babel/runtime": "^7.0.0",
@@ -76,6 +80,7 @@
76
80
  "@testing-library/dom": "^8.17.1",
77
81
  "@testing-library/react": "^12.1.5",
78
82
  "@testing-library/react-hooks": "^8.0.1",
83
+ "@testing-library/user-event": "^14.4.3",
79
84
  "fetch-mock": "^8.0.0",
80
85
  "jest-fetch-mock": "^3.0.3",
81
86
  "json-ld-types": "3.8.0",