@atlaskit/link-datasource 3.7.0 → 3.8.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/state/actions/index.js +40 -9
  3. package/dist/cjs/ui/issue-like-table/edit-type/index.js +4 -2
  4. package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +45 -35
  5. package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +3 -1
  6. package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +3 -1
  7. package/dist/es2019/state/actions/index.js +43 -8
  8. package/dist/es2019/ui/issue-like-table/edit-type/index.js +4 -2
  9. package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +40 -31
  10. package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +3 -1
  11. package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +3 -1
  12. package/dist/esm/state/actions/index.js +40 -9
  13. package/dist/esm/ui/issue-like-table/edit-type/index.js +4 -2
  14. package/dist/esm/ui/issue-like-table/edit-type/status/index.js +45 -35
  15. package/dist/esm/ui/issue-like-table/table-cell-content/index.js +3 -1
  16. package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +3 -1
  17. package/dist/types/analytics/generated/analytics.types.d.ts +9 -2
  18. package/dist/types/state/actions/index.d.ts +12 -7
  19. package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
  20. package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  21. package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  22. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +9 -2
  23. package/dist/types-ts4.5/state/actions/index.d.ts +12 -7
  24. package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
  25. package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  26. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  27. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159211](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159211)
8
+ [`9e940f7c89d05`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9e940f7c89d05) -
9
+ Adding analytics for `executeFetch` and updating test delays for loading state
10
+
11
+ ## 3.8.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#159818](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159818)
16
+ [`93569e5cdfe71`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93569e5cdfe71) -
17
+ EDM-10970 updating useAtomicAction to return executeFetch for actions
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 3.7.0
4
24
 
5
25
  ### Minor Changes
@@ -159,15 +159,18 @@ var useDiscoverActions = exports.useDiscoverActions = function useDiscoverAction
159
159
  };
160
160
  };
