@atlaskit/link-datasource 1.19.21 → 1.19.23

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 (58) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/hooks/useValidateAqlText.js +83 -45
  4. package/dist/cjs/ui/assets-modal/modal/index.js +20 -34
  5. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +18 -15
  6. package/dist/cjs/ui/assets-modal/search-container/aql-search-input/index.js +14 -84
  7. package/dist/cjs/ui/assets-modal/search-container/index.js +1 -1
  8. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +34 -20
  9. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +11 -9
  10. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +4 -2
  11. package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/transformers.js +18 -5
  12. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  13. package/dist/cjs/ui/jira-issues-modal/modal/index.js +2 -1
  14. package/dist/es2019/analytics/constants.js +1 -1
  15. package/dist/es2019/hooks/useValidateAqlText.js +70 -31
  16. package/dist/es2019/ui/assets-modal/modal/index.js +5 -4
  17. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +19 -16
  18. package/dist/es2019/ui/assets-modal/search-container/aql-search-input/index.js +13 -56
  19. package/dist/es2019/ui/assets-modal/search-container/index.js +1 -1
  20. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +13 -3
  21. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +7 -4
  22. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +5 -2
  23. package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/transformers.js +19 -5
  24. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  25. package/dist/es2019/ui/jira-issues-modal/modal/index.js +2 -1
  26. package/dist/esm/analytics/constants.js +1 -1
  27. package/dist/esm/hooks/useValidateAqlText.js +83 -45
  28. package/dist/esm/ui/assets-modal/modal/index.js +20 -34
  29. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +19 -16
  30. package/dist/esm/ui/assets-modal/search-container/aql-search-input/index.js +14 -85
  31. package/dist/esm/ui/assets-modal/search-container/index.js +1 -1
  32. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +34 -20
  33. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +11 -9
  34. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +4 -2
  35. package/dist/esm/ui/jira-issues-modal/basic-filters/utils/transformers.js +18 -5
  36. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  37. package/dist/esm/ui/jira-issues-modal/modal/index.js +2 -1
  38. package/dist/types/hooks/useValidateAqlText.d.ts +21 -5
  39. package/dist/types/services/getAvailableJiraSites.d.ts +1 -5
  40. package/dist/types/ui/assets-modal/search-container/aql-search-input/index.d.ts +0 -1
  41. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +3 -2
  42. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +3 -2
  43. package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +3 -2
  44. package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +3 -1
  45. package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
  46. package/dist/types/ui/jira-issues-modal/site-selector/index.d.ts +1 -1
  47. package/dist/types/ui/jira-issues-modal/types.d.ts +5 -0
  48. package/dist/types-ts4.5/hooks/useValidateAqlText.d.ts +21 -5
  49. package/dist/types-ts4.5/services/getAvailableJiraSites.d.ts +1 -5
  50. package/dist/types-ts4.5/ui/assets-modal/search-container/aql-search-input/index.d.ts +0 -1
  51. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +3 -2
  52. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +3 -2
  53. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +3 -2
  54. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +3 -1
  55. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
  56. package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/index.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +5 -0
  58. package/package.json +4 -4
@@ -1,7 +1,10 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ 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; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
8
  import { useCallback, useEffect, useRef, useState } from 'react';
6
9
  import { useIntl } from 'react-intl-next';
7
10
  import { useBasicFilterAGG } from '../../../../services/useBasicFilterAGG';
@@ -16,7 +19,7 @@ export var getAssigneeUnassignedFilterOption = function getAssigneeUnassignedFil
16
19
  };
