@atlaskit/link-datasource 1.19.21 → 1.19.22

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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +34 -20
  4. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +11 -9
  5. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +4 -2
  6. package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/transformers.js +18 -5
  7. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  8. package/dist/cjs/ui/jira-issues-modal/modal/index.js +2 -1
  9. package/dist/es2019/analytics/constants.js +1 -1
  10. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +13 -3
  11. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +7 -4
  12. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +5 -2
  13. package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/transformers.js +19 -5
  14. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  15. package/dist/es2019/ui/jira-issues-modal/modal/index.js +2 -1
  16. package/dist/esm/analytics/constants.js +1 -1
  17. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +34 -20
  18. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +11 -9
  19. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +4 -2
  20. package/dist/esm/ui/jira-issues-modal/basic-filters/utils/transformers.js +18 -5
  21. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +3 -2
  22. package/dist/esm/ui/jira-issues-modal/modal/index.js +2 -1
  23. package/dist/types/services/getAvailableJiraSites.d.ts +1 -5
  24. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +3 -2
  25. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +3 -2
  26. package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +3 -2
  27. package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +3 -1
  28. package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
  29. package/dist/types/ui/jira-issues-modal/site-selector/index.d.ts +1 -1
  30. package/dist/types/ui/jira-issues-modal/types.d.ts +5 -0
  31. package/dist/types-ts4.5/services/getAvailableJiraSites.d.ts +1 -5
  32. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +3 -2
  33. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +3 -2
  34. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +3 -2
  35. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +3 -1
  36. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
  37. package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/index.d.ts +1 -1
  38. package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +5 -0
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.19.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#59059](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59059) [`9b56935315f5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9b56935315f5) - Add logic to append selected site url to dropdown icon urls if they are not absolute urls.
8
+
3
9
  ## 1.19.21
4
10
 
5
11
  ### Patch Changes
@@ -7,5 +7,5 @@ exports.packageMetaData = exports.EVENT_CHANNEL = void 0;
7
7
  var EVENT_CHANNEL = exports.EVENT_CHANNEL = 'media';
8
8
  var packageMetaData = exports.packageMetaData = {
9
9
  packageName: "@atlaskit/link-datasource",
10
- packageVersion: "1.19.21"
10
+ packageVersion: "1.19.22"
11
11
  };
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.useFilterOptions = exports.getAssigneeUnassignedFilterOption = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
13
  var _react = require("react");
@@ -14,6 +15,8 @@ var _reactIntlNext = require("react-intl-next");
14
15
  var _useBasicFilterAGG2 = require("../../../../services/useBasicFilterAGG");
15
16
  var _transformers = require("../utils/transformers");
16
17
  var _messages = require("./messages");
