@atlaskit/link-datasource 1.17.0 → 1.17.2

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 (36) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/hooks/useAssetsClient.js +7 -4
  4. package/dist/cjs/hooks/useValidateAqlText.js +5 -2
  5. package/dist/cjs/services/cmdbService.js +50 -35
  6. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +8 -0
  7. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +59 -34
  8. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +18 -6
  9. package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/index.js +2 -1
  10. package/dist/es2019/analytics/constants.js +1 -1
  11. package/dist/es2019/hooks/useAssetsClient.js +8 -4
  12. package/dist/es2019/hooks/useValidateAqlText.js +6 -2
  13. package/dist/es2019/services/cmdbService.js +27 -12
  14. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +8 -0
  15. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +57 -27
  16. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +16 -6
  17. package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/index.js +2 -1
  18. package/dist/esm/analytics/constants.js +1 -1
  19. package/dist/esm/hooks/useAssetsClient.js +7 -4
  20. package/dist/esm/hooks/useValidateAqlText.js +5 -2
  21. package/dist/esm/services/cmdbService.js +50 -35
  22. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +8 -0
  23. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +60 -35
  24. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +18 -6
  25. package/dist/esm/ui/jira-issues-modal/basic-filters/utils/index.js +2 -1
  26. package/dist/types/analytics/generated/analytics.types.d.ts +41 -1
  27. package/dist/types/services/cmdbService.d.ts +8 -4
  28. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -0
  29. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -1
  30. package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +1 -1
  31. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +41 -1
  32. package/dist/types-ts4.5/services/cmdbService.d.ts +8 -4
  33. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -0
  34. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -1
  35. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +1 -1
  36. package/package.json +3 -3
@@ -5,7 +5,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
  var _excluded = ["isOpen"];
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
- import React, { useCallback, useEffect, useState } from 'react';
8
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
9
+ import isEqual from 'lodash/isEqual';
9
10
  import { useIntl } from 'react-intl-next';
10
11
  import { useDebouncedCallback } from 'use-debounce';
11
12
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
@@ -28,6 +29,8 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
28
29
  selection = _ref.selection,
29
30
  _ref$onSelectionChang = _ref.onSelectionChange,
30
31
  onSelectionChange = _ref$onSelectionChang === void 0 ? function () {} : _ref$onSelectionChang,
32
+ _ref$onReset = _ref.onReset,
33
+ resetSelection = _ref$onReset === void 0 ? function () {} : _ref$onReset,
31
34
  _ref$isDisabled = _ref.isDisabled,
32
35
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
33
36
  var _useIntl = useIntl(),
@@ -40,10 +43,13 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
40
43
  _useState4 = _slicedToArray(_useState3, 2),
41
44
  selectedOptions = _useState4[0],
42
45
  setSelectedOptions = _useState4[1];
43
- var _useState5 = useState(selectedOptions),
46
+ var _useState5 = useState([]),
44
47
  _useState6 = _slicedToArray(_useState5, 2),
45
48
  sortedOptions = _useState6[0],
46
49
  setSortedOptions = _useState6[1];
