@atlaskit/link-datasource 3.9.0 → 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,18 @@
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
+
3
16
  ## 3.9.0
4
17
 
5
18
  ### Minor 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;
@@ -71,7 +73,9 @@ var StatusEditType = function StatusEditType(props) {
71
73
  var filterOption = function filterOption(option, inputValue) {
72
74
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
73
75
  };
74
- var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
76
+ var useStatusOptions = function useStatusOptions(_ref) {
77
+ var fetchInputs = _ref.fetchInputs,
78
+ executeFetch = _ref.executeFetch;
75
79
  var _useState = (0, _react.useState)({
76
80
  isLoading: true,
77
81
  options: [],
@@ -85,7 +89,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
85
89
  setOptions = _useState2[1];
86
90
  (0, _react.useEffect)(function () {
87
91
  var isMounted = true;
88
- loadOptions(currentValue, executeFetch).then(function (options) {
92
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
89
93
  if (isMounted) {
90
94
  setOptions({
91
95
  isLoading: false,
@@ -103,7 +107,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
103
107
  return function () {
104
108
  isMounted = false;
105
109
  };
106
- }, [currentValue, executeFetch]);
110
+ }, [fetchInputs, executeFetch]);
107
111
  return {
108
112
  options: options,
109
113
  isLoading: isLoading,
@@ -111,28 +115,35 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
111
115
  };
112
116
  };
113
117
  var loadOptions = /*#__PURE__*/function () {
114
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
115
- 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;
116
125
  return _regenerator.default.wrap(function _callee$(_context) {
117
126
  while (1) switch (_context.prev = _context.next) {
118
127
  case 0:
128
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
129
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
119
130
  if (!executeFetch) {
120
- _context.next = 9;
131
+ _context.next = 11;
121
132
  break;
122
133
  }
123
- _context.next = 3;
124
- return executeFetch({});
125
- case 3:
134
+ _context.next = 5;
135
+ return executeFetch(fetchInputs);
136
+ case 5:
126
137
  result = _context.sent;
127
138
  operationStatus = result.operationStatus, entities = result.entities;
128
139
  if (!(operationStatus === _linkingTypes.ActionOperationStatus.FAILURE)) {
129
- _context.next = 7;
140
+ _context.next = 9;
130
141
  break;
131
142
  }
132
143
  throw new Error('Failed to fetch status options');
133
- case 7:
144
+ case 9:
134
145
  if (!entities) {
135
- _context.next = 9;
146
+ _context.next = 11;
136
147
  break;
137
148
  }
138
149
  return _context.abrupt("return", entities.map(function (entity) {
@@ -143,16 +154,16 @@ var loadOptions = /*#__PURE__*/function () {
143
154
  transitionId: entity.transitionId
144
155
  };
145
156
  }));
146
- case 9:
157
+ case 11:
147
158
  return _context.abrupt("return", []);
148
- case 10:
159
+ case 12:
149
160
  case "end":
150
161
  return _context.stop();
151
162
  }
152
163
  }, _callee);
153
164
  }));
154
- return function loadOptions(_x, _x2) {
155
- return _ref.apply(this, arguments);
165
+ return function loadOptions() {
166
+ return _ref2.apply(this, arguments);
156
167
  };
157
168
  }();
158
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) {
@@ -53,7 +55,10 @@ const StatusEditType = props => {
53
55
  }));
54
56
  };
55
57
  const filterOption = (option, inputValue) => option.data.text.toLowerCase().includes(inputValue.toLowerCase());
56
- const useStatusOptions = (currentValue, executeFetch) => {
58
+ const useStatusOptions = ({
59
+ fetchInputs,
60
+ executeFetch
61
+ }) => {
57
62
  const [{
58
63
  options,
59
64
  isLoading,
@@ -65,7 +70,7 @@ const useStatusOptions = (currentValue, executeFetch) => {
65
70
  });
66
71
  useEffect(() => {
67
72
  let isMounted = true;
68
- loadOptions(currentValue, executeFetch).then(options => {
73
+ loadOptions(fetchInputs, executeFetch).then(options => {
69
74
  if (isMounted) {
70
75
  setOptions({
71
76
  isLoading: false,
@@ -83,16 +88,16 @@ const useStatusOptions = (currentValue, executeFetch) => {
83
88
  return () => {
84
89
  isMounted = false;
85
90
  };
86
- }, [currentValue, executeFetch]);
91
+ }, [fetchInputs, executeFetch]);
87
92
  return {
88
93
  options,
89
94
  isLoading,
90
95
  hasFailed
91
96
  };
92
97
  };
93
- const loadOptions = async (currentValue, executeFetch) => {
98
+ const loadOptions = async (fetchInputs = {}, executeFetch) => {
94
99
  if (executeFetch) {
95
- const result = await executeFetch({});
100
+ const result = await executeFetch(fetchInputs);
96
101
  const {
97
102
  operationStatus,
98
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;
@@ -61,7 +63,9 @@ var StatusEditType = function StatusEditType(props) {
61
63
  var filterOption = function filterOption(option, inputValue) {
62
64
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
63
65
  };
64
- var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
66
+ var useStatusOptions = function useStatusOptions(_ref) {
67
+ var fetchInputs = _ref.fetchInputs,
68
+ executeFetch = _ref.executeFetch;
65
69
  var _useState = useState({
66
70
  isLoading: true,
67
71
  options: [],
@@ -75,7 +79,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
75
79
  setOptions = _useState2[1];
76
80
  useEffect(function () {
77
81
  var isMounted = true;
78
- loadOptions(currentValue, executeFetch).then(function (options) {
82
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
79
83
  if (isMounted) {
80
84
  setOptions({
81
85
  isLoading: false,
@@ -93,7 +97,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
93
97
  return function () {
94
98
  isMounted = false;
95
99
  };
96
- }, [currentValue, executeFetch]);
100
+ }, [fetchInputs, executeFetch]);
97
101
  return {
98
102
  options: options,
99
103
  isLoading: isLoading,
@@ -101,28 +105,35 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
101
105
  };
102
106
  };
103
107
  var loadOptions = /*#__PURE__*/function () {
104
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentValue, executeFetch) {
105
- 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;
106
115
  return _regeneratorRuntime.wrap(function _callee$(_context) {
107
116
  while (1) switch (_context.prev = _context.next) {
108
117
  case 0:
118
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
119
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
109
120
  if (!executeFetch) {
110
- _context.next = 9;
121
+ _context.next = 11;
111
122
  break;
112
123
  }
113
- _context.next = 3;
114
- return executeFetch({});
115
- case 3:
124
+ _context.next = 5;
125
+ return executeFetch(fetchInputs);
126
+ case 5:
116
127
  result = _context.sent;
117
128
  operationStatus = result.operationStatus, entities = result.entities;
118
129
  if (!(operationStatus === ActionOperationStatus.FAILURE)) {
119
- _context.next = 7;
130
+ _context.next = 9;
120
131
  break;
121
132
  }
122
133
  throw new Error('Failed to fetch status options');
123
- case 7:
134
+ case 9:
124
135
  if (!entities) {
125
- _context.next = 9;
136
+ _context.next = 11;
126
137
  break;
127
138
  }
128
139
  return _context.abrupt("return", entities.map(function (entity) {
@@ -133,16 +144,16 @@ var loadOptions = /*#__PURE__*/function () {
133
144
  transitionId: entity.transitionId
134
145
  };
135
146
  }));
136
- case 9:
147
+ case 11:
137
148
  return _context.abrupt("return", []);
138
- case 10:
149
+ case 12:
139
150
  case "end":
140
151
  return _context.stop();
141
152
  }
142
153
  }, _callee);
143
154
  }));
144
- return function loadOptions(_x, _x2) {
145
- return _ref.apply(this, arguments);
155
+ return function loadOptions() {
156
+ return _ref2.apply(this, arguments);
146
157
  };
147
158
  }();
148
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.9.0",
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
  }