@atlaskit/link-datasource 2.3.5 → 2.3.7

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 (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE.md +6 -8
  3. package/dist/cjs/hooks/useDatasourceTableState.js +3 -3
  4. package/dist/cjs/hooks/useValidateAqlText.js +3 -3
  5. package/dist/cjs/ui/assets-modal/modal/index.js +21 -9
  6. package/dist/cjs/ui/common/modal/popup-select/index.js +4 -4
  7. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +3 -3
  8. package/dist/cjs/ui/issue-like-table/index.js +1 -1
  9. package/dist/cjs/ui/issue-like-table/render-type/date-time/index.js +4 -4
  10. package/dist/cjs/ui/issue-like-table/styled.js +7 -7
  11. package/dist/es2019/hooks/useDatasourceTableState.js +3 -3
  12. package/dist/es2019/hooks/useValidateAqlText.js +3 -3
  13. package/dist/es2019/ui/assets-modal/modal/index.js +21 -7
  14. package/dist/es2019/ui/common/modal/popup-select/index.js +4 -4
  15. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +3 -3
  16. package/dist/es2019/ui/issue-like-table/index.js +1 -1
  17. package/dist/es2019/ui/issue-like-table/render-type/date-time/index.js +4 -4
  18. package/dist/es2019/ui/issue-like-table/styled.js +7 -7
  19. package/dist/esm/hooks/useDatasourceTableState.js +3 -3
  20. package/dist/esm/hooks/useValidateAqlText.js +3 -3
  21. package/dist/esm/ui/assets-modal/modal/index.js +21 -9
  22. package/dist/esm/ui/common/modal/popup-select/index.js +4 -4
  23. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +3 -3
  24. package/dist/esm/ui/issue-like-table/index.js +1 -1
  25. package/dist/esm/ui/issue-like-table/render-type/date-time/index.js +4 -4
  26. package/dist/esm/ui/issue-like-table/styled.js +7 -7
  27. package/dist/types/contexts/datasource-experience-id/index.d.ts +1 -1
  28. package/dist/types/contexts/user-interactions/index.d.ts +1 -1
  29. package/dist/types/index.d.ts +1 -1
  30. package/dist/types/services/useBasicFilterAGG.d.ts +1 -1
  31. package/dist/types/ui/assets-modal/search-container/loading-state.d.ts +1 -1
  32. package/dist/types/ui/assets-modal/types.d.ts +1 -0
  33. package/dist/types/ui/common/error-state/no-instances.d.ts +1 -1
  34. package/dist/types/ui/common/modal/cancel-button/index.d.ts +1 -1
  35. package/dist/types/ui/common/modal/content-container/index.d.ts +1 -1
  36. package/dist/types/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +1 -1
  37. package/dist/types/ui/common/modal/popup-select/footer.d.ts +1 -1
  38. package/dist/types/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +1 -1
  39. package/dist/types/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +1 -1
  40. package/dist/types/ui/common/modal/popup-select/menu-list/selectMessage.d.ts +1 -1
  41. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +1 -1
  42. package/dist/types/ui/issue-like-table/render-type/boolean/index.d.ts +1 -1
  43. package/dist/types/ui/issue-like-table/render-type/icon/index.d.ts +1 -1
  44. package/dist/types/ui/issue-like-table/render-type/link/index.d.ts +1 -1
  45. package/dist/types/ui/issue-like-table/render-type/number/index.d.ts +1 -1
  46. package/dist/types/ui/issue-like-table/render-type/status/index.d.ts +1 -1
  47. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -1
  48. package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -2
  49. package/dist/types-ts4.5/contexts/datasource-experience-id/index.d.ts +1 -1
  50. package/dist/types-ts4.5/contexts/user-interactions/index.d.ts +1 -1
  51. package/dist/types-ts4.5/index.d.ts +1 -1
  52. package/dist/types-ts4.5/services/useBasicFilterAGG.d.ts +1 -1
  53. package/dist/types-ts4.5/ui/assets-modal/search-container/loading-state.d.ts +1 -1
  54. package/dist/types-ts4.5/ui/assets-modal/types.d.ts +1 -0
  55. package/dist/types-ts4.5/ui/common/error-state/no-instances.d.ts +1 -1
  56. package/dist/types-ts4.5/ui/common/modal/cancel-button/index.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/common/modal/content-container/index.d.ts +1 -1
  58. package/dist/types-ts4.5/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +1 -1
  59. package/dist/types-ts4.5/ui/common/modal/popup-select/footer.d.ts +1 -1
  60. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +1 -1
  61. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +1 -1
  62. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/selectMessage.d.ts +1 -1
  63. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +1 -1
  64. package/dist/types-ts4.5/ui/issue-like-table/render-type/boolean/index.d.ts +1 -1
  65. package/dist/types-ts4.5/ui/issue-like-table/render-type/icon/index.d.ts +1 -1
  66. package/dist/types-ts4.5/ui/issue-like-table/render-type/link/index.d.ts +1 -1
  67. package/dist/types-ts4.5/ui/issue-like-table/render-type/number/index.d.ts +1 -1
  68. package/dist/types-ts4.5/ui/issue-like-table/render-type/status/index.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -1
  70. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -2
  71. package/examples-helpers/buildAssetsIssuesTable.tsx +44 -44
  72. package/examples-helpers/buildConfluenceSearchTable.tsx +49 -51
  73. package/examples-helpers/buildIssueLikeTable.tsx +82 -92
  74. package/examples-helpers/buildJiraIssuesTable.tsx +50 -50
  75. package/examples-helpers/hoverableContainer.tsx +12 -14
  76. package/examples-helpers/mockJqlSmartLinkData.ts +64 -66
  77. package/examples-helpers/mockSmartLinkData.ts +154 -154
  78. package/examples-helpers/smartLinkCustomClient.ts +32 -32
  79. package/examples-helpers/useAssetsTableProps.tsx +46 -46
  80. package/examples-helpers/useCommonTableProps.tsx +23 -25
  81. package/package.json +17 -12
  82. package/report.api.md +94 -106
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 2.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#108865](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108865)
8
+ [`db1d41998242d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/db1d41998242d) -
9
+ [ux] Rename mock data priority column to "Priority" and change default with for it from 40 to 64px
10
+ to allow for whole word without line break
11
+
12
+ ## 2.3.6
13
+
14
+ ### Patch Changes
15
+
16
+ - [#107913](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107913)
17
+ [`d3405be767646`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d3405be767646) -
18
+ Introduce version param to the Assets Config Modal
19
+ - Updated dependencies
20
+
3
21
  ## 2.3.5
4
22
 
5
23
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,13 +1,11 @@
1
1
  Copyright 2024 Atlassian Pty Ltd
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
4
+ compliance with the License. You may obtain a copy of the License at
6
5
 
7
6
  http://www.apache.org/licenses/LICENSE-2.0
8
7
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ implied. See the License for the specific language governing permissions and limitations under the
11
+ License.
@@ -170,9 +170,9 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
170
170
  }
171
171
 
172
172
  /*Jira adds identifier fields like id and key to all data responses
173
- Since defaultProperties already send back the keyField, we are accounting only
174
- for the idField when we are using defaultProperties
175
- */
173
+ Since defaultProperties already send back the keyField, we are accounting only
174
+ for the idField when we are using defaultProperties
175
+ */
176
176
  if (properties.length > fieldKeys.length + idFieldCount + keyFieldCount && properties.length > defaultProperties.length + idFieldCount) {
177
177
  setFullSchema(schema);
178
178
  }
@@ -88,9 +88,9 @@ var useValidateAqlText = exports.useValidateAqlText = function useValidateAqlTex
88
88
  }(), [workspaceId, fireEvent]);
89
89
 
90
90
  /* Debounce async validation for input, validation is also called on every field change
91
- in a form so we need to also memoize. The async validate function is expected to either:
92
- Immediately return a promise (which is then collected into an array, every single time validation is run),
93
- or immediately return either undefined or an error message */
91
+ in a form so we need to also memoize. The async validate function is expected to either:
92
+ Immediately return a promise (which is then collected into an array, every single time validation is run),
93
+ or immediately return either undefined or an error message */
94
94
  var debouncedValidation = function debouncedValidation(value) {
95
95
  return new Promise(function (resolve) {
96
96
  if (timeout.current) {
@@ -15,6 +15,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
15
15
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
16
16
  var _intlMessagesProvider = require("@atlaskit/intl-messages-provider");
17
17
  var _modalDialog = require("@atlaskit/modal-dialog");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _analytics = require("../../../analytics");
19
20
  var _constants = require("../../../analytics/constants");
20
21
  var _types = require("../../../analytics/types");
@@ -39,6 +40,7 @@ var _messages = require("./messages");
39
40
  var _renderAssetsContent = require("./render-assets-content");
40
41
  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; }
41
42
  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; } /** @jsx jsx */
43
+ var VERSION_TWO = '2';
42
44
  var modalBodyErrorWrapperStyles = (0, _react2.css)({
43
45
  alignItems: 'center',
44
46
  display: 'grid',
@@ -60,7 +62,8 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
60
62
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
61
63
  schemaId = _useState4[0],
62
64
  setSchemaId = _useState4[1];
63
- var _useState5 = (0, _react.useState)(initialVisibleColumnKeys),
65
+ var apiVersion = initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.version;
66
+ var _useState5 = (0, _react.useState)((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_add_version_parameter') && apiVersion !== VERSION_TWO ? [] : initialVisibleColumnKeys),
64
67
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
65
68
  visibleColumnKeys = _useState6[0],
66
69
  setVisibleColumnKeys = _useState6[1];
@@ -115,11 +118,13 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
115
118
  /* ------------------------------ END PERMISSIONS ------------------------------ */
116
119
 
117
120
  var parameters = (0, _react.useMemo)(function () {
118
- return {
121
+ return _objectSpread({
119
122
  aql: aql || '',
120
123
  schemaId: schemaId || '',
121
124
  workspaceId: workspaceId || ''
122
- };
125
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_add_version_parameter') ? {
126
+ version: VERSION_TWO
127
+ } : {});
123
128
  }, [aql, schemaId, workspaceId]);
124
129
  var isParametersSet = !!(aql && workspaceId && schemaId);
125
130
  var _useDatasourceTableSt = (0, _useDatasourceTableState.useDatasourceTableState)({
@@ -201,9 +206,14 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
201
206
  setIsNewSearch(false);
202
207
  }, []);
203
208
  (0, _react.useEffect)(function () {
204
- var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
205
- setVisibleColumnKeys(newVisibleColumnKeys);
206
- }, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
209
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_add_version_parameter')) {
210
+ var newVisibleColumnKeys = initialVisibleColumnKeys && initialVisibleColumnKeys.length > 0 && apiVersion === VERSION_TWO ? initialVisibleColumnKeys : defaultVisibleColumnKeys;
211
+ setVisibleColumnKeys(newVisibleColumnKeys);
212
+ } else {
213
+ var _newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
214
+ setVisibleColumnKeys(_newVisibleColumnKeys);
215
+ }
216
+ }, [initialVisibleColumnKeys, defaultVisibleColumnKeys, apiVersion]);
207
217
  (0, _react.useEffect)(function () {
208
218
  if (isNewSearch) {
209
219
  setVisibleColumnKeys(defaultVisibleColumnKeys);
@@ -251,11 +261,13 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
251
261
  } else {
252
262
  onInsert((0, _adf.buildDatasourceAdf)({
253
263
  id: datasourceId,
254
- parameters: {
264
+ parameters: _objectSpread({
255
265
  workspaceId: workspaceId,
256
266
  aql: aql,
257
267
  schemaId: schemaId
258
- },
268
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_add_version_parameter') ? {
269
+ version: VERSION_TWO
270
+ } : {}),
259
271
  views: [{
260
272
  type: 'table',
261
273
  properties: {
@@ -268,7 +280,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
268
280
  }]
269
281
  }), consumerEvent);
270
282
  }
271
- }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys, userInteractions]);
283
+ }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, userInteractions, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys]);
272
284
  var handleOnSearch = (0, _react.useCallback)(function (searchAql, searchSchemaId) {
273
285
  if (schemaId !== searchSchemaId || aql !== searchAql || status === 'rejected') {
274
286
  searchCount.current++;
@@ -174,10 +174,10 @@ var FilterPopupSelect = exports.FilterPopupSelect = function FilterPopupSelect(_
174
174
  testId: "".concat(filterName, "-popup-select"),
175
175
  inputId: "".concat(filterName, "-popup-select--input")
176
176
  /*
177
- this threshold controls the display of the search control (input field for search)
178
- if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
179
- if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
180
- */,
177
+ this threshold controls the display of the search control (input field for search)
178
+ if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
179
+ if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
180
+ */,
181
181
  searchThreshold: -1,
182
182
  inputValue: searchTerm,
183
183
  closeMenuOnSelect: false,
@@ -66,9 +66,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
66
66
  var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
67
67
 
68
68
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
69
- But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
70
- mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
71
- */
69
+ But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
70
+ mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
71
+ */
72
72
  var isInitialRender = (0, _react.useRef)(true);
73
73
  var hasColumns = !!columns.length;
74
74
  var isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
@@ -246,7 +246,7 @@ var getOrderedColumns = exports.getOrderedColumns = function getOrderedColumns(c
246
246
  };
247
247
  var DEFAULT_WIDTH = _utils.COLUMN_BASE_WIDTH * 22;
248
248
  var keyBasedWidthMap = {
249
- priority: _utils.COLUMN_BASE_WIDTH * 5,
249
+ priority: _utils.COLUMN_BASE_WIDTH * 8,
250
250
  status: _utils.COLUMN_BASE_WIDTH * 18,
251
251
  summary: _utils.COLUMN_BASE_WIDTH * 45,
252
252
  description: _utils.COLUMN_BASE_WIDTH * 31,
@@ -33,10 +33,10 @@ function getFormattedDate(value) {
33
33
  var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datetime';
34
34
  var formatDate = arguments.length > 2 ? arguments[2] : undefined;
35
35
  /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
36
- to be one day off in some timezones. We want it to display the date without converting timezones and a solution
37
- is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
38
- See https://stackoverflow.com/a/31732581
39
- */
36
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
37
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
38
+ See https://stackoverflow.com/a/31732581
39
+ */
40
40
  var dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
41
41
  var date = new Date(dateValue);
42
42
  if (!value || isNaN(date.getTime())) {
@@ -44,12 +44,12 @@ var TableHeading = exports.TableHeading = _styled.default.th((_styled$th = {}, (
44
44
  borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
45
45
  borderBottom: "2px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
46
46
  /*
47
- lineHeight * 2 -> Max height of two lined header
48
- verticalPadding * 2 -> padding for this component itself
49
- verticalPadding * 2 -> padding inside span (--container)
50
- 2px -> Bottom border
51
- Last two terms are needed because of border-box box sizing.
52
- */
47
+ lineHeight * 2 -> Max height of two lined header
48
+ verticalPadding * 2 -> padding for this component itself
49
+ verticalPadding * 2 -> padding inside span (--container)
50
+ 2px -> Bottom border
51
+ Last two terms are needed because of border-box box sizing.
52
+ */
53
53
  height: "calc(".concat(lineHeight, " * 2 + ").concat(verticalPadding, " * 4 + 2px)"),
54
54
  verticalAlign: 'bottom',
55
55
  backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
@@ -62,7 +62,7 @@ var TableHeading = exports.TableHeading = _styled.default.th((_styled$th = {}, (
62
62
  }), (0, _defineProperty2.default)(_styled$th, "& [data-testid='datasource-header-content--container']", {
63
63
  width: '100%',
64
64
  /* With Button now being a parent for this component it adds its lineHeight value and spoils
65
- `height` calculation above. */
65
+ `height` calculation above. */
66
66
  lineHeight: lineHeight,
67
67
  padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
68
68
  display: '-webkit-box',
@@ -92,9 +92,9 @@ export const useDatasourceTableState = ({
92
92
  }
93
93
 
94
94
  /*Jira adds identifier fields like id and key to all data responses
95
- Since defaultProperties already send back the keyField, we are accounting only
96
- for the idField when we are using defaultProperties
97
- */
95
+ Since defaultProperties already send back the keyField, we are accounting only
96
+ for the idField when we are using defaultProperties
97
+ */
98
98
  if (properties.length > fieldKeys.length + idFieldCount + keyFieldCount && properties.length > defaultProperties.length + idFieldCount) {
99
99
  setFullSchema(schema);
100
100
  }
@@ -51,9 +51,9 @@ export const useValidateAqlText = (workspaceId, initialValue) => {
51
51
  }, [workspaceId, fireEvent]);
52
52
 
53
53
  /* Debounce async validation for input, validation is also called on every field change
54
- in a form so we need to also memoize. The async validate function is expected to either:
55
- Immediately return a promise (which is then collected into an array, every single time validation is run),
56
- or immediately return either undefined or an error message */
54
+ in a form so we need to also memoize. The async validate function is expected to either:
55
+ Immediately return a promise (which is then collected into an array, every single time validation is run),
56
+ or immediately return either undefined or an error message */
57
57
  const debouncedValidation = value => new Promise(resolve => {
58
58
  if (timeout.current) {
59
59
  timeout.current();
@@ -7,6 +7,7 @@ import { withAnalyticsContext } from '@atlaskit/analytics-next';
7
7
  import Button from '@atlaskit/button/standard-button';
8
8
  import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
9
9
  import { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
10
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
11
  import { EVENT_CHANNEL, useDatasourceAnalyticsEvents } from '../../../analytics';
11
12
  import { componentMetadata } from '../../../analytics/constants';
12
13
  import { DatasourceAction, DatasourceDisplay, DatasourceSearchMethod } from '../../../analytics/types';
@@ -29,6 +30,7 @@ import { AssetsSearchContainer } from '../search-container';
29
30
  import { AssetsSearchContainerLoading } from '../search-container/loading-state';
30
31
  import { modalMessages } from './messages';
31
32
  import { MODAL_HEIGHT, RenderAssetsContent } from './render-assets-content';
33
+ const VERSION_TWO = '2';
32
34
  const modalBodyErrorWrapperStyles = css({
33
35
  alignItems: 'center',
34
36
  display: 'grid',
@@ -46,7 +48,8 @@ const PlainAssetsConfigModal = props => {
46
48
  } = props;
47
49
  const [aql, setAql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.aql);
48
50
  const [schemaId, setSchemaId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.schemaId);
49
- const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
51
+ const apiVersion = initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.version;
52
+ const [visibleColumnKeys, setVisibleColumnKeys] = useState(getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') && apiVersion !== VERSION_TWO ? [] : initialVisibleColumnKeys);
50
53
  const [isNewSearch, setIsNewSearch] = useState(false);
51
54
  const [errorState, setErrorState] = useState();
52
55
  const {
@@ -96,7 +99,10 @@ const PlainAssetsConfigModal = props => {
96
99
  const parameters = useMemo(() => ({
97
100
  aql: aql || '',
98
101
  schemaId: schemaId || '',
99
- workspaceId: workspaceId || ''
102
+ workspaceId: workspaceId || '',
103
+ ...(getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') ? {
104
+ version: VERSION_TWO
105
+ } : {})
100
106
  }), [aql, schemaId, workspaceId]);
101
107
  const isParametersSet = !!(aql && workspaceId && schemaId);
102
108
  const {
@@ -179,9 +185,14 @@ const PlainAssetsConfigModal = props => {
179
185
  setIsNewSearch(false);
180
186
  }, []);
181
187
  useEffect(() => {
182
- const newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
183
- setVisibleColumnKeys(newVisibleColumnKeys);
184
- }, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
188
+ if (getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter')) {
189
+ const newVisibleColumnKeys = initialVisibleColumnKeys && initialVisibleColumnKeys.length > 0 && apiVersion === VERSION_TWO ? initialVisibleColumnKeys : defaultVisibleColumnKeys;
190
+ setVisibleColumnKeys(newVisibleColumnKeys);
191
+ } else {
192
+ const newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
193
+ setVisibleColumnKeys(newVisibleColumnKeys);
194
+ }
195
+ }, [initialVisibleColumnKeys, defaultVisibleColumnKeys, apiVersion]);
185
196
  useEffect(() => {
186
197
  if (isNewSearch) {
187
198
  setVisibleColumnKeys(defaultVisibleColumnKeys);
@@ -232,7 +243,10 @@ const PlainAssetsConfigModal = props => {
232
243
  parameters: {
233
244
  workspaceId,
234
245
  aql,
235
- schemaId
246
+ schemaId,
247
+ ...(getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') ? {
248
+ version: VERSION_TWO
249
+ } : {})
236
250
  },
237
251
  views: [{
238
252
  type: 'table',
@@ -244,7 +258,7 @@ const PlainAssetsConfigModal = props => {
244
258
  }]
245
259
  }), consumerEvent);
246
260
  }
247
- }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys, userInteractions]);
261
+ }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, userInteractions, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys]);
248
262
  const handleOnSearch = useCallback((searchAql, searchSchemaId) => {
249
263
  if (schemaId !== searchSchemaId || aql !== searchAql || status === 'rejected') {
250
264
  searchCount.current++;
@@ -127,10 +127,10 @@ export const FilterPopupSelect = ({
127
127
  testId: `${filterName}-popup-select`,
128
128
  inputId: `${filterName}-popup-select--input`
129
129
  /*
130
- this threshold controls the display of the search control (input field for search)
131
- if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
132
- if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
133
- */,
130
+ this threshold controls the display of the search control (input field for search)
131
+ if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
132
+ if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
133
+ */,
134
134
  searchThreshold: -1,
135
135
  inputValue: searchTerm,
136
136
  closeMenuOnSelect: false,
@@ -60,9 +60,9 @@ const DatasourceTableViewWithoutAnalytics = ({
60
60
  const visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
61
61
 
62
62
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
63
- But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
64
- mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
65
- */
63
+ But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
64
+ mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
65
+ */
66
66
  const isInitialRender = useRef(true);
67
67
  const hasColumns = !!columns.length;
68
68
  const isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
@@ -274,7 +274,7 @@ export const getOrderedColumns = (columns, visibleColumnKeys) => {
274
274
  };
275
275
  const DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
276
276
  const keyBasedWidthMap = {
277
- priority: COLUMN_BASE_WIDTH * 5,
277
+ priority: COLUMN_BASE_WIDTH * 8,
278
278
  status: COLUMN_BASE_WIDTH * 18,
279
279
  summary: COLUMN_BASE_WIDTH * 45,
280
280
  description: COLUMN_BASE_WIDTH * 31,
@@ -20,10 +20,10 @@ const DateTimeWrapper = styled.span({
20
20
  });
21
21
  export function getFormattedDate(value, display = 'datetime', formatDate) {
22
22
  /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
23
- to be one day off in some timezones. We want it to display the date without converting timezones and a solution
24
- is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
25
- See https://stackoverflow.com/a/31732581
26
- */
23
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
24
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
25
+ See https://stackoverflow.com/a/31732581
26
+ */
27
27
  const dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
28
28
  const date = new Date(dateValue);
29
29
  if (!value || isNaN(date.getTime())) {
@@ -37,12 +37,12 @@ export const TableHeading = styled.th({
37
37
  borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
38
38
  borderBottom: `2px solid ${`var(--ds-border, ${N40})`}`,
39
39
  /*
40
- lineHeight * 2 -> Max height of two lined header
41
- verticalPadding * 2 -> padding for this component itself
42
- verticalPadding * 2 -> padding inside span (--container)
43
- 2px -> Bottom border
44
- Last two terms are needed because of border-box box sizing.
45
- */
40
+ lineHeight * 2 -> Max height of two lined header
41
+ verticalPadding * 2 -> padding for this component itself
42
+ verticalPadding * 2 -> padding inside span (--container)
43
+ 2px -> Bottom border
44
+ Last two terms are needed because of border-box box sizing.
45
+ */
46
46
  height: `calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px)`,
47
47
  verticalAlign: 'bottom',
48
48
  backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
@@ -59,7 +59,7 @@ export const TableHeading = styled.th({
59
59
  "& [data-testid='datasource-header-content--container']": {
60
60
  width: '100%',
61
61
  /* With Button now being a parent for this component it adds its lineHeight value and spoils
62
- `height` calculation above. */
62
+ `height` calculation above. */
63
63
  lineHeight: lineHeight,
64
64
  padding: `${verticalPadding} ${"var(--ds-space-050, 4px)"}`,
65
65
  display: '-webkit-box',
@@ -163,9 +163,9 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
163
163
  }
164
164
 
165
165
  /*Jira adds identifier fields like id and key to all data responses
166
- Since defaultProperties already send back the keyField, we are accounting only
167
- for the idField when we are using defaultProperties
168
- */
166
+ Since defaultProperties already send back the keyField, we are accounting only
167
+ for the idField when we are using defaultProperties
168
+ */
169
169
  if (properties.length > fieldKeys.length + idFieldCount + keyFieldCount && properties.length > defaultProperties.length + idFieldCount) {
170
170
  setFullSchema(schema);
171
171
  }
@@ -81,9 +81,9 @@ export var useValidateAqlText = function useValidateAqlText(workspaceId, initial
81
81
  }(), [workspaceId, fireEvent]);
82
82
 
83
83
  /* Debounce async validation for input, validation is also called on every field change
84
- in a form so we need to also memoize. The async validate function is expected to either:
85
- Immediately return a promise (which is then collected into an array, every single time validation is run),
86
- or immediately return either undefined or an error message */
84
+ in a form so we need to also memoize. The async validate function is expected to either:
85
+ Immediately return a promise (which is then collected into an array, every single time validation is run),
86
+ or immediately return either undefined or an error message */
87
87
  var debouncedValidation = function debouncedValidation(value) {
88
88
  return new Promise(function (resolve) {
89
89
  if (timeout.current) {
@@ -11,6 +11,7 @@ import { withAnalyticsContext } from '@atlaskit/analytics-next';
11
11
  import Button from '@atlaskit/button/standard-button';
12
12
  import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
13
13
  import { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
14
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
15
  import { EVENT_CHANNEL, useDatasourceAnalyticsEvents } from '../../../analytics';
15
16
  import { componentMetadata } from '../../../analytics/constants';
16
17
  import { DatasourceAction, DatasourceDisplay, DatasourceSearchMethod } from '../../../analytics/types';
@@ -33,6 +34,7 @@ import { AssetsSearchContainer } from '../search-container';
33
34
  import { AssetsSearchContainerLoading } from '../search-container/loading-state';
34
35
  import { modalMessages } from './messages';
35
36
  import { MODAL_HEIGHT, RenderAssetsContent } from './render-assets-content';
37
+ var VERSION_TWO = '2';
36
38
  var modalBodyErrorWrapperStyles = css({
37
39
  alignItems: 'center',
38
40
  display: 'grid',
@@ -54,7 +56,8 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
54
56
  _useState4 = _slicedToArray(_useState3, 2),
55
57
  schemaId = _useState4[0],
56
58
  setSchemaId = _useState4[1];
57
- var _useState5 = useState(initialVisibleColumnKeys),
59
+ var apiVersion = initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.version;
60
+ var _useState5 = useState(getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') && apiVersion !== VERSION_TWO ? [] : initialVisibleColumnKeys),
58
61
  _useState6 = _slicedToArray(_useState5, 2),
59
62
  visibleColumnKeys = _useState6[0],
60
63
  setVisibleColumnKeys = _useState6[1];
@@ -109,11 +112,13 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
109
112
  /* ------------------------------ END PERMISSIONS ------------------------------ */
110
113
 
111
114
  var parameters = useMemo(function () {
112
- return {
115
+ return _objectSpread({
113
116
  aql: aql || '',
114
117
  schemaId: schemaId || '',
115
118
  workspaceId: workspaceId || ''
116
- };
119
+ }, getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') ? {
120
+ version: VERSION_TWO
121
+ } : {});
117
122
  }, [aql, schemaId, workspaceId]);
118
123
  var isParametersSet = !!(aql && workspaceId && schemaId);
119
124
  var _useDatasourceTableSt = useDatasourceTableState({
@@ -195,9 +200,14 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
195
200
  setIsNewSearch(false);
196
201
  }, []);
197
202
  useEffect(function () {
198
- var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
199
- setVisibleColumnKeys(newVisibleColumnKeys);
200
- }, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
203
+ if (getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter')) {
204
+ var newVisibleColumnKeys = initialVisibleColumnKeys && initialVisibleColumnKeys.length > 0 && apiVersion === VERSION_TWO ? initialVisibleColumnKeys : defaultVisibleColumnKeys;
205
+ setVisibleColumnKeys(newVisibleColumnKeys);
206
+ } else {
207
+ var _newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
208
+ setVisibleColumnKeys(_newVisibleColumnKeys);
209
+ }
210
+ }, [initialVisibleColumnKeys, defaultVisibleColumnKeys, apiVersion]);
201
211
  useEffect(function () {
202
212
  if (isNewSearch) {
203
213
  setVisibleColumnKeys(defaultVisibleColumnKeys);
@@ -245,11 +255,13 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
245
255
  } else {
246
256
  onInsert(buildDatasourceAdf({
247
257
  id: datasourceId,
248
- parameters: {
258
+ parameters: _objectSpread({
249
259
  workspaceId: workspaceId,
250
260
  aql: aql,
251
261
  schemaId: schemaId
252
- },
262
+ }, getBooleanFF('platform.linking-platform.datasource-assets_add_version_parameter') ? {
263
+ version: VERSION_TWO
264
+ } : {}),
253
265
  views: [{
254
266
  type: 'table',
255
267
  properties: {
@@ -262,7 +274,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
262
274
  }]
263
275
  }), consumerEvent);
264
276
  }
265
- }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys, userInteractions]);
277
+ }, [aql, schemaId, workspaceId, analyticsPayload, totalCount, userInteractions, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, visibleColumnKeys]);
266
278
  var handleOnSearch = useCallback(function (searchAql, searchSchemaId) {
267
279
  if (schemaId !== searchSchemaId || aql !== searchAql || status === 'rejected') {
268
280
  searchCount.current++;
@@ -164,10 +164,10 @@ export var FilterPopupSelect = function FilterPopupSelect(_ref) {
164
164
  testId: "".concat(filterName, "-popup-select"),
165
165
  inputId: "".concat(filterName, "-popup-select--input")
166
166
  /*
167
- this threshold controls the display of the search control (input field for search)
168
- if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
169
- if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
170
- */,
167
+ this threshold controls the display of the search control (input field for search)
168
+ if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
169
+ if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
170
+ */,
171
171
  searchThreshold: -1,
172
172
  inputValue: searchTerm,
173
173
  closeMenuOnSelect: false,
@@ -58,9 +58,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
58
58
  var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
59
59
 
60
60
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
61
- But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
62
- mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
63
- */
61
+ But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
62
+ mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
63
+ */
64
64
  var isInitialRender = useRef(true);
65
65
  var hasColumns = !!columns.length;
66
66
  var isDataReady = hasColumns && responseItems.length > 0 && totalCount && totalCount > 0;
@@ -239,7 +239,7 @@ export var getOrderedColumns = function getOrderedColumns(columns, visibleColumn
239
239
  };
240
240
  var DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
241
241
  var keyBasedWidthMap = {
242
- priority: COLUMN_BASE_WIDTH * 5,
242
+ priority: COLUMN_BASE_WIDTH * 8,
243
243
  status: COLUMN_BASE_WIDTH * 18,
244
244
  summary: COLUMN_BASE_WIDTH * 45,
245
245
  description: COLUMN_BASE_WIDTH * 31,
@@ -25,10 +25,10 @@ export function getFormattedDate(value) {
25
25
  var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datetime';
26
26
  var formatDate = arguments.length > 2 ? arguments[2] : undefined;
27
27
  /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
28
- to be one day off in some timezones. We want it to display the date without converting timezones and a solution
29
- is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
30
- See https://stackoverflow.com/a/31732581
31
- */
28
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
29
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
30
+ See https://stackoverflow.com/a/31732581
31
+ */
32
32
  var dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
33
33
  var date = new Date(dateValue);
34
34
  if (!value || isNaN(date.getTime())) {