50
+ var currentSiteCloudId = useRef(cloudId);
51
+ var sortPaginatedResults = useRef(false); // this is to track pagination for sorting purpose
52
+
47
53
  var _useFilterOptions = useFilterOptions({
48
54
  filterType: filterType,
49
55
  cloudId: cloudId
@@ -53,6 +59,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
53
59
  totalCount = _useFilterOptions.totalCount,
54
60
  status = _useFilterOptions.status,
55
61
  pageCursor = _useFilterOptions.pageCursor,
62
+ resetHook = _useFilterOptions.reset,
56
63
  errors = _useFilterOptions.errors;
57
64
  var _useDebouncedCallback = useDebouncedCallback(function (searchString) {
58
65
  fetchFilterOptions({
@@ -80,14 +87,12 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
80
87
  return _ref2.apply(this, arguments);
81
88
  };
82
89
  }(), [handleDebouncedFetchFilterOptions, searchTerm]);
83
- var handleOptionSelection = function handleOptionSelection(newValue) {
84
- setSelectedOptions(newValue);
90
+ var handleOptionSelection = useCallback(function (newValue) {
85
91
  onSelectionChange(newValue);
86
- };
92
+ }, [onSelectionChange]);
87
93
  var sortOptionsOnPopupOpen = useCallback(function () {
88
94
  if (selectedOptions.length === 0) {
89
- setSortedOptions(filterOptions);
90
- return;
95
+ return setSortedOptions(filterOptions);
91
96
  }
92
97
  var nonSelectedOptions = filterOptions.filter(function (option) {
93
98
  return !selectedOptions.find(function (selectedOption) {
@@ -95,37 +100,41 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
95
100
  });
96
101
  });
97
102
  var newOptions = [].concat(_toConsumableArray(selectedOptions), _toConsumableArray(nonSelectedOptions));
98
- setSortedOptions(newOptions);
99
- }, [selectedOptions, filterOptions]);
103
+ if (!isEqual(newOptions, sortedOptions)) {
104
+ setSortedOptions(newOptions);
105
+ }
106
+ }, [selectedOptions, filterOptions, sortedOptions]);
100
107
  var sortOptionsOnResolve = useCallback(function () {
101
- var newOptions = filterOptions.filter(function (option) {
102
- return !sortedOptions.find(function (sortedOption) {
103
- return sortedOption.value === option.value;
104
- });
105
- });
106
- var shouldSetSortOptions = false;
107
- if (sortedOptions.length !== filterOptions.length) {
108
- shouldSetSortOptions = true;
109
- } else {
110
- sortedOptions.forEach(function (sortedOption) {
111
- if (!filterOptions.some(function (filterOption) {
112
- return filterOption.value === sortedOption.value;
113
- })) {
114
- shouldSetSortOptions = true;
115
- }
116
- });
108
+ // sortedOptions is empty initially, this will take care of setting the initial value and bring the selected items to the top
109
+ if (sortedOptions.length === 0) {
110
+ return sortOptionsOnPopupOpen();
111
+ }
112
+
113
+ // when the user is searching, we want the search result to be displayed as it is, and the select component will take care of marking the selected items
114
+ if (searchTerm) {
115
+ sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
116
+ return setSortedOptions(filterOptions);
117
117
  }
118
- if (shouldSetSortOptions) {
119
- var sortedOptionsFiltered = sortedOptions.filter(function (sortedOption) {
120
- return filterOptions.some(function (filterOption) {
121
- return filterOption.value === sortedOption.value;
118
+
119
+ // this block handles the pagination, where on pagination, we will just append newOptions to the current list
120
+ if (sortPaginatedResults.current) {
121
+ var newOptions = filterOptions.filter(function (option) {
122
+ return !sortedOptions.find(function (sortedOption) {
123
+ return sortedOption.value === option.value;
122
124
  });
123
125
  });
124
- setSortedOptions([].concat(_toConsumableArray(sortedOptionsFiltered), _toConsumableArray(newOptions)));
126
+ if (newOptions.length > 0) {
127
+ setSortedOptions([].concat(_toConsumableArray(sortedOptions), _toConsumableArray(newOptions)));
128
+ }
129
+ sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
130
+ return;
125
131
  }
126
- }, [filterOptions, sortedOptions]);
132
+ sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
133
+ sortOptionsOnPopupOpen();
134
+ }, [filterOptions, searchTerm, sortOptionsOnPopupOpen, sortedOptions]);
127
135
  var handleShowMore = useCallback(function () {
128
136
  if (pageCursor) {
137
+ sortPaginatedResults.current = true;
129
138
  fetchFilterOptions({
130
139
  pageCursor: pageCursor,
131
140
  searchString: searchTerm
@@ -146,15 +155,31 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
146
155
  if (status === 'resolved') {
147
156
  sortOptionsOnResolve();
148
157
  }
149
- }, [sortOptionsOnResolve, status]);
158
+ // eslint-disable-next-line react-hooks/exhaustive-deps
159
+ }, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
160
+
161
+ useEffect(function () {
162
+ if (currentSiteCloudId.current !== cloudId) {
163
+ currentSiteCloudId.current = cloudId;
164
+ setSortedOptions([]);
165
+ setSearchTerm('');
166
+ resetHook();
167
+ resetSelection();
168
+ }
169
+ }, [cloudId, resetHook, resetSelection]);
170
+ useEffect(function () {
171
+ if (!isEqual(selection, selectedOptions)) {
172
+ setSelectedOptions(selection);
173
+ }
174
+ }, [selectedOptions, selection]);
150
175
  var filterOptionsLength = filterOptions.length;
151
176
  var isError = status === 'rejected';
152
177
  var isLoading = status === 'loading' || status === 'empty';
153
178
  var isLoadingMore = status === 'loadingMore';
154
179
  var isEmpty = status === 'resolved' && filterOptionsLength === 0;
155
180
  var popupSelectOptions = isLoading || isError ? [] : sortedOptions; // if not set to [], then on loading, no loading UI will be shown
156
- var areAllResultsLoaded = filterOptions.length === totalCount;
157
- var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptions.length > 0; // footer should not disappear when there is an inline spinner for loading more data
181
+ var areAllResultsLoaded = filterOptionsLength === totalCount;
182
+ var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptionsLength > 0; // footer should not disappear when there is an inline spinner for loading more data
158
183
  var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
159
184
  return /*#__PURE__*/React.createElement(PopupSelect, {
160
185
  isMulti: true,
@@ -213,7 +238,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
213
238
  }));
214
239
  },
215
240
  footer: shouldShowFooter && /*#__PURE__*/React.createElement(PopupFooter, {
216
- currentDisplayCount: filterOptionsLength,
241
+ currentDisplayCount: popupSelectOptions.length,
217
242
  totalCount: totalCount
218
243
  })
219
244
  });
@@ -1,4 +1,7 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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
+ 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; }
2
5
  import React, { useCallback, useEffect, useState } from 'react';
3
6
  import { Flex, xcss } from '@atlaskit/primitives';
4
7
  import { isValidJql } from '../utils';
@@ -10,7 +13,7 @@ var basicFilterContainerStyles = xcss({
10
13
  var BasicFilterContainer = function BasicFilterContainer(_ref) {
11
14
  var jql = _ref.jql,
12
15
  cloudId = _ref.cloudId;
13
- var _useState = useState([]),
16
+ var _useState = useState({}),
14
17
  _useState2 = _slicedToArray(_useState, 2),
15
18
  selection = _useState2[0],
16
19
  setSelection = _useState2[1];
@@ -19,9 +22,15 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
19
22
  // hydrate hook call goes in here
20
23
  }
21
24
  }, [jql]);
22
- var handleSelectionChange = useCallback(function (options) {
23
- setSelection(options);
24
- }, [setSelection]);
25
+ var handleSelectionChange = useCallback(function (options, filter) {
26
+ var updatedSelection = _objectSpread(_objectSpread({}, selection), {}, _defineProperty({}, filter, options));
27
+ setSelection(updatedSelection);
28
+ }, [selection]);
29
+ var handleReset = useCallback(function () {
30
+ if (Object.keys(selection).length > 0) {
31
+ setSelection({});
32
+ }
33
+ }, [selection]);
25
34
  return /*#__PURE__*/React.createElement(Flex, {
26
35
  xcss: basicFilterContainerStyles,
27
36
  gap: "space.100",
@@ -31,9 +40,12 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
31
40
  cloudId: cloudId,
32
41
  filterType: filter,
33
42
  key: filter,
34
- selection: selection,
43
+ selection: selection[filter] || [],
35
44
  isDisabled: !cloudId,
36
- onSelectionChange: handleSelectionChange
45
+ onSelectionChange: function onSelectionChange(options) {
46
+ return handleSelectionChange(options, filter);
47
+ },
48
+ onReset: handleReset
37
49
  });
38
50
  }));