18
+ 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; }
19
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
20
  var getAssigneeUnassignedFilterOption = exports.getAssigneeUnassignedFilterOption = function getAssigneeUnassignedFilterOption(formatMessage) {
18
21
  return {
19
22
  label: formatMessage(_messages.filterOptionMessages.assigneeUnassignedFilterOption),
@@ -23,7 +26,7 @@ var getAssigneeUnassignedFilterOption = exports.getAssigneeUnassignedFilterOptio
23
26
  };
24
27
  var useFilterOptions = exports.useFilterOptions = function useFilterOptions(_ref) {
25
28
  var filterType = _ref.filterType,
26
- cloudId = _ref.cloudId;
29
+ site = _ref.site;
27
30
  var _useIntl = (0, _reactIntlNext.useIntl)(),
28
31
  formatMessage = _useIntl.formatMessage;
29
32
  var _useState = (0, _react.useState)([]),
@@ -47,10 +50,13 @@ var useFilterOptions = exports.useFilterOptions = function useFilterOptions(_ref
47
50
  nextPageCursor = _useState10[0],
48
51
  setNextPageCursor = _useState10[1];
49
52
  var initialData = (0, _react.useRef)();
53
+ var _ref2 = site || {},
54
+ cloudId = _ref2.cloudId,
55
+ siteUrl = _ref2.url;
50
56
  var _useBasicFilterAGG = (0, _useBasicFilterAGG2.useBasicFilterAGG)(),
51
57
  getFieldValues = _useBasicFilterAGG.getFieldValues;
52
58
  var fetchFilterOptions = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
53
- var _ref3,
59
+ var _ref4,
54
60
  pageCursor,
55
61
  searchString,
56
62
  isNewSearch,
@@ -63,21 +69,27 @@ var useFilterOptions = exports.useFilterOptions = function useFilterOptions(_ref
63
69
  return _regenerator.default.wrap(function _callee$(_context) {
64
70
  while (1) switch (_context.prev = _context.next) {
65
71
  case 0:
66
- _ref3 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, pageCursor = _ref3.pageCursor, searchString = _ref3.searchString;
72
+ _ref4 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, pageCursor = _ref4.pageCursor, searchString = _ref4.searchString;
73
+ if (cloudId) {
74
+ _context.next = 3;
75
+ break;
76
+ }
77
+ return _context.abrupt("return");
78
+ case 3:
67
79
  isNewSearch = !pageCursor;
68
80
  isNewSearch ? setStatus('loading') : setStatus('loadingMore');
69
81
  isRequestLikeInitialSearch = !pageCursor && !searchString;
70
82
  initialResponseData = initialData.current;
71
- _context.prev = 5;
83
+ _context.prev = 7;
72
84
  if (!(isRequestLikeInitialSearch && initialResponseData)) {
73
- _context.next = 10;
85
+ _context.next = 12;
74
86
  break;
75
87
  }
76
88
  _context.t0 = initialResponseData;
77
- _context.next = 13;
89
+ _context.next = 15;
78
90
  break;
79
- case 10:
80
- _context.next = 12;
91
+ case 12:
92
+ _context.next = 14;
81
93
  return getFieldValues({
82
94
  cloudId: cloudId,
83
95
  jql: '',
@@ -85,19 +97,21 @@ var useFilterOptions = exports.useFilterOptions = function useFilterOptions(_ref
85
97
  searchString: searchString,
86
98
  pageCursor: pageCursor
87
99
  });
88
- case 12:
100
+ case 14:
89
101
  _context.t0 = _context.sent;
90
- case 13:
102
+ case 15:
91
103
  response = _context.t0;
92
104
  if (!(response.errors && response.errors.length > 0)) {
93
- _context.next = 18;
105
+ _context.next = 20;
94
106
  break;
95
107
  }
96
108
  setStatus('rejected');
97
109
  setErrors(response.errors);
98
110
  return _context.abrupt("return");
99
- case 18:
100
- mappedResponse = (0, _transformers.mapFieldValuesToFilterOptions)(response);
111
+ case 20:
112
+ mappedResponse = (0, _transformers.mapFieldValuesToFilterOptions)(_objectSpread(_objectSpread({}, response), {}, {
113
+ siteUrl: siteUrl
114
+ }));
101
115
  mappedTotalCount = (0, _transformers.mapFieldValuesToTotalCount)(response);
102
116
  if (isNewSearch) {
103
117
  if (isRequestLikeInitialSearch) {
@@ -123,19 +137,19 @@ var useFilterOptions = exports.useFilterOptions = function useFilterOptions(_ref
123
137
  setTotalCount(mappedTotalCount);
124
138
  setNextPageCursor((0, _transformers.mapFieldValuesToPageCursor)(response));
125
139
  setStatus('resolved');
126
- _context.next = 30;
140
+ _context.next = 32;
127
141
  break;
128
- case 26:
129
- _context.prev = 26;
130
- _context.t1 = _context["catch"](5);
142
+ case 28:
143
+ _context.prev = 28;
144
+ _context.t1 = _context["catch"](7);
131
145
  setStatus('rejected');
132
146
  setErrors([_context.t1]);
133
- case 30:
147
+ case 32:
134
148
  case "end":
135
149
  return _context.stop();
136
150
  }
137
- }, _callee, null, [[5, 26]]);
138
- })), [cloudId, filterOptions, filterType, formatMessage, getFieldValues]);
151
+ }, _callee, null, [[7, 28]]);
152
+ })), [cloudId, filterOptions, filterType, formatMessage, getFieldValues, siteUrl]);
139
153
  (0, _react.useEffect)(function () {
140
154
  if (status !== 'rejected' && errors.length !== 0) {
141
155
  setErrors([]);
@@ -36,7 +36,7 @@ var noFilterOptions = function noFilterOptions() {
36
36
  var SEARCH_DEBOUNCE_MS = exports.SEARCH_DEBOUNCE_MS = 350;
37
37
  var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
38
38
  var filterType = _ref.filterType,
39
- cloudId = _ref.cloudId,
39
+ site = _ref.site,
40
40
  selection = _ref.selection,
41
41
  isJQLHydrating = _ref.isJQLHydrating,
42
42
  _ref$onSelectionChang = _ref.onSelectionChange,
@@ -59,12 +59,14 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
59
59
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
60
60
  sortedOptions = _useState6[0],
61
61
  setSortedOptions = _useState6[1];
62
- var currentSiteCloudId = (0, _react.useRef)(cloudId);
62
+ var _ref2 = site || {},
63
+ cloudId = _ref2.cloudId;
64
+ var currentSiteCloudId = (0, _react.useRef)(cloudId || '');
63
65
  var sortPaginatedResults = (0, _react.useRef)(false); // this is to track pagination for sorting purpose
64
66
 
65
67
  var _useFilterOptions = (0, _useFilterOptions2.useFilterOptions)({
66
68
  filterType: filterType,
67
- cloudId: cloudId
69
+ site: site
68
70
  }),
69
71
  filterOptions = _useFilterOptions.filterOptions,
70
72
  fetchFilterOptions = _useFilterOptions.fetchFilterOptions,
@@ -81,7 +83,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
81
83
  _useDebouncedCallback2 = (0, _slicedToArray2.default)(_useDebouncedCallback, 1),
82
84
  handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
83
85
  var handleInputChange = (0, _react.useCallback)( /*#__PURE__*/function () {
84
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newSearchTerm, actionMeta) {
86
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newSearchTerm, actionMeta) {
85
87
  return _regenerator.default.wrap(function _callee$(_context) {
86
88
  while (1) switch (_context.prev = _context.next) {
87
89
  case 0:
@@ -96,7 +98,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
96
98
  }, _callee);
97
99
  }));
98
100
  return function (_x, _x2) {
99
- return _ref2.apply(this, arguments);
101
+ return _ref3.apply(this, arguments);
100
102
  };
101
103
  }(), [handleDebouncedFetchFilterOptions, searchTerm]);
102
104
  var handleOptionSelection = (0, _react.useCallback)(function (newValue) {
@@ -195,7 +197,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
195
197
  }, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
196
198
 
197
199
  (0, _react.useEffect)(function () {
198
- if (currentSiteCloudId.current !== cloudId) {
200
+ if (cloudId && currentSiteCloudId.current !== cloudId) {
199
201
  currentSiteCloudId.current = cloudId;
200
202
  setSortedOptions([]);
201
203
  setSearchTerm('');
@@ -262,9 +264,9 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
262
264
  onInputChange: handleInputChange,
263
265
  onOpen: handleMenuOpen,
264
266
  onClose: handleMenuClose,
265
- target: function target(_ref3) {
266
- var isOpen = _ref3.isOpen,
267
- triggerProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
267
+ target: function target(_ref4) {
268
+ var isOpen = _ref4.isOpen,
269
+ triggerProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded);
268
270
  return /*#__PURE__*/_react.default.createElement(_trigger.default, (0, _extends2.default)({}, triggerProps, {
269
271
  filterType: filterType,
270
272
  selectedOptions: selectedOptions,
@@ -18,13 +18,15 @@ var basicFilterContainerStyles = (0, _primitives.xcss)({
18
18
  });
19
19
  var BasicFilterContainer = function BasicFilterContainer(_ref) {
20
20
  var jql = _ref.jql,
21
- cloudId = _ref.cloudId,
21
+ site = _ref.site,
22
22
  onChange = _ref.onChange,
23
23
  selections = _ref.selections,
24
24
  isJQLHydrating = _ref.isJQLHydrating;
25
25
  var extractedFilterValues = (0, _react.useMemo)(function () {
26
26
  return isJQLHydrating ? (0, _extractValuesFromNonComplexJQL.extractValuesFromNonComplexJQL)(jql) : {};
27
27
  }, [isJQLHydrating, jql]);
28
+ var _ref2 = site || {},
29
+ cloudId = _ref2.cloudId;
28
30
  return /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
29
31
  xcss: basicFilterContainerStyles,
30
32
  gap: "space.100",
@@ -33,7 +35,7 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
33
35
  var _extractedFilterValue;
34
36
  var shouldShowHydrationLoader = isJQLHydrating && ((_extractedFilterValue = extractedFilterValues[filter]) === null || _extractedFilterValue === void 0 ? void 0 : _extractedFilterValue.length) > 0;
35
37
  return /*#__PURE__*/_react.default.createElement(_asyncPopupSelect.default, {
36
- cloudId: cloudId,
38
+ site: site,
37
39
  filterType: filter,
38
40
  key: filter,
39
41
  selection: selections[filter] || [],
@@ -24,6 +24,15 @@ var getLozengeAppearance = function getLozengeAppearance(colorName) {
24
24
  return _types.appearanceMap[colorName];
25
25
  }
26
26
  };
27
+ var checkAndConvertToAbsoluteUrl = function checkAndConvertToAbsoluteUrl(url, siteUrl) {
28
+ if (!url) {
29
+ return '';
30
+ }
31
+ if (/^data:(.*)/.test(url) || /^http(.*)/.test(url) || !siteUrl) {
32
+ return url;
33
+ }
34
+ return "".concat(siteUrl).concat(url);
35
+ };
27
36
  function mapNodeToOption(_ref) {
28
37
  var displayName = _ref.displayName,
29
38
  jqlTerm = _ref.jqlTerm,
@@ -31,7 +40,8 @@ function mapNodeToOption(_ref) {
31
40
  issueTypes = _ref.issueTypes,
32
41
  project = _ref.project,
33
42
  statusCategory = _ref.statusCategory,
34
- user = _ref.user;
43
+ user = _ref.user,
44
+ siteUrl = _ref.siteUrl;
35
45
  try {
36
46
  var baseProps = {
37
47
  label: displayName,
@@ -56,14 +66,14 @@ function mapNodeToOption(_ref) {
56
66
  var _project$avatar;
57
67
  return _objectSpread(_objectSpread({}, baseProps), {}, {
58
68
  optionType: 'iconLabel',
59
- icon: (_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small
69
+ icon: checkAndConvertToAbsoluteUrl((_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small, siteUrl)
60
70
  });
61
71
  }
62
72
  if (issueTypes) {
63
73
  var _issueTypes$;
64
74
  return _objectSpread(_objectSpread({}, baseProps), {}, {
65
75
  optionType: 'iconLabel',
66
- icon: (_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small
76
+ icon: checkAndConvertToAbsoluteUrl((_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small, siteUrl)
67
77
  });
68
78
  }
69
79
  if (statusCategory) {
@@ -102,9 +112,12 @@ function mapHydrateResponseData(_ref2) {
102
112
  }
103
113
  function mapFieldValuesToFilterOptions(_ref5) {
104
114
  var _data$jira2;
105
- var data = _ref5.data;
115
+ var data = _ref5.data,
116
+ siteUrl = _ref5.siteUrl;
106
117
  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) {
107
- return edge.node ? mapNodeToOption(edge.node) : null;
118
+ return edge.node ? mapNodeToOption(_objectSpread(_objectSpread({}, edge.node), {}, {
119
+ siteUrl: siteUrl
120
+ })) : null;
108
121
  }).filter(isNonNullSelectOption)) || [];
109
122
  }
110
123
  function mapFieldValuesToTotalCount(_ref6) {
@@ -48,7 +48,8 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
48
48
  initialSearchMethod = props.initialSearchMethod,
49
49
  setSearchBarJql = props.setSearchBarJql,
50
50
  _props$searchBarJql = props.searchBarJql,
51
- searchBarJql = _props$searchBarJql === void 0 ? DEFAULT_JQL_QUERY : _props$searchBarJql;
51
+ searchBarJql = _props$searchBarJql === void 0 ? DEFAULT_JQL_QUERY : _props$searchBarJql,
52
+ site = props.site;
52
53
  var _ref = parameters || {},
53
54
  currentCloudId = _ref.cloudId;
54
55
  var _useIntl = (0, _reactIntlNext.useIntl)(),
@@ -228,7 +229,7 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
228
229
  searchTerm: basicSearchTerm
229
230
  }), showBasicFilters && (0, _react2.jsx)(_basicFilters.BasicFilters, {
230
231
  jql: searchBarJql,
231
- cloudId: cloudId || '',
232
+ site: site,
232
233
  onChange: handleBasicFilterSelectionChange,
233
234
  selections: filterSelections,
234
235
  isJQLHydrating: basicFilterHydrationStatus === 'loading'
@@ -570,7 +570,8 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
570
570
  parameters: parameters,
571
571
  onSearch: onSearch,
572
572
  initialSearchMethod: initialSearchMethod,
573
- onSearchMethodChange: setCurrentSearchMethod
573
+ onSearchMethodChange: setCurrentSearchMethod,
574
+ site: selectedJiraSite
574
575
  }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()) : (0, _react2.jsx)(_noInstances.NoInstancesView, null)), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
575
576
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
576
577
  css: issueCountStyles
@@ -1,5 +1,5 @@
1
1
  export const EVENT_CHANNEL = 'media';
2
2
  export const packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.19.21"
4
+ packageVersion: "1.19.22"
5
5
  };
@@ -10,7 +10,7 @@ export const getAssigneeUnassignedFilterOption = formatMessage => ({
10
10
  });
11
11
  export const useFilterOptions = ({
12
12
  filterType,
13
- cloudId
13
+ site
14
14
  }) => {
15
15
  const {
16
16
  formatMessage
@@ -21,6 +21,10 @@ export const useFilterOptions = ({
21
21
  const [errors, setErrors] = useState([]);
22
22
  const [nextPageCursor, setNextPageCursor] = useState(undefined);
23
23
  const initialData = useRef();
24
+ const {
25
+ cloudId,
26
+ url: siteUrl
27
+ } = site || {};
24
28
  const {
25
29
  getFieldValues
26
30
  } = useBasicFilterAGG();
@@ -28,6 +32,9 @@ export const useFilterOptions = ({
28
32
  pageCursor,
29
33
  searchString
30
34
  } = {}) => {
35
+ if (!cloudId) {
36
+ return;
37
+ }
31
38
  const isNewSearch = !pageCursor;
32
39
  isNewSearch ? setStatus('loading') : setStatus('loadingMore');
33
40
  const isRequestLikeInitialSearch = !pageCursor && !searchString;
@@ -47,7 +54,10 @@ export const useFilterOptions = ({
47
54
  setErrors(response.errors);
48
55
  return;
49
56
  }
50
- const mappedResponse = mapFieldValuesToFilterOptions(response);
57
+ const mappedResponse = mapFieldValuesToFilterOptions({
58
+ ...response,
59
+ siteUrl
60
+ });
51
61
  let mappedTotalCount = mapFieldValuesToTotalCount(response);
52
62
  if (isNewSearch) {
53
63
  if (isRequestLikeInitialSearch) {
@@ -77,7 +87,7 @@ export const useFilterOptions = ({
77
87
  setStatus('rejected');
78
88
  setErrors([error]);
79
89
  }
80
- }, [cloudId, filterOptions, filterType, formatMessage, getFieldValues]);
90
+ }, [cloudId, filterOptions, filterType, formatMessage, getFieldValues, siteUrl]);
81
91
  useEffect(() => {
82
92
  if (status !== 'rejected' && errors.length !== 0) {
83
93
  setErrors([]);
@@ -18,7 +18,7 @@ const noFilterOptions = () => true;
18
18
  export const SEARCH_DEBOUNCE_MS = 350;
19
19
  const AsyncPopupSelect = ({
20
20
  filterType,
21
- cloudId,
21
+ site,
22
22
  selection,
23
23
  isJQLHydrating,
24
24
  onSelectionChange = () => {},
@@ -33,7 +33,10 @@ const AsyncPopupSelect = ({
33
33
  const [searchTerm, setSearchTerm] = useState('');
34
34
  const [selectedOptions, setSelectedOptions] = useState(selection);
35
35
  const [sortedOptions, setSortedOptions] = useState([]);
36
- const currentSiteCloudId = useRef(cloudId);
36
+ const {
37
+ cloudId
38
+ } = site || {};
39
+ const currentSiteCloudId = useRef(cloudId || '');
37
40
  const sortPaginatedResults = useRef(false); // this is to track pagination for sorting purpose
38
41
 
39
42
  const {
@@ -46,7 +49,7 @@ const AsyncPopupSelect = ({
46
49
  errors
47
50
  } = useFilterOptions({
48
51
  filterType,
49
- cloudId
52
+ site
50
53
  });
51
54
  const [handleDebouncedFetchFilterOptions] = useDebouncedCallback(searchString => {
52
55
  fetchFilterOptions({
@@ -147,7 +150,7 @@ const AsyncPopupSelect = ({
147
150
  }, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
148
151
 
149
152
  useEffect(() => {
150
- if (currentSiteCloudId.current !== cloudId) {
153
+ if (cloudId && currentSiteCloudId.current !== cloudId) {
151
154
  currentSiteCloudId.current = cloudId;
152
155
  setSortedOptions([]);
153
156
  setSearchTerm('');
@@ -8,12 +8,15 @@ const basicFilterContainerStyles = xcss({
8
8
  });
9
9
  const BasicFilterContainer = ({
10
10
  jql,
11
- cloudId,
11
+ site,
12
12
  onChange,
13
13
  selections,
14
14
  isJQLHydrating
15
15
  }) => {
16
16
  const extractedFilterValues = useMemo(() => isJQLHydrating ? extractValuesFromNonComplexJQL(jql) : {}, [isJQLHydrating, jql]);
17
+ const {
18
+ cloudId
19
+ } = site || {};
17
20
  return /*#__PURE__*/React.createElement(Flex, {
18
21
  xcss: basicFilterContainerStyles,
19
22
  gap: "space.100",
@@ -22,7 +25,7 @@ const BasicFilterContainer = ({
22
25
  var _extractedFilterValue;
23
26
  const shouldShowHydrationLoader = isJQLHydrating && ((_extractedFilterValue = extractedFilterValues[filter]) === null || _extractedFilterValue === void 0 ? void 0 : _extractedFilterValue.length) > 0;
24
27
  return /*#__PURE__*/React.createElement(AsyncPopupSelect, {
25
- cloudId: cloudId,
28
+ site: site,
26
29
  filterType: filter,
27
30
  key: filter,
28
31
  selection: selections[filter] || [],
@@ -11,6 +11,15 @@ const getLozengeAppearance = colorName => {
11
11
  return appearanceMap[colorName];
12
12
  }
13
13
  };
14
+ const checkAndConvertToAbsoluteUrl = (url, siteUrl) => {
15
+ if (!url) {
16
+ return '';
17
+ }
18
+ if (/^data:(.*)/.test(url) || /^http(.*)/.test(url) || !siteUrl) {
19
+ return url;
20
+ }
21
+ return `${siteUrl}${url}`;
22
+ };
14
23
  function mapNodeToOption({
15
24
  displayName,
16
25
  jqlTerm,
@@ -18,7 +27,8 @@ function mapNodeToOption({
18
27
  issueTypes,
19
28
  project,
20
29
  statusCategory,
21
- user
30
+ user,
31
+ siteUrl
22
32
  }) {
23
33
  try {
24
34
  const baseProps = {
@@ -47,7 +57,7 @@ function mapNodeToOption({
47
57
  return {
48
58
  ...baseProps,
49
59
  optionType: 'iconLabel',
50
- icon: (_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small
60
+ icon: checkAndConvertToAbsoluteUrl((_project$avatar = project.avatar) === null || _project$avatar === void 0 ? void 0 : _project$avatar.small, siteUrl)
51
61
  };
52
62
  }
53
63
  if (issueTypes) {
@@ -55,7 +65,7 @@ function mapNodeToOption({
55
65
  return {
56
66
  ...baseProps,
57
67
  optionType: 'iconLabel',
58
- icon: (_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small
68
+ icon: checkAndConvertToAbsoluteUrl((_issueTypes$ = issueTypes[0]) === null || _issueTypes$ === void 0 ? void 0 : _issueTypes$.avatar.small, siteUrl)
59
69
  };
60
70
  }
61
71
  if (statusCategory) {
@@ -94,10 +104,14 @@ export function mapHydrateResponseData({
94
104
  return transformedHydrateResponseData;
95
105
  }
96
106
  export function mapFieldValuesToFilterOptions({
97
- data
107
+ data,
108
+ siteUrl
98
109
  }) {
99
110
  var _data$jira2, _data$jira2$jqlBuilde, _data$jira2$jqlBuilde2, _data$jira2$jqlBuilde3;
100
- return (data === null || data === void 0 ? void 0 : (_data$jira2 = data.jira) === null || _data$jira2 === void 0 ? void 0 : (_data$jira2$jqlBuilde = _data$jira2.jqlBuilder) === null || _data$jira2$jqlBuilde === void 0 ? void 0 : (_data$jira2$jqlBuilde2 = _data$jira2$jqlBuilde.fieldValues) === null || _data$jira2$jqlBuilde2 === void 0 ? void 0 : (_data$jira2$jqlBuilde3 = _data$jira2$jqlBuilde2.edges) === null || _data$jira2$jqlBuilde3 === void 0 ? void 0 : _data$jira2$jqlBuilde3.map(edge => edge.node ? mapNodeToOption(edge.node) : null).filter(isNonNullSelectOption)) || [];
111
+ return (data === null || data === void 0 ? void 0 : (_data$jira2 = data.jira) === null || _data$jira2 === void 0 ? void 0 : (_data$jira2$jqlBuilde = _data$jira2.jqlBuilder) === null || _data$jira2$jqlBuilde === void 0 ? void 0 : (_data$jira2$jqlBuilde2 = _data$jira2$jqlBuilde.fieldValues) === null || _data$jira2$jqlBuilde2 === void 0 ? void 0 : (_data$jira2$jqlBuilde3 = _data$jira2$jqlBuilde2.edges) === null || _data$jira2$jqlBuilde3 === void 0 ? void 0 : _data$jira2$jqlBuilde3.map(edge => edge.node ? mapNodeToOption({
112
+ ...edge.node,
113
+ siteUrl
114
+ }) : null).filter(isNonNullSelectOption)) || [];
101
115
  }
102
116
  export function mapFieldValuesToTotalCount({
103
117
  data
@@ -33,7 +33,8 @@ export const JiraSearchContainer = props => {
33
33
  onSearchMethodChange: onSearchMethodChangeCallback,
34
34
  initialSearchMethod,
35
35
  setSearchBarJql,
36
- searchBarJql = DEFAULT_JQL_QUERY
36
+ searchBarJql = DEFAULT_JQL_QUERY,
37
+ site
37
38
  } = props;
38
39
  const {
39
40
  cloudId: currentCloudId
@@ -194,7 +195,7 @@ export const JiraSearchContainer = props => {
194
195
  searchTerm: basicSearchTerm
195
196
  }), showBasicFilters && jsx(BasicFilters, {
196
197
  jql: searchBarJql,
197
- cloudId: cloudId || '',
198
+ site: site,
198
199
  onChange: handleBasicFilterSelectionChange,
199
200
  selections: filterSelections,
200
201
  isJQLHydrating: basicFilterHydrationStatus === 'loading'
@@ -518,7 +518,8 @@ export const PlainJiraIssuesConfigModal = props => {
518
518
  parameters: parameters,
519
519
  onSearch: onSearch,
520
520
  initialSearchMethod: initialSearchMethod,
521
- onSearchMethodChange: setCurrentSearchMethod
521
+ onSearchMethodChange: setCurrentSearchMethod,
522
+ site: selectedJiraSite
522
523
  }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()) : jsx(NoInstancesView, null)), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
523
524
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
524
525
  css: issueCountStyles
@@ -1,5 +1,5 @@
1
1
  export var EVENT_CHANNEL = 'media';
2
2
  export var packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.19.21"
4
+ packageVersion: "1.19.22"
5
5
  };
@@ -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,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[]>;
@@ -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,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[]>;
@@ -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.22",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"