@atlaskit/link-datasource 3.8.10 → 3.9.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#164965](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164965)
8
+ [`99d00d17f1e68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/99d00d17f1e68) -
9
+ Internal refactor behind ff - Fixes `executeFetch` being fired after selecting item from dropdpwn
10
+ list
11
+ - [#164465](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164465)
12
+ [`ef019ecbcb056`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ef019ecbcb056) -
13
+ Feature flag removed - platform.linking-platform.datasource.limit-total-results_8wqcd
14
+ - Updated dependencies
15
+
16
+ ## 3.9.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#164042](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164042)
21
+ [`c10b60eefe529`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c10b60eefe529) -
22
+ [ux] Changing the menu placement of the inline edit status dropdown to auto
23
+
3
24
  ## 3.8.10
4
25
 
5
26
  ### Patch Changes
@@ -206,12 +206,15 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
206
206
  var _useDatasourceClientE2 = (0, _linkClientExtension.useDatasourceClientExtension)(),
207
207
  executeAction = _useDatasourceClientE2.executeAtomicAction,
208
208
  invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
209
- var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
210
- fireEvent = _useDatasourceAnalyti.fireEvent;
211
- var _useErrorLogger = (0, _useErrorLogger2.default)({
209
+ var loggerProps = (0, _react.useMemo)(function () {
210
+ return {
212
211
  integrationKey: integrationKey
213
- }),
212
+ };
213
+ }, [integrationKey]);
214
+ var _useErrorLogger = (0, _useErrorLogger2.default)(loggerProps),
214
215
  captureError = _useErrorLogger.captureError;
216
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
217
+ fireEvent = _useDatasourceAnalyti.fireEvent;
215
218
  var execute = (0, _react.useCallback)(function (value) {
216
219
  if (!schema) {
217
220
  throw new Error('No action schema found.');
@@ -23,7 +23,9 @@ var StatusEditType = function StatusEditType(props) {
23
23
  var _currentValue$values;
24
24
  var currentValue = props.currentValue,
25
25
  executeFetch = props.executeFetch;
26
- var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
26
+ var _useStatusOptions = useStatusOptions({
27
+ executeFetch: executeFetch
28
+ }),
27
29
  options = _useStatusOptions.options,
28
30
  isLoading = _useStatusOptions.isLoading,
29
31
  hasFailed = _useStatusOptions.hasFailed;
@@ -54,6 +56,7 @@ var StatusEditType = function StatusEditType(props) {
54
56
  isLoading: isLoading,
55
57
  defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
56
58
  filterOption: filterOption,
59
+ menuPlacement: "auto",
57
60
  formatOptionLabel: function formatOptionLabel(option) {
58
61
  return /*#__PURE__*/_react.default.createElement(_lozenge.default, (0, _extends2.default)({
59
62
  testId: "inline-edit-status-option-".concat(option.text)
@@ -70,7 +73,9 @@ var StatusEditType = function StatusEditType(props) {
70
73
  var filterOption = function filterOption(option, inputValue) {
71
74
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
72
75
  };
73
- var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
76
+ var useStatusOptions = function useStatusOptions(_ref) {
77
+ var fetchInputs = _ref.fetchInputs,
78
+ executeFetch = _ref.executeFetch;
74
79
  var _useState = (0, _react.useState)({
75
80
  isLoading: true,
76
81
  options: [],
@@ -84,7 +89,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
84
89
  setOptions = _useState2[1];
85
90
  (0, _react.useEffect)(function () {
86
91
  var isMounted = true;
87
- loadOptions(currentValue, executeFetch).then(function (options) {
92
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
88
93
  if (isMounted) {
89
94
  setOptions({
90
95
  isLoading: false,
@@ -102,7 +107,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
102
107
  return function () {
103
108
  isMounted = false;
104
109
  };
105
- }, [currentValue, executeFetch]);
110
+ }, [fetchInputs, executeFetch]);
106
111
  return {
107
112
  options: options,
108
113
  isLoading: isLoading,
@@ -110,28 +115,35 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
110
115
  };
111
116
  };
112
117
  var loadOptions = /*#__PURE__*/function () {
113
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
114
- var result, operationStatus, entities;
118
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
119
+ var fetchInputs,
120
+ executeFetch,
121
+ result,
122
+ operationStatus,
123
+ entities,
124
+ _args = arguments;
115
125
  return _regenerator.default.wrap(function _callee$(_context) {
116
126
  while (1) switch (_context.prev = _context.next) {
117
127
  case 0:
128
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
129
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
118
130
  if (!executeFetch) {
119
- _context.next = 9;
131
+ _context.next = 11;
120
132
  break;
121
133
  }
122
- _context.next = 3;
123
- return executeFetch({});
124
- case 3:
134
+ _context.next = 5;
135
+ return executeFetch(fetchInputs);
136
+ case 5:
125
137
  result = _context.sent;
126
138
  operationStatus = result.operationStatus, entities = result.entities;
127
139
  if (!(operationStatus === _linkingTypes.ActionOperationStatus.FAILURE)) {
128
- _context.next = 7;
140
+ _context.next = 9;
129
141
  break;
130
142
  }
131
143
  throw new Error('Failed to fetch status options');
132
- case 7:
144
+ case 9:
133
145
  if (!entities) {
134
- _context.next = 9;
146
+ _context.next = 11;
135
147
  break;
136
148
  }
137
149
  return _context.abrupt("return", entities.map(function (entity) {
@@ -142,16 +154,16 @@ var loadOptions = /*#__PURE__*/function () {
142
154
  transitionId: entity.transitionId
143
155
  };
144
156
  }));
145
- case 9:
157
+ case 11:
146
158
  return _context.abrupt("return", []);
147
- case 10:
159
+ case 12:
148
160
  case "end":
149
161
  return _context.stop();
150
162
  }
151
163
  }, _callee);
152
164
  }));
153
- return function loadOptions(_x, _x2) {
154
- return _ref.apply(this, arguments);
165
+ return function loadOptions() {
166
+ return _ref2.apply(this, arguments);
155
167
  };
156
168
  }();
157
169
  var _default = exports.default = StatusEditType;
@@ -13,7 +13,6 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _button = _interopRequireDefault(require("@atlaskit/button"));
15
15
  var _refresh = _interopRequireDefault(require("@atlaskit/icon/core/migration/refresh"));
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  var _primitives = require("@atlaskit/primitives");
18
17
  var _colors = require("@atlaskit/theme/colors");
19
18
  var _assetsModal = require("../assets-modal");
@@ -85,7 +84,7 @@ var TableFooter = exports.TableFooter = function TableFooter(_ref) {
85
84
  // ensure correct positioning since 'justify-content: space-between' is used).
86
85
  return onRefresh || showItemCount ? (0, _react2.jsx)(FooterWrapper, {
87
86
  "data-testid": "table-footer"
88
- }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID && (0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.limit-total-results_8wqcd') ? (0, _react2.jsx)(_searchCount.AssetsItemCount, {
87
+ }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? (0, _react2.jsx)(_searchCount.AssetsItemCount, {
89
88
  searchCount: itemCount,
90
89
  url: url,
91
90
  testId: "item-count"
@@ -189,14 +189,15 @@ export const useExecuteAtomicAction = ({
189
189
  executeAtomicAction: executeAction,
190
190
  invalidateDatasourceDataCacheByAri
191
191
  } = useDatasourceClientExtension();
192
+ const loggerProps = useMemo(() => ({
193
+ integrationKey
194
+ }), [integrationKey]);
195
+ const {
196
+ captureError
197
+ } = useErrorLogger(loggerProps);
192
198
  const {
193
199
  fireEvent
194
200
  } = useDatasourceAnalyticsEvents();
195
- const {
196
- captureError
197
- } = useErrorLogger({
198
- integrationKey
199
- });
200
201
  const execute = useCallback(value => {
201
202
  if (!schema) {
202
203
  throw new Error('No action schema found.');
@@ -16,7 +16,9 @@ const StatusEditType = props => {
16
16
  options,
17
17
  isLoading,
18
18
  hasFailed
19
- } = useStatusOptions(currentValue, executeFetch);
19
+ } = useStatusOptions({
20
+ executeFetch
21
+ });
20
22
  const experienceId = useDatasourceExperienceId();
21
23
  useEffect(() => {
22
24
  if (!experienceId) {
@@ -42,6 +44,7 @@ const StatusEditType = props => {
42
44
  isLoading: isLoading,
43
45
  defaultValue: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
44
46
  filterOption: filterOption,
47
+ menuPlacement: "auto",
45
48
  formatOptionLabel: option => /*#__PURE__*/React.createElement(Lozenge, _extends({
46
49
  testId: `inline-edit-status-option-${option.text}`
47
50
  }, option.style), option.text),
@@ -52,7 +55,10 @@ const StatusEditType = props => {
52
55
  }));
53
56
  };
54
57
  const filterOption = (option, inputValue) => option.data.text.toLowerCase().includes(inputValue.toLowerCase());
55
- const useStatusOptions = (currentValue, executeFetch) => {
58
+ const useStatusOptions = ({
59
+ fetchInputs,
60
+ executeFetch
61
+ }) => {
56
62
  const [{
57
63
  options,
58
64
  isLoading,
@@ -64,7 +70,7 @@ const useStatusOptions = (currentValue, executeFetch) => {
64
70
  });
65
71
  useEffect(() => {
66
72
  let isMounted = true;
67
- loadOptions(currentValue, executeFetch).then(options => {
73
+ loadOptions(fetchInputs, executeFetch).then(options => {
68
74
  if (isMounted) {
69
75
  setOptions({
70
76
  isLoading: false,
@@ -82,16 +88,16 @@ const useStatusOptions = (currentValue, executeFetch) => {
82
88
  return () => {
83
89
  isMounted = false;
84
90
  };
85
- }, [currentValue, executeFetch]);
91
+ }, [fetchInputs, executeFetch]);
86
92
  return {
87
93
  options,
88
94
  isLoading,
89
95
  hasFailed
90
96
  };
91
97
  };
92
- const loadOptions = async (currentValue, executeFetch) => {
98
+ const loadOptions = async (fetchInputs = {}, executeFetch) => {
93
99
  if (executeFetch) {
94
- const result = await executeFetch({});
100
+ const result = await executeFetch(fetchInputs);
95
101
  const {
96
102
  operationStatus,
97
103
  entities
@@ -11,7 +11,6 @@ import styled from '@emotion/styled';
11
11
  import { FormattedMessage, useIntl } from 'react-intl-next';
12
12
  import Button from '@atlaskit/button';
13
13
  import RefreshIcon from '@atlaskit/icon/core/migration/refresh';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { Flex } from '@atlaskit/primitives';
16
15
  import { N0, N40, N90 } from '@atlaskit/theme/colors';
17
16
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
@@ -70,7 +69,7 @@ export const TableFooter = ({
70
69
  // ensure correct positioning since 'justify-content: space-between' is used).
71
70
  return onRefresh || showItemCount ? jsx(FooterWrapper, {
72
71
  "data-testid": "table-footer"
73
- }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID && fg('platform.linking-platform.datasource.limit-total-results_8wqcd') ? jsx(AssetsItemCount, {
72
+ }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? jsx(AssetsItemCount, {
74
73
  searchCount: itemCount,
75
74
  url: url,
76
75
  testId: "item-count"
@@ -200,12 +200,15 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
200
200
  var _useDatasourceClientE2 = useDatasourceClientExtension(),
201
201
  executeAction = _useDatasourceClientE2.executeAtomicAction,
202
202
  invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
203
- var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
204
- fireEvent = _useDatasourceAnalyti.fireEvent;
205
- var _useErrorLogger = useErrorLogger({
203
+ var loggerProps = useMemo(function () {
204
+ return {
206
205
  integrationKey: integrationKey
207
- }),
206
+ };
207
+ }, [integrationKey]);
208
+ var _useErrorLogger = useErrorLogger(loggerProps),
208
209
  captureError = _useErrorLogger.captureError;
210
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
211
+ fireEvent = _useDatasourceAnalyti.fireEvent;
209
212
  var execute = useCallback(function (value) {
210
213
  if (!schema) {
211
214
  throw new Error('No action schema found.');
@@ -13,7 +13,9 @@ var StatusEditType = function StatusEditType(props) {
13
13
  var _currentValue$values;
14
14
  var currentValue = props.currentValue,
15
15
  executeFetch = props.executeFetch;
16
- var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
16
+ var _useStatusOptions = useStatusOptions({
17
+ executeFetch: executeFetch
18
+ }),
17
19
  options = _useStatusOptions.options,
18
20
  isLoading = _useStatusOptions.isLoading,
19
21
  hasFailed = _useStatusOptions.hasFailed;
@@ -44,6 +46,7 @@ var StatusEditType = function StatusEditType(props) {
44
46
  isLoading: isLoading,
45
47
  defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
46
48
  filterOption: filterOption,
49
+ menuPlacement: "auto",
47
50
  formatOptionLabel: function formatOptionLabel(option) {
48
51
  return /*#__PURE__*/React.createElement(Lozenge, _extends({
49
52
  testId: "inline-edit-status-option-".concat(option.text)
@@ -60,7 +63,9 @@ var StatusEditType = function StatusEditType(props) {
60
63
  var filterOption = function filterOption(option, inputValue) {
61
64
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
62
65
  };
63
- var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
66
+ var useStatusOptions = function useStatusOptions(_ref) {
67
+ var fetchInputs = _ref.fetchInputs,
68
+ executeFetch = _ref.executeFetch;
64
69
  var _useState = useState({
65
70
  isLoading: true,
66
71
  options: [],
@@ -74,7 +79,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
74
79
  setOptions = _useState2[1];
75
80
  useEffect(function () {
76
81
  var isMounted = true;
77
- loadOptions(currentValue, executeFetch).then(function (options) {
82
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
78
83
  if (isMounted) {
79
84
  setOptions({
80
85
  isLoading: false,
@@ -92,7 +97,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
92
97
  return function () {
93
98
  isMounted = false;
94
99
  };
95
- }, [currentValue, executeFetch]);
100
+ }, [fetchInputs, executeFetch]);
96
101
  return {
97
102
  options: options,
98
103
  isLoading: isLoading,
@@ -100,28 +105,35 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
100
105
  };
101
106
  };
102
107
  var loadOptions = /*#__PURE__*/function () {
103
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentValue, executeFetch) {
104
- var result, operationStatus, entities;
108
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
109
+ var fetchInputs,
110
+ executeFetch,
111
+ result,
112
+ operationStatus,
113
+ entities,
114
+ _args = arguments;
105
115
  return _regeneratorRuntime.wrap(function _callee$(_context) {
106
116
  while (1) switch (_context.prev = _context.next) {
107
117
  case 0:
118
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
119
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
108
120
  if (!executeFetch) {
109
- _context.next = 9;
121
+ _context.next = 11;
110
122
  break;
111
123
  }
112
- _context.next = 3;
113
- return executeFetch({});
114
- case 3:
124
+ _context.next = 5;
125
+ return executeFetch(fetchInputs);
126
+ case 5:
115
127
  result = _context.sent;
116
128
  operationStatus = result.operationStatus, entities = result.entities;
117
129
  if (!(operationStatus === ActionOperationStatus.FAILURE)) {
118
- _context.next = 7;
130
+ _context.next = 9;
119
131
  break;
120
132
  }
121
133
  throw new Error('Failed to fetch status options');
122
- case 7:
134
+ case 9:
123
135
  if (!entities) {
124
- _context.next = 9;
136
+ _context.next = 11;
125
137
  break;
126
138
  }
127
139
  return _context.abrupt("return", entities.map(function (entity) {
@@ -132,16 +144,16 @@ var loadOptions = /*#__PURE__*/function () {
132
144
  transitionId: entity.transitionId
133
145
  };
134
146
  }));
135
- case 9:
147
+ case 11:
136
148
  return _context.abrupt("return", []);
137
- case 10:
149
+ case 12:
138
150
  case "end":
139
151
  return _context.stop();
140
152
  }
141
153
  }, _callee);
142
154
  }));
143
- return function loadOptions(_x, _x2) {
144
- return _ref.apply(this, arguments);
155
+ return function loadOptions() {
156
+ return _ref2.apply(this, arguments);
145
157
  };
146
158
  }();
147
159
  export default StatusEditType;
@@ -12,7 +12,6 @@ import styled from '@emotion/styled';
12
12
  import { FormattedMessage, useIntl } from 'react-intl-next';
13
13
  import Button from '@atlaskit/button';
14
14
  import RefreshIcon from '@atlaskit/icon/core/migration/refresh';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { Flex } from '@atlaskit/primitives';
17
16
  import { N0, N40, N90 } from '@atlaskit/theme/colors';
18
17
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
@@ -73,7 +72,7 @@ export var TableFooter = function TableFooter(_ref) {
73
72
  // ensure correct positioning since 'justify-content: space-between' is used).
74
73
  return onRefresh || showItemCount ? jsx(FooterWrapper, {
75
74
  "data-testid": "table-footer"
76
- }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID && fg('platform.linking-platform.datasource.limit-total-results_8wqcd') ? jsx(AssetsItemCount, {
75
+ }, jsx(TopBorderWrapper, null, showItemCount && jsx(Flex, null, datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? jsx(AssetsItemCount, {
77
76
  searchCount: itemCount,
78
77
  url: url,
79
78
  testId: "item-count"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.8.10",
3
+ "version": "3.9.1",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
71
71
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
72
72
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
73
- "@atlaskit/primitives": "^13.1.0",
73
+ "@atlaskit/primitives": "^13.2.0",
74
74
  "@atlaskit/react-select": "^1.3.0",
75
75
  "@atlaskit/select": "^18.5.0",
76
76
  "@atlaskit/smart-card": "^30.2.0",
@@ -174,9 +174,6 @@
174
174
  "platform.linking-platform.datasource-assets_update_refresh_button_dt3qk": {
175
175
  "type": "boolean"
176
176
  },
177
- "platform.linking-platform.datasource.limit-total-results_8wqcd": {
178
- "type": "boolean"
179
- },
180
177
  "platform-datasources-use-refactored-config-modal": {
181
178
  "type": "boolean"
182
179
  }