39
51
  };
@@ -1,5 +1,6 @@
1
1
  import { JastBuilder } from '@atlaskit/jql-ast';
2
2
  export var isValidJql = function isValidJql(jql) {
3
+ var _jast$errors;
3
4
  var jast = new JastBuilder().build(jql);
4
- return jast.errors.length === 0;
5
+ return (jast === null || jast === void 0 || (_jast$errors = jast.errors) === null || _jast$errors === void 0 ? void 0 : _jast$errors.length) === 0;
5
6
  };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::ddaee20abebe8b4891d75f243120dce8>>
6
+ * @codegen <<SignedSource::d3722446f615a812f3e336474f9d8d3c>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -90,6 +90,22 @@ export type ErrorShownBasicSearchDropdownAttributesType = {
90
90
  reason: 'agg' | 'network' | 'unknown';
91
91
  };
92
92
  export type AqlEditorSearchedAttributesType = {};
93
+ export type GetWorkspaceIdSuccessAttributesType = {};
94
+ export type GetWorkspaceIdFailedAttributesType = {
95
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
96
+ };
97
+ export type ValidateAqlSuccessAttributesType = {};
98
+ export type ValidateAqlFailedAttributesType = {
99
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
100
+ };
101
+ export type ObjectSchemaSuccessAttributesType = {};
102
+ export type ObjectSchemaFailedAttributesType = {
103
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
104
+ };
105
+ export type ObjectSchemasSuccessAttributesType = {};
106
+ export type ObjectSchemasFailedAttributesType = {
107
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
108
+ };
93
109
  export type AnalyticsEventAttributes = {
94
110
  /**
95
111
  * Fires when user sees modal dialog. */
@@ -148,5 +164,29 @@ export type AnalyticsEventAttributes = {
148
164
  /**
149
165
  * Fired when search is initiated via the search icon or enter key press for aql editor input field. */
150
166
  'ui.aqlEditor.searched': AqlEditorSearchedAttributesType;
167
+ /**
168
+ * Fired when fetching a workspace Id is successful. */
169
+ 'operational.getWorkspaceId.success': GetWorkspaceIdSuccessAttributesType;
170
+ /**
171
+ * Fired when fetching a workspace Id fails. */
172
+ 'operational.getWorkspaceId.failed': GetWorkspaceIdFailedAttributesType;
173
+ /**
174
+ * Fired when making a request to validateAQL is successful. */
175
+ 'operational.validateAql.success': ValidateAqlSuccessAttributesType;
176
+ /**
177
+ * Fired when making a request to validateAQL fails. */
178
+ 'operational.validateAql.failed': ValidateAqlFailedAttributesType;
179
+ /**
180
+ * Fired when fetching an object schema is successful. */
181
+ 'operational.objectSchema.success': ObjectSchemaSuccessAttributesType;
182
+ /**
183
+ * Fired when fetching an object schema fails. */
184
+ 'operational.objectSchema.failed': ObjectSchemaFailedAttributesType;
185
+ /**
186
+ * Fired when fetching object schemas is successful. */
187
+ 'operational.objectSchemas.success': ObjectSchemasSuccessAttributesType;
188
+ /**
189
+ * Fired when fetching object schemas fails. */
190
+ 'operational.objectSchemas.failed': ObjectSchemasFailedAttributesType;
151
191
  };
152
192
  export type EventKey = keyof AnalyticsEventAttributes;
@@ -1,7 +1,11 @@
1
+ import { EventKey } from '../analytics/generated/analytics.types';
2
+ import createEventPayload from '../analytics/generated/create-event-payload';
1
3
  import { AqlValidateResponse, FetchObjectSchemasResponse } from '../types/assets/types';
2
- export declare const getWorkspaceId: () => Promise<string>;
4
+ type AnalyticsFireEvent = <K extends EventKey>(...params: Parameters<typeof createEventPayload<K>>) => void;
5
+ export declare const getWorkspaceId: (fireEvent?: AnalyticsFireEvent) => Promise<string>;
3
6
  export declare const validateAql: (workspaceId: string, data: {
4
7
  qlQuery: string;
5
- }) => Promise<AqlValidateResponse>;
6
- export declare const fetchObjectSchema: (workspaceId: string, schemaId: string) => Promise<import("../types/assets/types").ObjectSchema>;
7
- export declare const fetchObjectSchemas: (workspaceId: string, query?: string) => Promise<FetchObjectSchemasResponse>;
8
+ }, fireEvent?: AnalyticsFireEvent) => Promise<AqlValidateResponse>;
9
+ export declare const fetchObjectSchema: (workspaceId: string, schemaId: string, fireEvent?: AnalyticsFireEvent) => Promise<import("../types/assets/types").ObjectSchema>;
10
+ export declare const fetchObjectSchemas: (workspaceId: string, query?: string, fireEvent?: AnalyticsFireEvent) => Promise<FetchObjectSchemasResponse>;
11
+ export {};
@@ -10,6 +10,7 @@ export interface FetchFilterOptionsProps {
10
10
  export interface FilterOptionsState {
11
11
  filterOptions: SelectOption[];
12
12
  fetchFilterOptions: (prop?: FetchFilterOptionsProps) => Promise<void>;
13
+ reset: () => void;
13
14
  totalCount: number;
14
15
  pageCursor?: string;
15
16
  status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
@@ -5,8 +5,9 @@ export interface AsyncPopupSelectProps {
5
5
  cloudId: string;
6
6
  selection: SelectOption[];
7
7
  onSelectionChange?: (selection: SelectOption[]) => void;
8
+ onReset?: () => void;
8
9
  isDisabled?: boolean;
9
10
  }
10
11
  export declare const SEARCH_DEBOUNCE_MS = 350;
11
- declare const AsyncPopupSelect: ({ filterType, cloudId, selection, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
12
+ declare const AsyncPopupSelect: ({ filterType, cloudId, selection, onSelectionChange, onReset: resetSelection, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
12
13
  export default AsyncPopupSelect;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- interface BasicFilterContainerProps {
2
+ export interface BasicFilterContainerProps {
3
3
  jql: string;
4
4
  cloudId: string;
5
5
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::ddaee20abebe8b4891d75f243120dce8>>
6
+ * @codegen <<SignedSource::d3722446f615a812f3e336474f9d8d3c>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -90,6 +90,22 @@ export type ErrorShownBasicSearchDropdownAttributesType = {
90
90
  reason: 'agg' | 'network' | 'unknown';
91
91
  };
92
92
  export type AqlEditorSearchedAttributesType = {};
93
+ export type GetWorkspaceIdSuccessAttributesType = {};
94
+ export type GetWorkspaceIdFailedAttributesType = {
95
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
96
+ };
97
+ export type ValidateAqlSuccessAttributesType = {};
98
+ export type ValidateAqlFailedAttributesType = {
99
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
100
+ };
101
+ export type ObjectSchemaSuccessAttributesType = {};
102
+ export type ObjectSchemaFailedAttributesType = {
103
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
104
+ };
105
+ export type ObjectSchemasSuccessAttributesType = {};
106
+ export type ObjectSchemasFailedAttributesType = {
107
+ statusCodeGroup: '1xx' | '3xx' | '4xx' | '5xx' | 'unknown';
108
+ };
93
109
  export type AnalyticsEventAttributes = {
94
110
  /**
95
111
  * Fires when user sees modal dialog. */
@@ -148,5 +164,29 @@ export type AnalyticsEventAttributes = {
148
164
  /**
149
165
  * Fired when search is initiated via the search icon or enter key press for aql editor input field. */
150
166
  'ui.aqlEditor.searched': AqlEditorSearchedAttributesType;
167
+ /**
168
+ * Fired when fetching a workspace Id is successful. */
169
+ 'operational.getWorkspaceId.success': GetWorkspaceIdSuccessAttributesType;
170
+ /**
171
+ * Fired when fetching a workspace Id fails. */
172
+ 'operational.getWorkspaceId.failed': GetWorkspaceIdFailedAttributesType;
173
+ /**
174
+ * Fired when making a request to validateAQL is successful. */
175
+ 'operational.validateAql.success': ValidateAqlSuccessAttributesType;
176
+ /**
177
+ * Fired when making a request to validateAQL fails. */
178
+ 'operational.validateAql.failed': ValidateAqlFailedAttributesType;
179
+ /**
180
+ * Fired when fetching an object schema is successful. */
181
+ 'operational.objectSchema.success': ObjectSchemaSuccessAttributesType;
182
+ /**
183
+ * Fired when fetching an object schema fails. */
184
+ 'operational.objectSchema.failed': ObjectSchemaFailedAttributesType;
185
+ /**
186
+ * Fired when fetching object schemas is successful. */
187
+ 'operational.objectSchemas.success': ObjectSchemasSuccessAttributesType;
188
+ /**
189
+ * Fired when fetching object schemas fails. */
190
+ 'operational.objectSchemas.failed': ObjectSchemasFailedAttributesType;
151
191
  };
152
192
  export type EventKey = keyof AnalyticsEventAttributes;
@@ -1,7 +1,11 @@
1
+ import { EventKey } from '../analytics/generated/analytics.types';
2
+ import createEventPayload from '../analytics/generated/create-event-payload';
1
3
  import { AqlValidateResponse, FetchObjectSchemasResponse } from '../types/assets/types';
2
- export declare const getWorkspaceId: () => Promise<string>;
4
+ type AnalyticsFireEvent = <K extends EventKey>(...params: Parameters<typeof createEventPayload<K>>) => void;
5
+ export declare const getWorkspaceId: (fireEvent?: AnalyticsFireEvent) => Promise<string>;
3
6
  export declare const validateAql: (workspaceId: string, data: {
4
7
  qlQuery: string;
5
- }) => Promise<AqlValidateResponse>;
6
- export declare const fetchObjectSchema: (workspaceId: string, schemaId: string) => Promise<import("../types/assets/types").ObjectSchema>;
7
- export declare const fetchObjectSchemas: (workspaceId: string, query?: string) => Promise<FetchObjectSchemasResponse>;
8
+ }, fireEvent?: AnalyticsFireEvent) => Promise<AqlValidateResponse>;
9
+ export declare const fetchObjectSchema: (workspaceId: string, schemaId: string, fireEvent?: AnalyticsFireEvent) => Promise<import("../types/assets/types").ObjectSchema>;
10
+ export declare const fetchObjectSchemas: (workspaceId: string, query?: string, fireEvent?: AnalyticsFireEvent) => Promise<FetchObjectSchemasResponse>;
11
+ export {};
@@ -10,6 +10,7 @@ export interface FetchFilterOptionsProps {
10
10
  export interface FilterOptionsState {
11
11
  filterOptions: SelectOption[];
12
12
  fetchFilterOptions: (prop?: FetchFilterOptionsProps) => Promise<void>;
13
+ reset: () => void;
13
14
  totalCount: number;
14
15
  pageCursor?: string;
15
16
  status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
@@ -5,8 +5,9 @@ export interface AsyncPopupSelectProps {
5
5
  cloudId: string;
6
6
  selection: SelectOption[];
7
7
  onSelectionChange?: (selection: SelectOption[]) => void;
8
+ onReset?: () => void;
8
9
  isDisabled?: boolean;
9
10
  }
10
11
  export declare const SEARCH_DEBOUNCE_MS = 350;
11
- declare const AsyncPopupSelect: ({ filterType, cloudId, selection, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
12
+ declare const AsyncPopupSelect: ({ filterType, cloudId, selection, onSelectionChange, onReset: resetSelection, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
12
13
  export default AsyncPopupSelect;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- interface BasicFilterContainerProps {
2
+ export interface BasicFilterContainerProps {
3
3
  jql: string;
4
4
  cloudId: string;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,11 +59,11 @@
59
59
  "@atlaskit/select": "^16.7.0",
60
60
  "@atlaskit/smart-card": "^26.42.0",
61
61
  "@atlaskit/spinner": "^15.6.0",
62
- "@atlaskit/tag": "^11.6.0",
62
+ "@atlaskit/tag": "^12.0.0",
63
63
  "@atlaskit/textfield": "5.6.8",
64
64
  "@atlaskit/theme": "^12.6.0",
65
65
  "@atlaskit/tokens": "^1.28.0",
66
- "@atlaskit/tooltip": "^17.8.0",
66
+ "@atlaskit/tooltip": "^18.0.0",
67
67
  "@atlaskit/ufo": "^0.2.4",
68
68
  "@atlassianlabs/jql-editor": "^2.0.1",
69
69
  "@babel/runtime": "^7.0.0",