161
161
  var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref4) {
162
- var _state$permissions$ar, _state$actionsByInteg;
162
+ var _state$permissions$ar, _state$actionsByInteg, _state$actionsByInteg2;
163
163
  var ari = _ref4.ari,
164
164
  fieldKey = _ref4.fieldKey,
165
165
  integrationKey = _ref4.integrationKey;
166
166
  var isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 || (_state$permissions$ar = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar === void 0 ? void 0 : _state$permissions$ar.isEditable;
167
167
  if (!isEditable) {
168
- return;
168
+ return {};
169
169
  }
170
- return (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey];
170
+ return {
171
+ schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
172
+ fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
173
+ };
171
174
  };
172
175
 
173
176
  /**
@@ -198,7 +201,9 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
198
201
  integrationKey: integrationKey
199
202
  }),
200
203
  _useAtomicUpdateActio2 = (0, _slicedToArray2.default)(_useAtomicUpdateActio, 1),
201
- schema = _useAtomicUpdateActio2[0];
204
+ _useAtomicUpdateActio3 = _useAtomicUpdateActio2[0],
205
+ schema = _useAtomicUpdateActio3.schema,
206
+ fetchSchema = _useAtomicUpdateActio3.fetchSchema;
202
207
  var _useDatasourceClientE2 = (0, _linkClientExtension.useDatasourceClientExtension)(),
203
208
  executeAction = _useDatasourceClientE2.executeAtomicAction,
204
209
  invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
@@ -235,10 +240,36 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
235
240
  throw error;
236
241
  });
237
242
  }, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
238
- if (!schema) {
239
- return {};
240
- }
241
- return {
243
+ var executeFetch = (0, _react.useCallback)(function (inputs) {
244
+ if (!fetchSchema) {
245
+ throw new Error('No supporting action schema found.');
246
+ }
247
+
248
+ // A generic type can allow us here to define the inputs and outputs
249
+ return executeAction({
250
+ integrationKey: integrationKey,
251
+ actionKey: fetchSchema.actionKey,
252
+ parameters: {
253
+ inputs: inputs,
254
+ target: {
255
+ ari: ari
256
+ }
257
+ }
258
+ }).then(function (resp) {
259
+ fireEvent('operational.fetchActionExecution.success', {
260
+ integrationKey: integrationKey,
261
+ experience: 'datasource'
262
+ });
263
+ return resp;
264
+ }).catch(function (error) {
265
+ captureError('fetchActionExecution', error);
266
+ // Rethrow up to component for flags and other handling
267
+ throw error;
268
+ });
269
+ }, [fetchSchema, executeAction, integrationKey, ari, fireEvent, captureError]);
270
+ return _objectSpread(_objectSpread({}, schema && {
242
271
  execute: execute
243
- };
272
+ }), fetchSchema && {
273
+ executeFetch: executeFetch
274
+ });
244
275
  };
@@ -19,7 +19,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
19
19
  var editType = exports.editType = function editType(_ref) {
20
20
  var defaultValue = _ref.defaultValue,
21
21
  currentValue = _ref.currentValue,
22
- setEditValues = _ref.setEditValues;
22
+ setEditValues = _ref.setEditValues,
23
+ executeFetch = _ref.executeFetch;
23
24
  switch (defaultValue.type) {
24
25
  case 'string':
25
26
  return {
@@ -41,7 +42,8 @@ var editType = exports.editType = function editType(_ref) {
41
42
  return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
42
43
  currentValue: currentValue,
43
44
  setEditValues: setEditValues,
44
- id: ACTIVE_INLINE_EDIT_ID
45
+ id: ACTIVE_INLINE_EDIT_ID,
46
+ executeFetch: executeFetch
45
47
  }));
46
48
  }
47
49
  };
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14
  var _react = _interopRequireWildcard(require("react"));
15
+ var _linkingTypes = require("@atlaskit/linking-types");
14
16
  var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
15
17
  var _select = _interopRequireDefault(require("@atlaskit/select"));
16
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -19,8 +21,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
21
  // eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
20
22
 
21
23
  var StatusEditType = function StatusEditType(props) {
22
- var _props$currentValue;
23
- var _useStatusOptions = useStatusOptions(),
24
+ var _currentValue$values;
25
+ var currentValue = props.currentValue,
26
+ executeFetch = props.executeFetch;
27
+ var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
24
28
  options = _useStatusOptions.options,
25
29
  isLoading = _useStatusOptions.isLoading;
26
30
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
@@ -35,7 +39,7 @@ var StatusEditType = function StatusEditType(props) {
35
39
  },
36
40
  options: options,
37
41
  isLoading: isLoading,
38
- defaultValue: (_props$currentValue = props.currentValue) === null || _props$currentValue === void 0 || (_props$currentValue = _props$currentValue.values) === null || _props$currentValue === void 0 ? void 0 : _props$currentValue[0],
42
+ defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
39
43
  filterOption: filterOption,
40
44
  formatOptionLabel: function formatOptionLabel(option) {
41
45
  return /*#__PURE__*/_react.default.createElement(_lozenge.default, (0, _extends2.default)({
@@ -53,7 +57,7 @@ var StatusEditType = function StatusEditType(props) {
53
57
  var filterOption = function filterOption(option, inputValue) {
54
58
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
55
59
  };
56
- var useStatusOptions = function useStatusOptions() {
60
+ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
57
61
  var _useState = (0, _react.useState)({
58
62
  isLoading: true,
59
63
  options: []
@@ -64,53 +68,59 @@ var useStatusOptions = function useStatusOptions() {
64
68
  isLoading = _useState2$.isLoading,
65
69
  setOptions = _useState2[1];
66
70
  (0, _react.useEffect)(function () {
67
- loadOptions().then(function (options) {
68
- return setOptions({
69
- isLoading: false,
70
- options: options
71
- });
71
+ var isMounted = true;
72
+ loadOptions(currentValue, executeFetch).then(function (options) {
73
+ if (isMounted) {
74
+ setOptions({
75
+ isLoading: false,
76
+ options: options
77
+ });
78
+ }
72
79
  });
73
- }, []);
80
+ return function () {
81
+ isMounted = false;
82
+ };
83
+ }, [currentValue, executeFetch]);
74
84
  return {
75
85
  options: options,
76
86
  isLoading: isLoading
77
87
  };
78
88
  };
79
89
  var loadOptions = /*#__PURE__*/function () {
80
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
90
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
91
+ var result, operationStatus, entities;
81
92
  return _regenerator.default.wrap(function _callee$(_context) {
82
93
  while (1) switch (_context.prev = _context.next) {
83
94
  case 0:
84
- return _context.abrupt("return", new Promise(function (resolve) {
85
- setTimeout(function () {
86
- return resolve([{
87
- text: 'To Do',
88
- id: '1',
89
- style: {
90
- appearance: 'default'
91
- }
92
- }, {
93
- text: 'In Progress',
94
- id: '1',
95
- style: {
96
- appearance: 'inprogress'
97
- }
98
- }, {
99
- text: 'Done',
100
- id: '2',
101
- style: {
102
- appearance: 'success'
103
- }
104
- }]);
105
- }, 1000);
95
+ if (!executeFetch) {
96
+ _context.next = 7;
97
+ break;
98
+ }
99
+ _context.next = 3;
100
+ return executeFetch((0, _defineProperty2.default)({}, currentValue.type, currentValue.values[0]));
101
+ case 3:
102
+ result = _context.sent;
103
+ operationStatus = result.operationStatus, entities = result.entities;
104
+ if (!(operationStatus === _linkingTypes.ActionOperationStatus.SUCCESS && entities)) {
105
+ _context.next = 7;
106
+ break;
107
+ }
108
+ return _context.abrupt("return", entities.map(function (entity) {
109
+ return {
110
+ id: entity.id,
111
+ text: entity.text,
112
+ style: entity.style
113
+ };
106
114
  }));
107
- case 1:
115
+ case 7:
116
+ return _context.abrupt("return", []);
117
+ case 8:
108
118
  case "end":
109
119
  return _context.stop();
110
120
  }
111
121
  }, _callee);
112
122
  }));
113
- return function loadOptions() {
123
+ return function loadOptions(_x, _x2) {
114
124
  return _ref.apply(this, arguments);
115
125
  };
116
126
  }();
@@ -91,7 +91,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
91
91
  fieldKey: columnKey,
92
92
  integrationKey: integrationKey
93
93
  }),
94
- execute = _useExecuteAtomicActi.execute;
94
+ execute = _useExecuteAtomicActi.execute,
95
+ executeFetch = _useExecuteAtomicActi.executeFetch;
95
96
  var isEditable = !!execute;
96
97
  var readView = /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
97
98
  columnKey: columnKey,
@@ -109,6 +110,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
109
110
  return /*#__PURE__*/_react.default.createElement(_inlineEdit.InlineEdit, {
110
111
  ari: ari,
111
112
  execute: execute,
113
+ executeFetch: executeFetch,
112
114
  readView: readView,
113
115
  columnKey: columnKey,
114
116
  datasourceTypeWithValues: values
@@ -69,6 +69,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
69
69
  var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
70
70
  var ari = _ref.ari,
71
71
  execute = _ref.execute,
72
+ executeFetch = _ref.executeFetch,
72
73
  _readView = _ref.readView,
73
74
  columnKey = _ref.columnKey,
74
75
  datasourceTypeWithValues = _ref.datasourceTypeWithValues;
@@ -140,7 +141,8 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
140
141
  }, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)({
141
142
  defaultValue: datasourceTypeWithValues,
142
143
  currentValue: editValues,
143
- setEditValues: setEditValues
144
+ setEditValues: setEditValues,
145
+ executeFetch: executeFetch
144
146
  }), {
145
147
  hideActionButtons: true,
146
148
  readView: function readView() {
@@ -144,12 +144,15 @@ const getFieldUpdateActionByAri = (state, {
144
144
  fieldKey,
145
145
  integrationKey
146
146
  }) => {
147
- var _state$permissions$ar, _state$permissions$ar2, _state$actionsByInteg;
147
+ var _state$permissions$ar, _state$permissions$ar2, _state$actionsByInteg, _state$actionsByInteg2;
148
148
  const isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 ? void 0 : (_state$permissions$ar2 = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar2 === void 0 ? void 0 : _state$permissions$ar2.isEditable;
149
149
  if (!isEditable) {
150
- return;
150
+ return {};
151
151
  }
152
- return (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey];
152
+ return {
153
+ schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
154
+ fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
155
+ };
153
156
  };
154
157
 
155
158
  /**
@@ -175,7 +178,10 @@ export const useExecuteAtomicAction = ({
175
178
  fieldKey,
176
179
  integrationKey
177
180
  }) => {
178
- const [schema] = useAtomicUpdateActionSchema({
181
+ const [{
182
+ schema,
183
+ fetchSchema
184
+ }] = useAtomicUpdateActionSchema({
179
185
  ari,
180
186
  fieldKey,
181
187
  integrationKey
@@ -221,10 +227,39 @@ export const useExecuteAtomicAction = ({
221
227
  throw error;
222
228
  });
223
229
  }, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
224
- if (!schema) {
225
- return {};
226
- }
230
+ const executeFetch = useCallback(inputs => {
231
+ if (!fetchSchema) {
232
+ throw new Error('No supporting action schema found.');
233
+ }
234
+
235
+ // A generic type can allow us here to define the inputs and outputs
236
+ return executeAction({
237
+ integrationKey,
238
+ actionKey: fetchSchema.actionKey,
239
+ parameters: {
240
+ inputs,
241
+ target: {
242
+ ari
243
+ }
244
+ }
245
+ }).then(resp => {
246
+ fireEvent('operational.fetchActionExecution.success', {
247
+ integrationKey: integrationKey,
248
+ experience: 'datasource'
249
+ });
250
+ return resp;
251
+ }).catch(error => {
252
+ captureError('fetchActionExecution', error);
253
+ // Rethrow up to component for flags and other handling
254
+ throw error;
255
+ });
256
+ }, [fetchSchema, executeAction, integrationKey, ari, fireEvent, captureError]);
227
257
  return {
228
- execute
258
+ ...(schema && {
259
+ execute
260
+ }),
261
+ ...(fetchSchema && {
262
+ executeFetch
263
+ })
229
264
  };
230
265
  };
@@ -9,7 +9,8 @@ const ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
9
9
  export const editType = ({
10
10
  defaultValue,
11
11
  currentValue,
12
- setEditValues
12
+ setEditValues,
13
+ executeFetch
13
14
  }) => {
14
15
  switch (defaultValue.type) {
15
16
  case 'string':
@@ -31,7 +32,8 @@ export const editType = ({
31
32
  }) => /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
32
33
  currentValue: currentValue,
33
34
  setEditValues: setEditValues,
34
- id: ACTIVE_INLINE_EDIT_ID
35
+ id: ACTIVE_INLINE_EDIT_ID,
36
+ executeFetch: executeFetch
35
37
  }))
36
38
  };
37
39
  default:
@@ -1,16 +1,21 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useState } from 'react';
3
+ import { ActionOperationStatus } from '@atlaskit/linking-types';
3
4
  import Lozenge from '@atlaskit/lozenge';
4
5
  // FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
5
6
  // eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
6
7
 
7
8
  import Select from '@atlaskit/select';
8
9
  const StatusEditType = props => {
9
- var _props$currentValue, _props$currentValue$v;
10
+ var _currentValue$values;
11
+ const {
12
+ currentValue,
13
+ executeFetch
14
+ } = props;
10
15
  const {
11
16
  options,
12
17
  isLoading
13
- } = useStatusOptions();
18
+ } = useStatusOptions(currentValue, executeFetch);
14
19
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
15
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
16
21
  className: "single-select",
@@ -21,7 +26,7 @@ const StatusEditType = props => {
21
26
  getOptionValue: option => option.text,
22
27
  options: options,
23
28
  isLoading: isLoading,
24
- defaultValue: (_props$currentValue = props.currentValue) === null || _props$currentValue === void 0 ? void 0 : (_props$currentValue$v = _props$currentValue.values) === null || _props$currentValue$v === void 0 ? void 0 : _props$currentValue$v[0],
29
+ defaultValue: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
25
30
  filterOption: filterOption,
26
31
  formatOptionLabel: option => /*#__PURE__*/React.createElement(Lozenge, _extends({
27
32
  testId: `inline-edit-status-option-${option.text}`
@@ -33,7 +38,7 @@ const StatusEditType = props => {
33
38
  })));
34
39
  };
35
40
  const filterOption = (option, inputValue) => option.data.text.toLowerCase().includes(inputValue.toLowerCase());
36
- const useStatusOptions = () => {
41
+ const useStatusOptions = (currentValue, executeFetch) => {
37
42
  const [{
38
43
  options,
39
44
  isLoading
@@ -42,37 +47,41 @@ const useStatusOptions = () => {
42
47
  options: []
43
48
  });
44
49
  useEffect(() => {
45
- loadOptions().then(options => setOptions({
46
- isLoading: false,
47
- options
48
- }));
49
- }, []);
50
+ let isMounted = true;
51
+ loadOptions(currentValue, executeFetch).then(options => {
52
+ if (isMounted) {
53
+ setOptions({
54
+ isLoading: false,
55
+ options
56
+ });
57
+ }
58
+ });
59
+ return () => {
60
+ isMounted = false;
61
+ };
62
+ }, [currentValue, executeFetch]);
50
63
  return {
51
64
  options,
52
65
  isLoading
53
66
  };
54
67
  };
55
- const loadOptions = async () => {
56
- return new Promise(resolve => {
57
- setTimeout(() => resolve([{
58
- text: 'To Do',
59
- id: '1',
60
- style: {
61
- appearance: 'default'
62
- }
63
- }, {
64
- text: 'In Progress',
65
- id: '1',
66
- style: {
67
- appearance: 'inprogress'
68
- }
69
- }, {
70
- text: 'Done',
71
- id: '2',
72
- style: {
73
- appearance: 'success'
74
- }
75
- }]), 1000);
76
- });
68
+ const loadOptions = async (currentValue, executeFetch) => {
69
+ if (executeFetch) {
70
+ const result = await executeFetch({
71
+ [currentValue.type]: currentValue.values[0]
72
+ });
73
+ const {
74
+ operationStatus,
75
+ entities
76
+ } = result;
77
+ if (operationStatus === ActionOperationStatus.SUCCESS && entities) {
78
+ return entities.map(entity => ({
79
+ id: entity.id,
80
+ text: entity.text,
81
+ style: entity.style
82
+ }));
83
+ }
84
+ }
85
+ return [];
77
86
  };
78
87
  export default StatusEditType;
@@ -79,7 +79,8 @@ const InlineEditableCell = ({
79
79
  }) => {
80
80
  // Execute fn is only returned when the field is editable and the action schema exists
81
81
  const {
82
- execute
82
+ execute,
83
+ executeFetch
83
84
  } = useExecuteAtomicAction({
84
85
  ari,
85
86
  fieldKey: columnKey,
@@ -102,6 +103,7 @@ const InlineEditableCell = ({
102
103
  return /*#__PURE__*/React.createElement(InlineEdit, {
103
104
  ari: ari,
104
105
  execute: execute,
106
+ executeFetch: executeFetch,
105
107
  readView: readView,
106
108
  columnKey: columnKey,
107
109
  datasourceTypeWithValues: values
@@ -60,6 +60,7 @@ const useRefreshDatasourceItem = item => {
60
60
  export const InlineEdit = ({
61
61
  ari,
62
62
  execute,
63
+ executeFetch,
63
64
  readView,
64
65
  columnKey,
65
66
  datasourceTypeWithValues
@@ -130,7 +131,8 @@ export const InlineEdit = ({
130
131
  }, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
131
132
  defaultValue: datasourceTypeWithValues,
132
133
  currentValue: editValues,
133
- setEditValues
134
+ setEditValues,
135
+ executeFetch
134
136
  }), {
135
137
  hideActionButtons: true,
136
138
  readView: () => readView,
@@ -153,15 +153,18 @@ export var useDiscoverActions = function useDiscoverActions(_ref3) {
153
153
  };
154
154
  };
155
155
  var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref4) {
156
- var _state$permissions$ar, _state$actionsByInteg;
156
+ var _state$permissions$ar, _state$actionsByInteg, _state$actionsByInteg2;
157
157
  var ari = _ref4.ari,
158
158
  fieldKey = _ref4.fieldKey,
159
159
  integrationKey = _ref4.integrationKey;
160
160
  var isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 || (_state$permissions$ar = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar === void 0 ? void 0 : _state$permissions$ar.isEditable;
161
161
  if (!isEditable) {
162
- return;
162
+ return {};
163
163
  }
164
- return (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey];
164
+ return {
165
+ schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
166
+ fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
167
+ };
165
168
  };
166
169
 
167
170
  /**
@@ -192,7 +195,9 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
192
195
  integrationKey: integrationKey
193
196
  }),
194
197
  _useAtomicUpdateActio2 = _slicedToArray(_useAtomicUpdateActio, 1),
195
- schema = _useAtomicUpdateActio2[0];
198
+ _useAtomicUpdateActio3 = _useAtomicUpdateActio2[0],
199
+ schema = _useAtomicUpdateActio3.schema,
200
+ fetchSchema = _useAtomicUpdateActio3.fetchSchema;
196
201
  var _useDatasourceClientE2 = useDatasourceClientExtension(),
197
202
  executeAction = _useDatasourceClientE2.executeAtomicAction,
198
203
  invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
@@ -229,10 +234,36 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
229
234
  throw error;
230
235
  });
231
236
  }, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
232
- if (!schema) {
233
- return {};
234
- }
235
- return {
237
+ var executeFetch = useCallback(function (inputs) {
238
+ if (!fetchSchema) {
239
+ throw new Error('No supporting action schema found.');
240
+ }
241
+
242
+ // A generic type can allow us here to define the inputs and outputs
243
+ return executeAction({
244
+ integrationKey: integrationKey,
245
+ actionKey: fetchSchema.actionKey,
246
+ parameters: {
247
+ inputs: inputs,
248
+ target: {
249
+ ari: ari
250
+ }
251
+ }
252
+ }).then(function (resp) {
253
+ fireEvent('operational.fetchActionExecution.success', {
254
+ integrationKey: integrationKey,
255
+ experience: 'datasource'
256
+ });
257
+ return resp;
258
+ }).catch(function (error) {
259
+ captureError('fetchActionExecution', error);
260
+ // Rethrow up to component for flags and other handling
261
+ throw error;
262
+ });
263
+ }, [fetchSchema, executeAction, integrationKey, ari, fireEvent, captureError]);
264
+ return _objectSpread(_objectSpread({}, schema && {
236
265
  execute: execute
237
- };
266
+ }), fetchSchema && {
267
+ executeFetch: executeFetch
268
+ });
238
269
  };
@@ -10,7 +10,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
10
10
  export var editType = function editType(_ref) {
11
11
  var defaultValue = _ref.defaultValue,
12
12
  currentValue = _ref.currentValue,
13
- setEditValues = _ref.setEditValues;
13
+ setEditValues = _ref.setEditValues,
14
+ executeFetch = _ref.executeFetch;
14
15
  switch (defaultValue.type) {
15
16
  case 'string':
16
17
  return {
@@ -32,7 +33,8 @@ export var editType = function editType(_ref) {
32
33
  return /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
33
34
  currentValue: currentValue,
34
35
  setEditValues: setEditValues,
35
- id: ACTIVE_INLINE_EDIT_ID
36
+ id: ACTIVE_INLINE_EDIT_ID,
37
+ executeFetch: executeFetch
36
38
  }));
37
39
  }
38
40
  };
@@ -1,16 +1,20 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import _extends from "@babel/runtime/helpers/extends";
4
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
6
  import React, { useEffect, useState } from 'react';
7
+ import { ActionOperationStatus } from '@atlaskit/linking-types';
6
8
  import Lozenge from '@atlaskit/lozenge';
7
9
  // FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
8
10
  // eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
9
11
 
10
12
  import Select from '@atlaskit/select';
11
13
  var StatusEditType = function StatusEditType(props) {
12
- var _props$currentValue;
13
- var _useStatusOptions = useStatusOptions(),
14
+ var _currentValue$values;
15
+ var currentValue = props.currentValue,
16
+ executeFetch = props.executeFetch;
17
+ var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
14
18
  options = _useStatusOptions.options,
15
19
  isLoading = _useStatusOptions.isLoading;
16
20
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
@@ -25,7 +29,7 @@ var StatusEditType = function StatusEditType(props) {
25
29
  },
26
30
  options: options,
27
31
  isLoading: isLoading,
28
- defaultValue: (_props$currentValue = props.currentValue) === null || _props$currentValue === void 0 || (_props$currentValue = _props$currentValue.values) === null || _props$currentValue === void 0 ? void 0 : _props$currentValue[0],
32
+ defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
29
33
  filterOption: filterOption,
30
34
  formatOptionLabel: function formatOptionLabel(option) {
31
35
  return /*#__PURE__*/React.createElement(Lozenge, _extends({
@@ -43,7 +47,7 @@ var StatusEditType = function StatusEditType(props) {
43
47
  var filterOption = function filterOption(option, inputValue) {
44
48
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
45
49
  };
46
- var useStatusOptions = function useStatusOptions() {
50
+ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
47
51
  var _useState = useState({
48
52
  isLoading: true,
49
53
  options: []
@@ -54,53 +58,59 @@ var useStatusOptions = function useStatusOptions() {
54
58
  isLoading = _useState2$.isLoading,
55
59
  setOptions = _useState2[1];
56
60
  useEffect(function () {
57
- loadOptions().then(function (options) {
58
- return setOptions({
59
- isLoading: false,
60
- options: options
61
- });
61
+ var isMounted = true;
62
+ loadOptions(currentValue, executeFetch).then(function (options) {
63
+ if (isMounted) {
64
+ setOptions({
65
+ isLoading: false,
66
+ options: options
67
+ });
68
+ }
62
69
  });
63
- }, []);
70
+ return function () {
71
+ isMounted = false;
72
+ };
73
+ }, [currentValue, executeFetch]);
64
74
  return {
65
75
  options: options,
66
76
  isLoading: isLoading
67
77
  };
68
78
  };
69
79
  var loadOptions = /*#__PURE__*/function () {
70
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
80
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentValue, executeFetch) {
81
+ var result, operationStatus, entities;
71
82
  return _regeneratorRuntime.wrap(function _callee$(_context) {
72
83
  while (1) switch (_context.prev = _context.next) {
73
84
  case 0:
74
- return _context.abrupt("return", new Promise(function (resolve) {
75
- setTimeout(function () {
76
- return resolve([{
77
- text: 'To Do',
78
- id: '1',
79
- style: {
80
- appearance: 'default'
81
- }
82
- }, {
83
- text: 'In Progress',
84
- id: '1',
85
- style: {
86
- appearance: 'inprogress'
87
- }
88
- }, {
89
- text: 'Done',
90
- id: '2',
91
- style: {
92
- appearance: 'success'
93
- }
94
- }]);
95
- }, 1000);
85
+ if (!executeFetch) {
86
+ _context.next = 7;
87
+ break;
88
+ }
89
+ _context.next = 3;
90
+ return executeFetch(_defineProperty({}, currentValue.type, currentValue.values[0]));
91
+ case 3:
92
+ result = _context.sent;
93
+ operationStatus = result.operationStatus, entities = result.entities;
94
+ if (!(operationStatus === ActionOperationStatus.SUCCESS && entities)) {
95
+ _context.next = 7;
96
+ break;
97
+ }
98
+ return _context.abrupt("return", entities.map(function (entity) {
99
+ return {
100
+ id: entity.id,
101
+ text: entity.text,
102
+ style: entity.style
103
+ };
96
104
  }));
97
- case 1:
105
+ case 7:
106
+ return _context.abrupt("return", []);
107
+ case 8:
98
108
  case "end":
99
109
  return _context.stop();
100
110
  }
101
111
  }, _callee);
102
112
  }));
103
- return function loadOptions() {
113
+ return function loadOptions(_x, _x2) {
104
114
  return _ref.apply(this, arguments);
105
115
  };
106
116
  }();
@@ -84,7 +84,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
84
84
  fieldKey: columnKey,
85
85
  integrationKey: integrationKey
86
86
  }),
87
- execute = _useExecuteAtomicActi.execute;
87
+ execute = _useExecuteAtomicActi.execute,
88
+ executeFetch = _useExecuteAtomicActi.executeFetch;
88
89
  var isEditable = !!execute;
89
90
  var readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
90
91
  columnKey: columnKey,
@@ -102,6 +103,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
102
103
  return /*#__PURE__*/React.createElement(InlineEdit, {
103
104
  ari: ari,
104
105
  execute: execute,
106
+ executeFetch: executeFetch,
105
107
  readView: readView,
106
108
  columnKey: columnKey,
107
109
  datasourceTypeWithValues: values
@@ -59,6 +59,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
59
59
  export var InlineEdit = function InlineEdit(_ref) {
60
60
  var ari = _ref.ari,
61
61
  execute = _ref.execute,
62
+ executeFetch = _ref.executeFetch,
62
63
  _readView = _ref.readView,
63
64
  columnKey = _ref.columnKey,
64
65
  datasourceTypeWithValues = _ref.datasourceTypeWithValues;
@@ -130,7 +131,8 @@ export var InlineEdit = function InlineEdit(_ref) {
130
131
  }, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
131
132
  defaultValue: datasourceTypeWithValues,
132
133
  currentValue: editValues,
133
- setEditValues: setEditValues
134
+ setEditValues: setEditValues,
135
+ executeFetch: executeFetch
134
136
  }), {
135
137
  hideActionButtons: true,
136
138
  readView: function readView() {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::b6f8bb0286018a13a19546bc9fd67e2e>>
6
+ * @codegen <<SignedSource::6b271484f56c37f6170c6468edcab44c>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type ComponentMetaDataType = {
@@ -68,7 +68,7 @@ export type DatasourceRenderSuccessAttributesType = {
68
68
  };
69
69
  export type DatasourceRenderFailureAttributesType = {};
70
70
  export type DatasourceOperationFailedAttributesType = {
71
- errorLocation: 'ProviderOnAuthRequest' | 'loadDatasourceDetails' | 'onNextPage' | 'actionDiscovery' | 'actionExecution' | null;
71
+ errorLocation: 'ProviderOnAuthRequest' | 'loadDatasourceDetails' | 'onNextPage' | 'actionDiscovery' | 'actionExecution' | 'fetchActionExecution' | null;
72
72
  traceId: string | null;
73
73
  status: number | null;
74
74
  reason: 'response' | 'network' | 'internal' | 'unknown' | null;
@@ -146,6 +146,10 @@ export type ActionExecutionSuccessAttributesType = {
146
146
  integrationKey: string;
147
147
  experience: 'datasource';
148
148
  };
149
+ export type FetchActionExecutionSuccessAttributesType = {
150
+ integrationKey: string;
151
+ experience: 'datasource';
152
+ };
149
153
  export type ActionDiscoverySuccessAttributesType = {
150
154
  experience: 'datasource';
151
155
  entityType: string;
@@ -278,6 +282,9 @@ export type AnalyticsEventAttributes = {
278
282
  /**
279
283
  * Fired when an atomic action execution is successful */
280
284
  'operational.actionExecution.success': ActionExecutionSuccessAttributesType;
285
+ /**
286
+ * Fired when a fetch atomic action execution is successful */
287
+ 'operational.fetchActionExecution.success': FetchActionExecutionSuccessAttributesType;
281
288
  /**
282
289
  * Fired when the action discovery and permissions request is successful. */
283
290
  'operational.actionDiscovery.success': ActionDiscoverySuccessAttributesType;
@@ -1,6 +1,6 @@
1
1
  import { type Action } from 'react-sweet-state';
2
2
  import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
3
- import type { ActionsDiscoveryRequest, AtomicActionInterface } from '@atlaskit/linking-types';
3
+ import type { ActionsDiscoveryRequest, AtomicActionExecuteResponse, AtomicActionInterface } from '@atlaskit/linking-types';
4
4
  import { type DatasourceOperationFailedAttributesType, type EventKey } from '../../../src/analytics/generated/analytics.types';
5
5
  import type createEventPayload from '../../../src/analytics/generated/create-event-payload';
6
6
  type IntegrationKey = string;
@@ -81,9 +81,15 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
81
81
  /**
82
82
  * Retrieves the action schema for a given ARI + fieldKey + integrationKey
83
83
  */
84
- export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<(Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
85
- fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
86
- }) | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
84
+ export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<{
85
+ schema?: undefined;
86
+ fetchSchema?: undefined;
87
+ } | {
88
+ schema: Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
89
+ fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
90
+ };
91
+ fetchSchema: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
92
+ }, import("react-sweet-state").BoundActions<ActionsStoreState, {
87
93
  discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
88
94
  }>, {
89
95
  ari: string;
@@ -106,8 +112,7 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
106
112
  fieldKey: string;
107
113
  integrationKey: string;
108
114
  }) => {
109
- execute?: undefined;
110
- } | {
111
- execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse<unknown>>;
115
+ execute?: ((value: (string | number)) => Promise<AtomicActionExecuteResponse<unknown>>) | undefined;
116
+ executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
112
117
  };
113
118
  export {};
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import type InlineEdit from '@atlaskit/inline-edit';
3
3
  import type { DatasourceType } from '@atlaskit/linking-types';
4
4
  import { type DatasourceTypeWithOnlyValues } from '../types';
5
- export declare const editType: ({ defaultValue, currentValue, setEditValues, }: {
5
+ export declare const editType: ({ defaultValue, currentValue, setEditValues, executeFetch }: {
6
6
  defaultValue: DatasourceTypeWithOnlyValues;
7
7
  currentValue: DatasourceTypeWithOnlyValues;
8
8
  setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
9
+ executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
9
10
  }) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
10
11
  export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
@@ -4,6 +4,7 @@ import type { DatasourceTypeWithOnlyValues } from '../../types';
4
4
  interface Props extends Omit<FieldProps<string>, 'value'> {
5
5
  currentValue: DatasourceTypeWithOnlyValues;
6
6
  setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
7
+ executeFetch?: <E>(inputs: any) => Promise<E>;
7
8
  }
8
9
  declare const StatusEditType: (props: Props) => JSX.Element;
9
10
  export default StatusEditType;
@@ -7,6 +7,7 @@ interface InlineEditProps {
7
7
  readView: React.ReactNode;
8
8
  datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
9
9
  execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
10
+ executeFetch?: <E>(inputs: any) => Promise<E>;
10
11
  }
11
- export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
12
+ export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
12
13
  export {};
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::b6f8bb0286018a13a19546bc9fd67e2e>>
6
+ * @codegen <<SignedSource::6b271484f56c37f6170c6468edcab44c>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type ComponentMetaDataType = {
@@ -68,7 +68,7 @@ export type DatasourceRenderSuccessAttributesType = {
68
68
  };
69
69
  export type DatasourceRenderFailureAttributesType = {};
70
70
  export type DatasourceOperationFailedAttributesType = {
71
- errorLocation: 'ProviderOnAuthRequest' | 'loadDatasourceDetails' | 'onNextPage' | 'actionDiscovery' | 'actionExecution' | null;
71
+ errorLocation: 'ProviderOnAuthRequest' | 'loadDatasourceDetails' | 'onNextPage' | 'actionDiscovery' | 'actionExecution' | 'fetchActionExecution' | null;
72
72
  traceId: string | null;
73
73
  status: number | null;
74
74
  reason: 'response' | 'network' | 'internal' | 'unknown' | null;
@@ -146,6 +146,10 @@ export type ActionExecutionSuccessAttributesType = {
146
146
  integrationKey: string;
147
147
  experience: 'datasource';
148
148
  };
149
+ export type FetchActionExecutionSuccessAttributesType = {
150
+ integrationKey: string;
151
+ experience: 'datasource';
152
+ };
149
153
  export type ActionDiscoverySuccessAttributesType = {
150
154
  experience: 'datasource';
151
155
  entityType: string;
@@ -278,6 +282,9 @@ export type AnalyticsEventAttributes = {
278
282
  /**
279
283
  * Fired when an atomic action execution is successful */
280
284
  'operational.actionExecution.success': ActionExecutionSuccessAttributesType;
285
+ /**
286
+ * Fired when a fetch atomic action execution is successful */
287
+ 'operational.fetchActionExecution.success': FetchActionExecutionSuccessAttributesType;
281
288
  /**
282
289
  * Fired when the action discovery and permissions request is successful. */
283
290
  'operational.actionDiscovery.success': ActionDiscoverySuccessAttributesType;
@@ -1,6 +1,6 @@
1
1
  import { type Action } from 'react-sweet-state';
2
2
  import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
3
- import type { ActionsDiscoveryRequest, AtomicActionInterface } from '@atlaskit/linking-types';
3
+ import type { ActionsDiscoveryRequest, AtomicActionExecuteResponse, AtomicActionInterface } from '@atlaskit/linking-types';
4
4
  import { type DatasourceOperationFailedAttributesType, type EventKey } from '../../../src/analytics/generated/analytics.types';
5
5
  import type createEventPayload from '../../../src/analytics/generated/create-event-payload';
6
6
  type IntegrationKey = string;
@@ -81,9 +81,15 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
81
81
  /**
82
82
  * Retrieves the action schema for a given ARI + fieldKey + integrationKey
83
83
  */
84
- export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<(Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
85
- fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
86
- }) | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
84
+ export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<{
85
+ schema?: undefined;
86
+ fetchSchema?: undefined;
87
+ } | {
88
+ schema: Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
89
+ fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
90
+ };
91
+ fetchSchema: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
92
+ }, import("react-sweet-state").BoundActions<ActionsStoreState, {
87
93
  discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
88
94
  }>, {
89
95
  ari: string;
@@ -106,8 +112,7 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
106
112
  fieldKey: string;
107
113
  integrationKey: string;
108
114
  }) => {
109
- execute?: undefined;
110
- } | {
111
- execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse<unknown>>;
115
+ execute?: ((value: (string | number)) => Promise<AtomicActionExecuteResponse<unknown>>) | undefined;
116
+ executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
112
117
  };
113
118
  export {};
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import type InlineEdit from '@atlaskit/inline-edit';
3
3
  import type { DatasourceType } from '@atlaskit/linking-types';
4
4
  import { type DatasourceTypeWithOnlyValues } from '../types';
5
- export declare const editType: ({ defaultValue, currentValue, setEditValues, }: {
5
+ export declare const editType: ({ defaultValue, currentValue, setEditValues, executeFetch }: {
6
6
  defaultValue: DatasourceTypeWithOnlyValues;
7
7
  currentValue: DatasourceTypeWithOnlyValues;
8
8
  setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
9
+ executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
9
10
  }) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
10
11
  export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
@@ -4,6 +4,7 @@ import type { DatasourceTypeWithOnlyValues } from '../../types';
4
4
  interface Props extends Omit<FieldProps<string>, 'value'> {
5
5
  currentValue: DatasourceTypeWithOnlyValues;
6
6
  setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
7
+ executeFetch?: <E>(inputs: any) => Promise<E>;
7
8
  }
8
9
  declare const StatusEditType: (props: Props) => JSX.Element;
9
10
  export default StatusEditType;
@@ -7,6 +7,7 @@ interface InlineEditProps {
7
7
  readView: React.ReactNode;
8
8
  datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
9
9
  execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
10
+ executeFetch?: <E>(inputs: any) => Promise<E>;
10
11
  }
11
- export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
12
+ export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
12
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.7.0",
3
+ "version": "3.8.1",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -72,13 +72,13 @@
72
72
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
73
73
  "@atlaskit/primitives": "^13.0.0",
74
74
  "@atlaskit/select": "^18.4.0",
75
- "@atlaskit/smart-card": "^30.1.0",
75
+ "@atlaskit/smart-card": "^30.2.0",
76
76
  "@atlaskit/smart-user-picker": "6.11.1",
77
77
  "@atlaskit/spinner": "^16.3.0",
78
78
  "@atlaskit/tag": "^12.6.0",
79
79
  "@atlaskit/textfield": "6.5.4",
80
80
  "@atlaskit/theme": "^14.0.0",
81
- "@atlaskit/tokens": "^2.0.0",
81
+ "@atlaskit/tokens": "^2.1.0",
82
82
  "@atlaskit/tooltip": "^18.8.0",
83
83
  "@atlaskit/ufo": "^0.3.0",
84
84
  "@atlaskit/width-detector": "^4.3.0",