17
20
  export var useFilterOptions = function useFilterOptions(_ref) {
18
21
  var filterType = _ref.filterType,
19
- cloudId = _ref.cloudId;
22
+ site = _ref.site;
20
23
  var _useIntl = useIntl(),
21
24
  formatMessage = _useIntl.formatMessage;
22
25
  var _useState = useState([]),
@@ -40,10 +43,13 @@ export var useFilterOptions = function useFilterOptions(_ref) {
40
43
  nextPageCursor = _useState10[0],
41
44
  setNextPageCursor = _useState10[1];
42
45
  var initialData = useRef();
46
+ var _ref2 = site || {},
47
+ cloudId = _ref2.cloudId,
48
+ siteUrl = _ref2.url;
43
49
  var _useBasicFilterAGG = useBasicFilterAGG(),
44
50
  getFieldValues = _useBasicFilterAGG.getFieldValues;
45
51
  var fetchFilterOptions = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
46
- var _ref3,
52
+ var _ref4,
47
53
  pageCursor,
48
54
  searchString,
49
55
  isNewSearch,
@@ -56,21 +62,27 @@ export var useFilterOptions = function useFilterOptions(_ref) {
56
62
  return _regeneratorRuntime.wrap(function _callee$(_context) {
57
63
  while (1) switch (_context.prev = _context.next) {
58
64
  case 0:
59
- _ref3 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, pageCursor = _ref3.pageCursor, searchString = _ref3.searchString;
65
+ _ref4 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, pageCursor = _ref4.pageCursor, searchString = _ref4.searchString;
66
+ if (cloudId) {
67
+ _context.next = 3;
68
+ break;
69
+ }
70
+ return _context.abrupt("return");
71
+ case 3:
60
72
  isNewSearch = !pageCursor;
61
73
  isNewSearch ? setStatus('loading') : setStatus('loadingMore');
62
74
  isRequestLikeInitialSearch = !pageCursor && !searchString;
63
75
  initialResponseData = initialData.current;
64
- _context.prev = 5;
76
+ _context.prev = 7;
65
77
  if (!(isRequestLikeInitialSearch && initialResponseData)) {
66
- _context.next = 10;
78
+ _context.next = 12;
67
79
  break;
68
80
  }
69
81
  _context.t0 = initialResponseData;
70
- _context.next = 13;
82
+ _context.next = 15;
71
83
  break;
72
- case 10:
73
- _context.next = 12;
84
+ case 12:
85
+ _context.next = 14;
74
86
  return getFieldValues({
75
87
  cloudId: cloudId,
76
88
  jql: '',
@@ -78,19 +90,21 @@ export var useFilterOptions = function useFilterOptions(_ref) {
78
90
  searchString: searchString,
79
91
  pageCursor: pageCursor
80
92
  });
81
- case 12:
93
+ case 14:
82
94
  _context.t0 = _context.sent;
83
- case 13:
95
+ case 15:
84
96
  response = _context.t0;
85
97
  if (!(response.errors && response.errors.length > 0)) {
86
- _context.next = 18;
98
+ _context.next = 20;
87
99
  break;
88
100
  }
89
101
  setStatus('rejected');
90
102
  setErrors(response.errors);
91
103
  return _context.abrupt("return");
92
- case 18:
93
- mappedResponse = mapFieldValuesToFilterOptions(response);
104
+ case 20:
105
+ mappedResponse = mapFieldValuesToFilterOptions(_objectSpread(_objectSpread({}, response), {}, {
106
+ siteUrl: siteUrl
107
+ }));
94
108
  mappedTotalCount = mapFieldValuesToTotalCount(response);
95
109
  if (isNewSearch) {
96
110
  if (isRequestLikeInitialSearch) {
@@ -116,19 +130,19 @@ export var useFilterOptions = function useFilterOptions(_ref) {
116
130
  setTotalCount(mappedTotalCount);
117
131
  setNextPageCursor(mapFieldValuesToPageCursor(response));
118
132
  setStatus('resolved');
119
- _context.next = 30;
133
+ _context.next = 32;
120
134
  break;
121
- case 26:
122
- _context.prev = 26;
123
- _context.t1 = _context["catch"](5);
135
+ case 28:
136
+ _context.prev = 28;
137
+ _context.t1 = _context["catch"](7);
124
138
  setStatus('rejected');
125
139
  setErrors([_context.t1]);
126
- case 30:
140
+ case 32:
127
141
  case "end":
128
142
  return _context.stop();
129
143
  }
130
- }, _callee, null, [[5, 26]]);
131
- })), [cloudId, filterOptions, filterType, formatMessage, getFieldValues]);
144
+ }, _callee, null, [[7, 28]]);
145
+ })), [cloudId, filterOptions, filterType, formatMessage, getFieldValues, siteUrl]);
132
146
  useEffect(function () {
133
147
  if (status !== 'rejected' && errors.length !== 0) {
134
148
  setErrors([]);
@@ -26,7 +26,7 @@ var noFilterOptions = function noFilterOptions() {
26
26
  export var SEARCH_DEBOUNCE_MS = 350;
27
27
  var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
28
28
  var filterType = _ref.filterType,
29
- cloudId = _ref.cloudId,
29
+ site = _ref.site,
30
30
  selection = _ref.selection,
31
31
  isJQLHydrating = _ref.isJQLHydrating,
32
32
  _ref$onSelectionChang = _ref.onSelectionChange,
@@ -49,12 +49,14 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
49
49
  _useState6 = _slicedToArray(_useState5, 2),
50
50
  sortedOptions = _useState6[0],
51
51
  setSortedOptions = _useState6[1];
52
- var currentSiteCloudId = useRef(cloudId);
52
+ var _ref2 = site || {},
53
+ cloudId = _ref2.cloudId;
54
+ var currentSiteCloudId = useRef(cloudId || '');
53
55
  var sortPaginatedResults = useRef(false); // this is to track pagination for sorting purpose
54
56
 
55
57
  var _useFilterOptions = useFilterOptions({
56
58
  filterType: filterType,
57
- cloudId: cloudId
59
+ site: site
58
60
  }),
59
61
  filterOptions = _useFilterOptions.filterOptions,
60
62
  fetchFilterOptions = _useFilterOptions.fetchFilterOptions,
@@ -71,7 +73,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
71
73
  _useDebouncedCallback2 = _slicedToArray(_useDebouncedCallback, 1),
72
74
  handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
73
75
  var handleInputChange = useCallback( /*#__PURE__*/function () {
74
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchTerm, actionMeta) {
76
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchTerm, actionMeta) {
75
77
  return _regeneratorRuntime.wrap(function _callee$(_context) {
76
78
  while (1) switch (_context.prev = _context.next) {
77
79
  case 0:
@@ -86,7 +88,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
86
88
  }, _callee);
87
89
  }));
88
90
  return function (_x, _x2) {
89
- return _ref2.apply(this, arguments);
91
+ return _ref3.apply(this, arguments);
90
92
  };
91
93
  }(), [handleDebouncedFetchFilterOptions, searchTerm]);
92
94
  var handleOptionSelection = useCallback(function (newValue) {
@@ -185,7 +187,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
185
187
  }, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
186
188
 
187
189
  useEffect(function () {
188
- if (currentSiteCloudId.current !== cloudId) {
190
+ if (cloudId && currentSiteCloudId.current !== cloudId) {
189
191
  currentSiteCloudId.current = cloudId;
190
192
  setSortedOptions([]);
191
193
  setSearchTerm('');
@@ -252,9 +254,9 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
252
254
  onInputChange: handleInputChange,
253
255
  onOpen: handleMenuOpen,
254
256
  onClose: handleMenuClose,
255
- target: function target(_ref3) {
256
- var isOpen = _ref3.isOpen,
257
- triggerProps = _objectWithoutProperties(_ref3, _excluded);
257
+ target: function target(_ref4) {
258
+ var isOpen = _ref4.isOpen,
259
+ triggerProps = _objectWithoutProperties(_ref4, _excluded);
258
260
  return /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
259
261
  filterType: filterType,
260
262
  selectedOptions: selectedOptions,
@@ -8,13 +8,15 @@ var basicFilterContainerStyles = xcss({
8
8
  });
9
9
  var BasicFilterContainer = function BasicFilterContainer(_ref) {
10
10
  var jql = _ref.jql,
11
- cloudId = _ref.cloudId,
11
+ site = _ref.site,
12
12
  onChange = _ref.onChange,
13
13
  selections = _ref.selections,
14
14
  isJQLHydrating = _ref.isJQLHydrating;
15
15
  var extractedFilterValues = useMemo(function () {
16
16
  return isJQLHydrating ? extractValuesFromNonComplexJQL(jql) : {};
17
17
  }, [isJQLHydrating, jql]);
18
+ var _ref2 = site || {},
19
+ cloudId = _ref2.cloudId;
18
20
  return /*#__PURE__*/React.createElement(Flex, {
19
21
  xcss: basicFilterContainerStyles,
20
22
  gap: "space.100",
@@ -23,7 +25,7 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
23
25
  var _extractedFilterValue;
24
26
  var shouldShowHydrationLoader = isJQLHydrating && ((_extractedFilterValue = extractedFilterValues[filter]) === null || _extractedFilterValue === void 0 ? void 0 : _extractedFilterValue.length) > 0;
25
27
  return /*#__PURE__*/React.createElement(AsyncPopupSelect, {
26
- cloudId: cloudId,
28
+ site: site,
27
29
  filterType: filter,
28
30
  key: filter,
29
31
  selection: selections[filter] || [],
@@ -14,6 +14,15 @@ var getLozengeAppearance = function getLozengeAppearance(colorName) {
14
14
  return appearanceMap[colorName];
15
15
  }
16
16
  };
17
+ var checkAndConvertToAbsoluteUrl = function checkAndConvertToAbsoluteUrl(url, siteUrl) {
18
+ if (!url) {
19
+ return '';
20
+ }
21
+ if (/^data:(.*)/.test(url) || /^http(.*)/.test(url) || !siteUrl) {
22
+ return url;
23
+ }
24
+ return "".concat(siteUrl).concat(url);
25
+ };
17
26
  function mapNodeToOption(_ref) {
18
27
  var displayName = _ref.displayName,
19
28
  jqlTerm = _ref.jqlTerm,
@@ -21,7 +30,8 @@ function mapNodeToOption(_ref) {
21
30
  issueTypes = _ref.issueTypes,
22
31
  project = _ref.project,
23
32
  statusCategory = _ref.statusCategory,
24
- user = _ref.user;
33
+ user = _ref.user,
34
+ siteUrl = _ref.siteUrl;
25
35
  try {
26
36
  var baseProps = {
27
37
  label: displayName,
@@ -46,14 +56,14 @@ function mapNodeToOption(_ref) {
46
56
  var _project$avatar;
47
57
  return _objectSpread(_objectSpread({}, baseProps), {}, {
48
58
  optionType: 'iconLabel',
49
- icon: (_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small
59
+ icon: checkAndConvertToAbsoluteUrl((_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small, siteUrl)
50
60
  });
51
61
  }
52
62
  if (issueTypes) {
53
63
  var _issueTypes$;
54
64
  return _objectSpread(_objectSpread({}, baseProps), {}, {
55
65
  optionType: 'iconLabel',
56
- icon: (_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small
66
+ icon: checkAndConvertToAbsoluteUrl((_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small, siteUrl)
57
67
  });
58
68
  }
59
69
  if (statusCategory) {
@@ -92,9 +102,12 @@ export function mapHydrateResponseData(_ref2) {
92
102
  }
93
103
  export function mapFieldValuesToFilterOptions(_ref5) {
94
104
  var _data$jira2;
95
- var data = _ref5.data;
105
+ var data = _ref5.data,
106
+ siteUrl = _ref5.siteUrl;
96
107
  return (data === null || data === void 0 || (_data$jira2 = data.jira) === null || _data$jira2 === void 0 || (_data$jira2 = _data$jira2.jqlBuilder) === null || _data$jira2 === void 0 || (_data$jira2 = _data$jira2.fieldValues) === null || _data$jira2 === void 0 || (_data$jira2 = _data$jira2.edges) === null || _data$jira2 === void 0 ? void 0 : _data$jira2.map(function (edge) {
97
- return edge.node ? mapNodeToOption(edge.node) : null;
108
+ return edge.node ? mapNodeToOption(_objectSpread(_objectSpread({}, edge.node), {}, {
109
+ siteUrl: siteUrl
110
+ })) : null;
98
111
  }).filter(isNonNullSelectOption)) || [];
99
112
  }
100
113
  export function mapFieldValuesToTotalCount(_ref6) {
@@ -39,7 +39,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
39
39
  initialSearchMethod = props.initialSearchMethod,
40
40
  setSearchBarJql = props.setSearchBarJql,
41
41
  _props$searchBarJql = props.searchBarJql,
42
- searchBarJql = _props$searchBarJql === void 0 ? DEFAULT_JQL_QUERY : _props$searchBarJql;
42
+ searchBarJql = _props$searchBarJql === void 0 ? DEFAULT_JQL_QUERY : _props$searchBarJql,
43
+ site = props.site;
43
44
  var _ref = parameters || {},
44
45
  currentCloudId = _ref.cloudId;
45
46
  var _useIntl = useIntl(),
@@ -219,7 +220,7 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
219
220
  searchTerm: basicSearchTerm
220
221
  }), showBasicFilters && jsx(BasicFilters, {
221
222
  jql: searchBarJql,
222
- cloudId: cloudId || '',
223
+ site: site,
223
224
  onChange: handleBasicFilterSelectionChange,
224
225
  selections: filterSelections,
225
226
  isJQLHydrating: basicFilterHydrationStatus === 'loading'
@@ -561,7 +561,8 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
561
561
  parameters: parameters,
562
562
  onSearch: onSearch,
563
563
  initialSearchMethod: initialSearchMethod,
564
- onSearchMethodChange: setCurrentSearchMethod
564
+ onSearchMethodChange: setCurrentSearchMethod,
565
+ site: selectedJiraSite
565
566
  }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()) : jsx(NoInstancesView, null)), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
566
567
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
567
568
  css: issueCountStyles
@@ -1,11 +1,27 @@
1
+ type IdleResult = {
2
+ type: 'idle';
3
+ };
4
+ type LoadingResult = {
5
+ type: 'loading';
6
+ };
7
+ export type ValidResult = {
8
+ type: 'valid';
9
+ validatedAql: string;
10
+ };
11
+ export type InvalidResult = {
12
+ type: 'invalid';
13
+ error: string;
14
+ };
15
+ export type AqlValidationResult = IdleResult | LoadingResult | ValidResult | InvalidResult;
1
16
  export type AqlValidationResponse = {
2
17
  isValid: boolean;
3
18
  message: string | null;
4
19
  };
5
20
  export type UseValidateAqlTextState = {
6
- validateAqlTextLoading: boolean;
7
- validateAqlTextError: Error | undefined;
8
- isValidAqlText: boolean;
9
- validateAqlText: (aql: string) => Promise<AqlValidationResponse>;
21
+ debouncedValidation: (value: string | undefined) => Promise<string | undefined>;
22
+ validateAqlText: (aql: string) => Promise<'error' | undefined>;
23
+ lastValidationResult: AqlValidationResult;
10
24
  };
11
- export declare const useValidateAqlText: (workspaceId: string) => UseValidateAqlTextState;
25
+ export declare const SEARCH_DEBOUNCE = 350;
26
+ export declare const useValidateAqlText: (workspaceId: string, initialValue: string) => UseValidateAqlTextState;
27
+ export {};
@@ -1,6 +1,2 @@
1
- export interface Site {
2
- cloudId: string;
3
- displayName: string;
4
- url: string;
5
- }
1
+ import type { Site } from '../ui/jira-issues-modal/types';
6
2
  export declare const getAvailableJiraSites: () => Promise<Site[]>;
@@ -5,5 +5,4 @@ export interface AqlSearchInputProps {
5
5
  testId?: string;
6
6
  isSearching: boolean;
7
7
  }
8
- export declare const SEARCH_DEBOUNCE_MS = 350;
9
8
  export declare const AqlSearchInput: ({ value, workspaceId, testId, isSearching, }: AqlSearchInputProps) => jsx.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { IntlShape } from 'react-intl-next';
2
+ import type { Site } from '../../types';
2
3
  import { AvatarLabelOption, BasicFilterFieldType, SelectOption } from '../types';
3
4
  interface FilterOptionsProps {
4
5
  filterType: BasicFilterFieldType;
5
- cloudId: string;
6
+ site?: Site;
6
7
  }
7
8
  export interface FetchFilterOptionsProps {
8
9
  pageCursor?: string;
@@ -18,5 +19,5 @@ export interface FilterOptionsState {
18
19
  errors: unknown[];
19
20
  }
20
21
  export declare const getAssigneeUnassignedFilterOption: (formatMessage: IntlShape['formatMessage']) => AvatarLabelOption;
21
- export declare const useFilterOptions: ({ filterType, cloudId, }: FilterOptionsProps) => FilterOptionsState;
22
+ export declare const useFilterOptions: ({ filterType, site, }: FilterOptionsProps) => FilterOptionsState;
22
23
  export {};
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import type { Site } from '../../../types';
2
3
  import { BasicFilterFieldType, SelectOption } from '../../types';
3
4
  export interface AsyncPopupSelectProps {
4
5
  filterType: BasicFilterFieldType;
5
- cloudId: string;
6
6
  selection: SelectOption[];
7
7
  isJQLHydrating: boolean;
8
8
  onSelectionChange?: (filterType: BasicFilterFieldType, options: SelectOption[]) => void;
9
9
  isDisabled?: boolean;
10
+ site?: Site;
10
11
  }
11
12
  export declare const SEARCH_DEBOUNCE_MS = 350;
12
- declare const AsyncPopupSelect: ({ filterType, cloudId, selection, isJQLHydrating, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
13
+ declare const AsyncPopupSelect: ({ filterType, site, selection, isJQLHydrating, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
13
14
  export default AsyncPopupSelect;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
+ import type { Site } from '../../types';
2
3
  import type { BasicFilterFieldType, SelectedOptionsMap, SelectOption } from '../types';
3
4
  export declare const availableBasicFilterTypes: BasicFilterFieldType[];
4
5
  export interface BasicFilterContainerProps {
5
6
  jql: string;
6
- cloudId: string;
7
+ site?: Site;
7
8
  selections: SelectedOptionsMap;
8
9
  onChange: (filterType: BasicFilterFieldType, options: SelectOption[]) => void;
9
10
  isJQLHydrating: boolean;
10
11
  }
11
- declare const BasicFilterContainer: ({ jql, cloudId, onChange, selections, isJQLHydrating, }: BasicFilterContainerProps) => JSX.Element;
12
+ declare const BasicFilterContainer: ({ jql, site, onChange, selections, isJQLHydrating, }: BasicFilterContainerProps) => JSX.Element;
12
13
  export default BasicFilterContainer;
@@ -1,5 +1,7 @@
1
1
  import { FieldValuesResponse, HydrateResponse, SelectedOptionsMap, SelectOption } from '../types';
2
2
  export declare function mapHydrateResponseData({ data }: HydrateResponse): SelectedOptionsMap;
3
- export declare function mapFieldValuesToFilterOptions({ data, }: FieldValuesResponse): SelectOption[];
3
+ export declare function mapFieldValuesToFilterOptions({ data, siteUrl, }: FieldValuesResponse & {
4
+ siteUrl?: string;
5
+ }): SelectOption[];
4
6
  export declare function mapFieldValuesToTotalCount({ data, }: FieldValuesResponse): number;
5
7
  export declare function mapFieldValuesToPageCursor({ data, }: FieldValuesResponse): string | undefined;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { JiraSearchMethod } from '../../../common/types';
3
3
  import { SelectedOptionsMap } from '../basic-filters/types';
4
- import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery } from '../types';
4
+ import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery, Site } from '../types';
5
5
  export declare const DEFAULT_JQL_QUERY = "created >= -30d order by created DESC";
6
6
  export declare const ALLOWED_ORDER_BY_KEYS: string[];
7
7
  export declare const FILTER_SELECTION_DEBOUNCE_MS = 500;
@@ -17,5 +17,6 @@ export interface SearchContainerProps {
17
17
  parameters?: JiraIssueDatasourceParameters;
18
18
  searchBarJql?: string;
19
19
  setSearchBarJql: (jql: string) => void;
20
+ site?: Site;
20
21
  }
21
22
  export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { Site } from '../../../services/getAvailableJiraSites';
2
+ import type { Site } from '../types';
3
3
  export interface JiraSiteSelectorProps {
4
4
  availableSites: Site[] | undefined;
5
5
  onSiteSelection: (selectedSite: Site) => void;
@@ -14,6 +14,11 @@ export type JiraIssueDatasourceParameters = {
14
14
  cloudId: string;
15
15
  } & JiraIssueDatasourceParametersQuery;
16
16
  export type JiraIssueViewModes = 'issue' | 'count';
17
+ export interface Site {
18
+ cloudId: string;
19
+ displayName: string;
20
+ url: string;
21
+ }
17
22
  export interface JiraIssuesDatasourceAdf extends DatasourceAdf {
18
23
  attrs: {
19
24
  url?: string;
@@ -1,11 +1,27 @@
1
+ type IdleResult = {
2
+ type: 'idle';
3
+ };
4
+ type LoadingResult = {
5
+ type: 'loading';
6
+ };
7
+ export type ValidResult = {
8
+ type: 'valid';
9
+ validatedAql: string;
10
+ };
11
+ export type InvalidResult = {
12
+ type: 'invalid';
13
+ error: string;
14
+ };
15
+ export type AqlValidationResult = IdleResult | LoadingResult | ValidResult | InvalidResult;
1
16
  export type AqlValidationResponse = {
2
17
  isValid: boolean;
3
18
  message: string | null;
4
19
  };
5
20
  export type UseValidateAqlTextState = {
6
- validateAqlTextLoading: boolean;
7
- validateAqlTextError: Error | undefined;
8
- isValidAqlText: boolean;
9
- validateAqlText: (aql: string) => Promise<AqlValidationResponse>;
21
+ debouncedValidation: (value: string | undefined) => Promise<string | undefined>;
22
+ validateAqlText: (aql: string) => Promise<'error' | undefined>;
23
+ lastValidationResult: AqlValidationResult;
10
24
  };
11
- export declare const useValidateAqlText: (workspaceId: string) => UseValidateAqlTextState;
25
+ export declare const SEARCH_DEBOUNCE = 350;
26
+ export declare const useValidateAqlText: (workspaceId: string, initialValue: string) => UseValidateAqlTextState;
27
+ export {};
@@ -1,6 +1,2 @@
1
- export interface Site {
2
- cloudId: string;
3
- displayName: string;
4
- url: string;
5
- }
1
+ import type { Site } from '../ui/jira-issues-modal/types';
6
2
  export declare const getAvailableJiraSites: () => Promise<Site[]>;
@@ -5,5 +5,4 @@ export interface AqlSearchInputProps {
5
5
  testId?: string;
6
6
  isSearching: boolean;
7
7
  }
8
- export declare const SEARCH_DEBOUNCE_MS = 350;
9
8
  export declare const AqlSearchInput: ({ value, workspaceId, testId, isSearching, }: AqlSearchInputProps) => jsx.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { IntlShape } from 'react-intl-next';
2
+ import type { Site } from '../../types';
2
3
  import { AvatarLabelOption, BasicFilterFieldType, SelectOption } from '../types';
3
4
  interface FilterOptionsProps {
4
5
  filterType: BasicFilterFieldType;
5
- cloudId: string;
6
+ site?: Site;
6
7
  }
7
8
  export interface FetchFilterOptionsProps {
8
9
  pageCursor?: string;
@@ -18,5 +19,5 @@ export interface FilterOptionsState {
18
19
  errors: unknown[];
19
20
  }
20
21
  export declare const getAssigneeUnassignedFilterOption: (formatMessage: IntlShape['formatMessage']) => AvatarLabelOption;
21
- export declare const useFilterOptions: ({ filterType, cloudId, }: FilterOptionsProps) => FilterOptionsState;
22
+ export declare const useFilterOptions: ({ filterType, site, }: FilterOptionsProps) => FilterOptionsState;
22
23
  export {};
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import type { Site } from '../../../types';
2
3
  import { BasicFilterFieldType, SelectOption } from '../../types';
3
4
  export interface AsyncPopupSelectProps {
4
5
  filterType: BasicFilterFieldType;
5
- cloudId: string;
6
6
  selection: SelectOption[];
7
7
  isJQLHydrating: boolean;
8
8
  onSelectionChange?: (filterType: BasicFilterFieldType, options: SelectOption[]) => void;
9
9
  isDisabled?: boolean;
10
+ site?: Site;
10
11
  }
11
12
  export declare const SEARCH_DEBOUNCE_MS = 350;
12
- declare const AsyncPopupSelect: ({ filterType, cloudId, selection, isJQLHydrating, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
13
+ declare const AsyncPopupSelect: ({ filterType, site, selection, isJQLHydrating, onSelectionChange, isDisabled, }: AsyncPopupSelectProps) => JSX.Element;
13
14
  export default AsyncPopupSelect;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
+ import type { Site } from '../../types';
2
3
  import type { BasicFilterFieldType, SelectedOptionsMap, SelectOption } from '../types';
3
4
  export declare const availableBasicFilterTypes: BasicFilterFieldType[];
4
5
  export interface BasicFilterContainerProps {
5
6
  jql: string;
6
- cloudId: string;
7
+ site?: Site;
7
8
  selections: SelectedOptionsMap;
8
9
  onChange: (filterType: BasicFilterFieldType, options: SelectOption[]) => void;
9
10
  isJQLHydrating: boolean;
10
11
  }
11
- declare const BasicFilterContainer: ({ jql, cloudId, onChange, selections, isJQLHydrating, }: BasicFilterContainerProps) => JSX.Element;
12
+ declare const BasicFilterContainer: ({ jql, site, onChange, selections, isJQLHydrating, }: BasicFilterContainerProps) => JSX.Element;
12
13
  export default BasicFilterContainer;
@@ -1,5 +1,7 @@
1
1
  import { FieldValuesResponse, HydrateResponse, SelectedOptionsMap, SelectOption } from '../types';
2
2
  export declare function mapHydrateResponseData({ data }: HydrateResponse): SelectedOptionsMap;
3
- export declare function mapFieldValuesToFilterOptions({ data, }: FieldValuesResponse): SelectOption[];
3
+ export declare function mapFieldValuesToFilterOptions({ data, siteUrl, }: FieldValuesResponse & {
4
+ siteUrl?: string;
5
+ }): SelectOption[];
4
6
  export declare function mapFieldValuesToTotalCount({ data, }: FieldValuesResponse): number;
5
7
  export declare function mapFieldValuesToPageCursor({ data, }: FieldValuesResponse): string | undefined;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { JiraSearchMethod } from '../../../common/types';
3
3
  import { SelectedOptionsMap } from '../basic-filters/types';
4
- import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery } from '../types';
4
+ import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery, Site } from '../types';
5
5
  export declare const DEFAULT_JQL_QUERY = "created >= -30d order by created DESC";
6
6
  export declare const ALLOWED_ORDER_BY_KEYS: string[];
7
7
  export declare const FILTER_SELECTION_DEBOUNCE_MS = 500;
@@ -17,5 +17,6 @@ export interface SearchContainerProps {
17
17
  parameters?: JiraIssueDatasourceParameters;
18
18
  searchBarJql?: string;
19
19
  setSearchBarJql: (jql: string) => void;
20
+ site?: Site;
20
21
  }
21
22
  export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { Site } from '../../../services/getAvailableJiraSites';
2
+ import type { Site } from '../types';
3
3
  export interface JiraSiteSelectorProps {
4
4
  availableSites: Site[] | undefined;
5
5
  onSiteSelection: (selectedSite: Site) => void;
@@ -14,6 +14,11 @@ export type JiraIssueDatasourceParameters = {
14
14
  cloudId: string;
15
15
  } & JiraIssueDatasourceParametersQuery;
16
16
  export type JiraIssueViewModes = 'issue' | 'count';
17
+ export interface Site {
18
+ cloudId: string;
19
+ displayName: string;
20
+ url: string;
21
+ }
17
22
  export interface JiraIssuesDatasourceAdf extends DatasourceAdf {
18
23
  attrs: {
19
24
  url?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.19.21",
3
+ "version": "1.19.23",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/analytics-next": "^9.1.3",
35
35
  "@atlaskit/avatar": "^21.4.0",
36
36
  "@atlaskit/badge": "^15.2.0",
37
- "@atlaskit/button": "^16.17.0",
37
+ "@atlaskit/button": "^16.18.0",
38
38
  "@atlaskit/editor-prosemirror": "1.1.0",
39
39
  "@atlaskit/empty-state": "^7.5.0",
40
40
  "@atlaskit/form": "^9.0.0",
@@ -51,13 +51,13 @@
51
51
  "@atlaskit/lozenge": "^11.5.0",
52
52
  "@atlaskit/modal-dialog": "^12.10.0",
53
53
  "@atlaskit/platform-feature-flags": "^0.2.4",
54
- "@atlaskit/pragmatic-drag-and-drop": "^0.24.0",
54
+ "@atlaskit/pragmatic-drag-and-drop": "^0.25.0",
55
55
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
56
56
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.0",
57
57
  "@atlaskit/pragmatic-drag-and-drop-react-indicator": "^0.17.0",
58
58
  "@atlaskit/primitives": "^1.13.0",
59
59
  "@atlaskit/select": "^17.0.0",
60
- "@atlaskit/smart-card": "^26.42.0",
60
+ "@atlaskit/smart-card": "^26.43.0",
61
61
  "@atlaskit/spinner": "^16.0.0",
62
62
  "@atlaskit/tag": "^12.0.0",
63
63
  "@atlaskit/textfield": "6.0.0",