@atlaskit/link-datasource 1.24.8 → 1.24.10

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
+ ## 1.24.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#86724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86724) [`718a9aa2424d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/718a9aa2424d) - [ED-22607] Remove references to maxFrames for multi bodied extensions and bump adf-schema from 35.7.0 to 35.8.0
8
+
9
+ ## 1.24.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#86596](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86596) [`37621cb1f1b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/37621cb1f1b9) - Update dependency json-ld-types
14
+ - [#85653](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85653) [`e0233a62f24a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e0233a62f24a) - Add logic to insert confluence search datasource table ADF from modal
15
+
3
16
  ## 1.24.8
4
17
 
5
18
  ### Patch Changes
@@ -36,7 +36,7 @@ var ConfluenceSearchContainer = function ConfluenceSearchContainer(_ref) {
36
36
  }
37
37
  }, [cloudId]);
38
38
  return /*#__PURE__*/_react.default.createElement(_basicSearchInput.BasicSearchInput, {
39
- testId: "confluence-search-datasource-modal--search-input",
39
+ testId: "confluence-search-datasource-modal",
40
40
  isSearching: isSearching,
41
41
  onChange: handleSearchChange,
42
42
  onSearch: onSearch,
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.ConfluenceSearchConfigModal = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
  var _react = require("react");
16
16
  var _react2 = require("@emotion/react");
@@ -23,6 +23,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
23
  var _primitives = require("@atlaskit/primitives");
24
24
  var _linkUrl = _interopRequireDefault(require("@atlaskit/smart-card/link-url"));
25
25
  var _colors = require("@atlaskit/theme/colors");
26
+ var _adf = require("../../../common/utils/adf");
26
27
  var _fetchMessagesForLocale = require("../../../common/utils/locale/fetch-messages-for-locale");
27
28
  var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
28
29
  var _en = _interopRequireDefault(require("../../../i18n/en"));
@@ -58,6 +59,7 @@ var ConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = function
58
59
  initialColumnCustomSizes = props.columnCustomSizes,
59
60
  initialWrappedColumnKeys = props.wrappedColumnKeys,
60
61
  onCancel = props.onCancel,
62
+ onInsert = props.onInsert,
61
63
  initialParameters = props.parameters,
62
64
  urlBeingEdited = props.url,
63
65
  initialVisibleColumnKeys = props.visibleColumnKeys;
@@ -81,11 +83,11 @@ var ConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = function
81
83
  // TODO: further refactoring in EDM-9573
82
84
  // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829210
83
85
  var parameters = (0, _react.useMemo)(function () {
84
- return cloudId ? {
86
+ return _objectSpread(_objectSpread({}, initialParameters), {}, {
85
87
  cloudId: cloudId,
86
88
  searchString: searchString
87
- } : undefined;
88
- }, [cloudId, searchString /** Add more parameters when more filters are added */]);
89
+ });
90
+ }, [cloudId, initialParameters, searchString /** Add more parameters when more filters are added */]);
89
91
  var isParametersSet = (0, _react.useMemo)(function () {
90
92
  return !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(function (v) {
91
93
  return v !== undefined;
@@ -243,20 +245,32 @@ var ConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = function
243
245
  }, [columns.length, selectedConfluenceSiteUrl, confluenceSearchTable, resolvedWithNoResults, status, urlBeingEdited, hasConfluenceSearchParams]);
244
246
  var shouldShowResultsCount = !!totalCount && totalCount !== 1;
245
247
  var onInsertPressed = (0, _react.useCallback)(function () {
246
- // eslint-disable-next-line no-console
247
- // TODO: Implement onInsert in EDM-9412
248
- /**
249
- * onInsert(
250
- {
251
- type: 'inlineCard',
252
- attrs: {
253
- url,
254
- },
255
- } as InlineCardAdf,
256
- consumerEvent,
257
- );
258
- */
259
- }, []);
248
+ if (!isParametersSet || !cloudId) {
249
+ return;
250
+ }
251
+ onInsert((0, _adf.buildDatasourceAdf)({
252
+ id: datasourceId,
253
+ parameters: _objectSpread(_objectSpread({}, parameters), {}, {
254
+ cloudId: cloudId
255
+ }),
256
+ views: [{
257
+ type: 'table',
258
+ properties: {
259
+ columns: (visibleColumnKeys || []).map(function (key) {
260
+ var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
261
+ var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
262
+ return _objectSpread(_objectSpread({
263
+ key: key
264
+ }, width ? {
265
+ width: width
266
+ } : {}), isWrapped ? {
267
+ isWrapped: isWrapped
268
+ } : {});
269
+ })
270
+ }
271
+ }]
272
+ }));
273
+ }, [cloudId, isParametersSet, onInsert, datasourceId, parameters, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
260
274
  var onSearch = (0, _react.useCallback)(function (newSearchString) {
261
275
  setSearchString(newSearchString);
262
276
  reset({
@@ -23,7 +23,7 @@ const ConfluenceSearchContainer = ({
23
23
  }
24
24
  }, [cloudId]);
25
25
  return /*#__PURE__*/React.createElement(BasicSearchInput, {
26
- testId: "confluence-search-datasource-modal--search-input",
26
+ testId: "confluence-search-datasource-modal",
27
27
  isSearching: isSearching,
28
28
  onChange: handleSearchChange,
29
29
  onSearch: onSearch,
@@ -11,6 +11,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
11
  import { Box, xcss } from '@atlaskit/primitives';
12
12
  import LinkUrl from '@atlaskit/smart-card/link-url';
13
13
  import { N800 } from '@atlaskit/theme/colors';
14
+ import { buildDatasourceAdf } from '../../../common/utils/adf';
14
15
  import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
15
16
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
16
17
  import i18nEN from '../../../i18n/en';
@@ -44,6 +45,7 @@ export const ConfluenceSearchConfigModal = props => {
44
45
  columnCustomSizes: initialColumnCustomSizes,
45
46
  wrappedColumnKeys: initialWrappedColumnKeys,
46
47
  onCancel,
48
+ onInsert,
47
49
  parameters: initialParameters,
48
50
  url: urlBeingEdited,
49
51
  visibleColumnKeys: initialVisibleColumnKeys
@@ -55,10 +57,11 @@ export const ConfluenceSearchConfigModal = props => {
55
57
 
56
58
  // TODO: further refactoring in EDM-9573
57
59
  // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829210
58
- const parameters = useMemo(() => cloudId ? {
60
+ const parameters = useMemo(() => ({
61
+ ...initialParameters,
59
62
  cloudId,
60
63
  searchString
61
- } : undefined, [cloudId, searchString /** Add more parameters when more filters are added */]);
64
+ }), [cloudId, initialParameters, searchString /** Add more parameters when more filters are added */]);
62
65
  const isParametersSet = useMemo(() => !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(v => v !== undefined).length > 1, [cloudId, parameters]);
63
66
  const {
64
67
  reset,
@@ -184,20 +187,35 @@ export const ConfluenceSearchConfigModal = props => {
184
187
  }, [columns.length, selectedConfluenceSiteUrl, confluenceSearchTable, resolvedWithNoResults, status, urlBeingEdited, hasConfluenceSearchParams]);
185
188
  const shouldShowResultsCount = !!totalCount && totalCount !== 1;
186
189
  const onInsertPressed = useCallback(() => {
187
- // eslint-disable-next-line no-console
188
- // TODO: Implement onInsert in EDM-9412
189
- /**
190
- * onInsert(
191
- {
192
- type: 'inlineCard',
193
- attrs: {
194
- url,
195
- },
196
- } as InlineCardAdf,
197
- consumerEvent,
198
- );
199
- */
200
- }, []);
190
+ if (!isParametersSet || !cloudId) {
191
+ return;
192
+ }
193
+ onInsert(buildDatasourceAdf({
194
+ id: datasourceId,
195
+ parameters: {
196
+ ...parameters,
197
+ cloudId
198
+ },
199
+ views: [{
200
+ type: 'table',
201
+ properties: {
202
+ columns: (visibleColumnKeys || []).map(key => {
203
+ const width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
204
+ const isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
205
+ return {
206
+ key,
207
+ ...(width ? {
208
+ width
209
+ } : {}),
210
+ ...(isWrapped ? {
211
+ isWrapped
212
+ } : {})
213
+ };
214
+ })
215
+ }
216
+ }]
217
+ }));
218
+ }, [cloudId, isParametersSet, onInsert, datasourceId, parameters, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
201
219
  const onSearch = useCallback(newSearchString => {
202
220
  setSearchString(newSearchString);
203
221
  reset({
@@ -26,7 +26,7 @@ var ConfluenceSearchContainer = function ConfluenceSearchContainer(_ref) {
26
26
  }
27
27
  }, [cloudId]);
28
28
  return /*#__PURE__*/React.createElement(BasicSearchInput, {
29
- testId: "confluence-search-datasource-modal--search-input",
29
+ testId: "confluence-search-datasource-modal",
30
30
  isSearching: isSearching,
31
31
  onChange: handleSearchChange,
32
32
  onSearch: onSearch,
@@ -1,11 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  /** @jsx jsx */
10
10
  import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
11
  import { jsx } from '@emotion/react';
@@ -18,6 +18,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
18
18
  import { Box, xcss } from '@atlaskit/primitives';
19
19
  import LinkUrl from '@atlaskit/smart-card/link-url';
20
20
  import { N800 } from '@atlaskit/theme/colors';
21
+ import { buildDatasourceAdf } from '../../../common/utils/adf';
21
22
  import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
22
23
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
23
24
  import i18nEN from '../../../i18n/en';
@@ -49,6 +50,7 @@ export var ConfluenceSearchConfigModal = function ConfluenceSearchConfigModal(pr
49
50
  initialColumnCustomSizes = props.columnCustomSizes,
50
51
  initialWrappedColumnKeys = props.wrappedColumnKeys,
51
52
  onCancel = props.onCancel,
53
+ onInsert = props.onInsert,
52
54
  initialParameters = props.parameters,
53
55
  urlBeingEdited = props.url,
54
56
  initialVisibleColumnKeys = props.visibleColumnKeys;
@@ -72,11 +74,11 @@ export var ConfluenceSearchConfigModal = function ConfluenceSearchConfigModal(pr
72
74
  // TODO: further refactoring in EDM-9573
73
75
  // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829210
74
76
  var parameters = useMemo(function () {
75
- return cloudId ? {
77
+ return _objectSpread(_objectSpread({}, initialParameters), {}, {
76
78
  cloudId: cloudId,
77
79
  searchString: searchString
78
- } : undefined;
79
- }, [cloudId, searchString /** Add more parameters when more filters are added */]);
80
+ });
81
+ }, [cloudId, initialParameters, searchString /** Add more parameters when more filters are added */]);
80
82
  var isParametersSet = useMemo(function () {
81
83
  return !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(function (v) {
82
84
  return v !== undefined;
@@ -234,20 +236,32 @@ export var ConfluenceSearchConfigModal = function ConfluenceSearchConfigModal(pr
234
236
  }, [columns.length, selectedConfluenceSiteUrl, confluenceSearchTable, resolvedWithNoResults, status, urlBeingEdited, hasConfluenceSearchParams]);
235
237
  var shouldShowResultsCount = !!totalCount && totalCount !== 1;
236
238
  var onInsertPressed = useCallback(function () {
237
- // eslint-disable-next-line no-console
238
- // TODO: Implement onInsert in EDM-9412
239
- /**
240
- * onInsert(
241
- {
242
- type: 'inlineCard',
243
- attrs: {
244
- url,
245
- },
246
- } as InlineCardAdf,
247
- consumerEvent,
248
- );
249
- */
250
- }, []);
239
+ if (!isParametersSet || !cloudId) {
240
+ return;
241
+ }
242
+ onInsert(buildDatasourceAdf({
243
+ id: datasourceId,
244
+ parameters: _objectSpread(_objectSpread({}, parameters), {}, {
245
+ cloudId: cloudId
246
+ }),
247
+ views: [{
248
+ type: 'table',
249
+ properties: {
250
+ columns: (visibleColumnKeys || []).map(function (key) {
251
+ var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
252
+ var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
253
+ return _objectSpread(_objectSpread({
254
+ key: key
255
+ }, width ? {
256
+ width: width
257
+ } : {}), isWrapped ? {
258
+ isWrapped: isWrapped
259
+ } : {});
260
+ })
261
+ }
262
+ }]
263
+ }));
264
+ }, [cloudId, isParametersSet, onInsert, datasourceId, parameters, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
251
265
  var onSearch = useCallback(function (newSearchString) {
252
266
  setSearchString(newSearchString);
253
267
  reset({
@@ -1,12 +1,22 @@
1
1
  import { DatasourceAdf } from '@atlaskit/linking-common/types';
2
2
  import { ConfigModalProps } from '../../common/types';
3
- export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, {
4
- cloudId: string;
5
- searchString?: string;
6
- }> {
3
+ export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
7
4
  }
8
5
  export type ConfluenceSearchDatasourceParameters = {
9
6
  cloudId: string;
10
7
  searchString?: string;
8
+ entityTypes?: string[];
9
+ contentARIs?: string[];
10
+ spaceKeys?: string[];
11
+ contributorAccountIds?: string[];
12
+ labels?: string[];
13
+ ancestorPageIds?: string[];
14
+ containerStatus?: string[];
15
+ contentStatuses?: string[];
16
+ creatorAccountIds?: string[];
17
+ lastModified?: 'today' | 'yesterday' | 'past7Days' | 'past30Days' | 'pastYear' | 'custom';
18
+ lastModifiedFrom?: string;
19
+ lastModifiedTo?: string;
20
+ shouldMatchTitleOnly?: boolean;
11
21
  };
12
22
  export type ConfluenceSearchDatasourceAdf = DatasourceAdf<ConfluenceSearchDatasourceParameters>;
@@ -1,12 +1,22 @@
1
1
  import { DatasourceAdf } from '@atlaskit/linking-common/types';
2
2
  import { ConfigModalProps } from '../../common/types';
3
- export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, {
4
- cloudId: string;
5
- searchString?: string;
6
- }> {
3
+ export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
7
4
  }
8
5
  export type ConfluenceSearchDatasourceParameters = {
9
6
  cloudId: string;
10
7
  searchString?: string;
8
+ entityTypes?: string[];
9
+ contentARIs?: string[];
10
+ spaceKeys?: string[];
11
+ contributorAccountIds?: string[];
12
+ labels?: string[];
13
+ ancestorPageIds?: string[];
14
+ containerStatus?: string[];
15
+ contentStatuses?: string[];
16
+ creatorAccountIds?: string[];
17
+ lastModified?: 'today' | 'yesterday' | 'past7Days' | 'past30Days' | 'pastYear' | 'custom';
18
+ lastModifiedFrom?: string;
19
+ lastModifiedTo?: string;
20
+ shouldMatchTitleOnly?: boolean;
11
21
  };
12
22
  export type ConfluenceSearchDatasourceAdf = DatasourceAdf<ConfluenceSearchDatasourceParameters>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.24.8",
3
+ "version": "1.24.10",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "analytics:codegen": "yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource --output ./src/analytics/generated"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^35.7.0",
34
+ "@atlaskit/adf-schema": "^35.8.0",
35
35
  "@atlaskit/analytics-next": "^9.2.0",
36
36
  "@atlaskit/avatar": "^21.5.0",
37
37
  "@atlaskit/avatar-group": "^9.5.0",
@@ -102,7 +102,7 @@
102
102
  "@types/debounce-promise": "^3.1.2",
103
103
  "fetch-mock": "^8.0.0",
104
104
  "jest-fetch-mock": "^3.0.3",
105
- "json-ld-types": "^3.11.0",
105
+ "json-ld-types": "^4.1.0",
106
106
  "typescript": "~5.4.2",
107
107
  "wait-for-expect": "^1.2.0"
108
108
  },