@atlaskit/link-datasource 6.13.0 → 6.13.3

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 (81) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/analytics/xpc/useDatasourceCrossProductAttribution.js +2 -2
  3. package/dist/cjs/hooks/useErrorLogger.js +2 -2
  4. package/dist/cjs/hooks/useIsInPDFRender.js +2 -2
  5. package/dist/cjs/index.js +13 -13
  6. package/dist/cjs/services/__clearUnitsRolloutSettingsCacheForTests.js +13 -0
  7. package/dist/cjs/services/fetchObjectSchema.js +2 -2
  8. package/dist/cjs/services/fetchObjectSchemas.js +2 -2
  9. package/dist/cjs/services/getAvailableSites.js +32 -19
  10. package/dist/cjs/services/getUnitsRolloutSettings.js +199 -0
  11. package/dist/cjs/services/getWorkspaceId.js +2 -2
  12. package/dist/cjs/services/isUnitsIsolationEnabled.js +63 -0
  13. package/dist/cjs/services/resolvePrimaryWorkspace.js +2 -2
  14. package/dist/cjs/services/useBasicFilterAGG.js +2 -2
  15. package/dist/cjs/services/validateAql.js +2 -2
  16. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +3 -2
  17. package/dist/cjs/ui/assets-modal/search-container/aql-search-input/loading-state.js +2 -2
  18. package/dist/cjs/ui/assets-modal/search-container/object-schema-select/loading-state.js +2 -2
  19. package/dist/cjs/ui/common/modal/popup-select/index.js +2 -2
  20. package/dist/cjs/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +2 -2
  21. package/dist/cjs/ui/issue-like-table/empty-state/index.js +3 -3
  22. package/dist/cjs/ui/issue-like-table/issue-like-data-table-view.js +2 -2
  23. package/dist/cjs/ui/jira-issues-modal/modal/index.js +2 -2
  24. package/dist/es2019/analytics/xpc/useDatasourceCrossProductAttribution.js +1 -1
  25. package/dist/es2019/hooks/useErrorLogger.js +1 -1
  26. package/dist/es2019/hooks/useIsInPDFRender.js +1 -1
  27. package/dist/es2019/index.js +5 -5
  28. package/dist/es2019/services/__clearUnitsRolloutSettingsCacheForTests.js +8 -0
  29. package/dist/es2019/services/fetchObjectSchema.js +1 -1
  30. package/dist/es2019/services/fetchObjectSchemas.js +1 -1
  31. package/dist/es2019/services/getAvailableSites.js +2 -2
  32. package/dist/es2019/services/getUnitsRolloutSettings.js +112 -0
  33. package/dist/es2019/services/getWorkspaceId.js +1 -1
  34. package/dist/es2019/services/isUnitsIsolationEnabled.js +34 -0
  35. package/dist/es2019/services/resolvePrimaryWorkspace.js +1 -1
  36. package/dist/es2019/services/useBasicFilterAGG.js +1 -1
  37. package/dist/es2019/services/validateAql.js +1 -1
  38. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +1 -1
  39. package/dist/es2019/ui/assets-modal/search-container/aql-search-input/loading-state.js +1 -1
  40. package/dist/es2019/ui/assets-modal/search-container/object-schema-select/loading-state.js +1 -1
  41. package/dist/es2019/ui/common/modal/popup-select/index.js +1 -1
  42. package/dist/es2019/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +1 -1
  43. package/dist/es2019/ui/issue-like-table/empty-state/index.js +1 -1
  44. package/dist/es2019/ui/issue-like-table/issue-like-data-table-view.js +1 -1
  45. package/dist/es2019/ui/jira-issues-modal/modal/index.js +1 -1
  46. package/dist/esm/analytics/xpc/useDatasourceCrossProductAttribution.js +1 -1
  47. package/dist/esm/hooks/useErrorLogger.js +1 -1
  48. package/dist/esm/hooks/useIsInPDFRender.js +1 -1
  49. package/dist/esm/index.js +5 -5
  50. package/dist/esm/services/__clearUnitsRolloutSettingsCacheForTests.js +8 -0
  51. package/dist/esm/services/fetchObjectSchema.js +1 -1
  52. package/dist/esm/services/fetchObjectSchemas.js +1 -1
  53. package/dist/esm/services/getAvailableSites.js +32 -19
  54. package/dist/esm/services/getUnitsRolloutSettings.js +192 -0
  55. package/dist/esm/services/getWorkspaceId.js +1 -1
  56. package/dist/esm/services/isUnitsIsolationEnabled.js +57 -0
  57. package/dist/esm/services/resolvePrimaryWorkspace.js +1 -1
  58. package/dist/esm/services/useBasicFilterAGG.js +1 -1
  59. package/dist/esm/services/validateAql.js +1 -1
  60. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +1 -1
  61. package/dist/esm/ui/assets-modal/search-container/aql-search-input/loading-state.js +1 -1
  62. package/dist/esm/ui/assets-modal/search-container/object-schema-select/loading-state.js +1 -1
  63. package/dist/esm/ui/common/modal/popup-select/index.js +1 -1
  64. package/dist/esm/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +1 -1
  65. package/dist/esm/ui/issue-like-table/empty-state/index.js +1 -1
  66. package/dist/esm/ui/issue-like-table/issue-like-data-table-view.js +1 -1
  67. package/dist/esm/ui/jira-issues-modal/modal/index.js +1 -1
  68. package/dist/types/common/utils/locale/fetch-messages-for-locale.d.ts +1 -1
  69. package/dist/types/index.d.ts +5 -5
  70. package/dist/types/services/__clearUnitsRolloutSettingsCacheForTests.d.ts +4 -0
  71. package/dist/types/services/getUnitsRolloutSettings.d.ts +29 -0
  72. package/dist/types/services/isUnitsIsolationEnabled.d.ts +15 -0
  73. package/dist/types/ui/common/modal/datasource-context/DatasourceContextProviderProps.d.ts +1 -1
  74. package/dist/types/ui/common/modal/datasource-modal/createDatasourceModal.d.ts +1 -1
  75. package/examples-helpers/buildAssetsIssuesTable.tsx +1 -1
  76. package/examples-helpers/buildConfluenceSearchTable.tsx +2 -2
  77. package/examples-helpers/buildIssueLikeTable.tsx +1 -1
  78. package/examples-helpers/buildIssueLikeTableLoadingError.tsx +1 -1
  79. package/examples-helpers/buildJiraIssuesTable.tsx +3 -2
  80. package/examples-helpers/smartLinkCustomClient.ts +1 -1
  81. package/package.json +14 -6
@@ -1,6 +1,7 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
@@ -14,7 +15,7 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
14
15
  var _accessRequired = require("../../../common/error-state/access-required");
15
16
  var _modalLoadingError = require("../../../common/error-state/modal-loading-error");
16
17
  var _noResults = require("../../../common/error-state/no-results");
17
- var _issueLikeTable = require("../../../issue-like-table");
18
+ var _emptyState = _interopRequireDefault(require("../../../issue-like-table/empty-state"));
18
19
  var _issueLikeDataTableView = require("../../../issue-like-table/issue-like-data-table-view");
19
20
  var _initialStateView = require("./initial-state-view");
20
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -47,7 +48,7 @@ var NoResultsView = function NoResultsView() {
47
48
  var LoadingView = function LoadingView() {
48
49
  return /*#__PURE__*/React.createElement("div", {
49
50
  className: (0, _runtime.ax)(["_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_19itia51 _n7zl1mpn _13li1mok _qrwq1mok _1itkz1kv _12vemgnk _1lrw1sd4 _qmxj1c00", "_1reo15vq _18m915vq"])
50
- }, /*#__PURE__*/React.createElement(_issueLikeTable.EmptyState, {
51
+ }, /*#__PURE__*/React.createElement(_emptyState.default, {
51
52
  testId: "assets-aql-datasource-modal--loading-state"
52
53
  }));
53
54
  };
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.AssetsAqlSearchInputSkeleton = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _linkingCommon = require("@atlaskit/linking-common");
9
+ var _skeleton = require("@atlaskit/linking-common/skeleton");
10
10
  var AssetsAqlSearchInputSkeleton = exports.AssetsAqlSearchInputSkeleton = function AssetsAqlSearchInputSkeleton() {
11
- return /*#__PURE__*/_react.default.createElement(_linkingCommon.Skeleton, {
11
+ return /*#__PURE__*/_react.default.createElement(_skeleton.Skeleton, {
12
12
  width: "100%",
13
13
  height: "40px",
14
14
  testId: "assets-datasource-modal--aql-search-input-skeleton"
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.AssetsObjectSchemaSelectSkeleton = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _linkingCommon = require("@atlaskit/linking-common");
9
+ var _skeleton = require("@atlaskit/linking-common/skeleton");
10
10
  var AssetsObjectSchemaSelectSkeleton = exports.AssetsObjectSchemaSelectSkeleton = function AssetsObjectSchemaSelectSkeleton() {
11
- return /*#__PURE__*/_react.default.createElement(_linkingCommon.Skeleton, {
11
+ return /*#__PURE__*/_react.default.createElement(_skeleton.Skeleton, {
12
12
  width: "100%",
13
13
  height: "40px",
14
14
  testId: "assets-datasource-modal--object-schema-select-skeleton"
@@ -18,7 +18,7 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
18
18
  var _reactIntl = require("react-intl");
19
19
  var _popupSelect = require("@atlaskit/select/popup-select");
20
20
  var _analytics = require("../../../../analytics");
21
- var _control = _interopRequireDefault(require("./control"));
21
+ var _CustomControl = require("./CustomControl");
22
22
  var _customCheckboxOption = require("./custom-checkbox-option");
23
23
  var _dropdownIndicator = _interopRequireDefault(require("./dropdownIndicator"));
24
24
  var _footer = _interopRequireDefault(require("./footer"));
@@ -192,7 +192,7 @@ var FilterPopupSelect = exports.FilterPopupSelect = function FilterPopupSelect(_
192
192
  menuListProps: menuListProps,
193
193
  components: {
194
194
  Option: _customCheckboxOption.CustomCheckboxOption,
195
- Control: _control.default,
195
+ Control: _CustomControl.CustomControl,
196
196
  MenuList: _menuList.default,
197
197
  DropdownIndicator: _dropdownIndicator.default,
198
198
  LoadingIndicator: undefined // disables the three ... indicator in the searchbox when picker is loading
@@ -47,7 +47,7 @@ var _DatasourceViewModeDropDown = require("../../common/modal/mode-switcher/Data
47
47
  var _useViewModeContext2 = require("../../common/modal/mode-switcher/useViewModeContext");
48
48
  var _searchCount = _interopRequireDefault(require("../../common/modal/search-count"));
49
49
  var _siteSelector = require("../../common/modal/site-selector");
50
- var _issueLikeTable = require("../../issue-like-table");
50
+ var _emptyState = _interopRequireDefault(require("../../issue-like-table/empty-state"));
51
51
  var _confluenceSearchContainer = _interopRequireDefault(require("../confluence-search-container"));
52
52
  var _messages = require("./messages");
53
53
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -253,7 +253,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
253
253
  } else if (status === 'empty' || !columns.length) {
254
254
  // persist the empty state when making the initial /data request which contains the columns
255
255
  if (hasConfluenceSearchParams !== undefined) {
256
- return /*#__PURE__*/_react.default.createElement(_issueLikeTable.EmptyState, {
256
+ return /*#__PURE__*/_react.default.createElement(_emptyState.default, {
257
257
  testId: "confluence-search-datasource-modal--empty-state"
258
258
  });
259
259
  }
@@ -13,14 +13,14 @@ var React = _react;
13
13
  var _runtime = require("@compiled/react/runtime");
14
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
16
- var _linkingCommon = require("@atlaskit/linking-common");
16
+ var _skeleton = require("@atlaskit/linking-common/skeleton");
17
17
  var _excluded = ["as", "style"];
18
18
  /* eslint-disable @atlaskit/design-system/use-tokens-typography */
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SkeletonComponent = function SkeletonComponent(_ref) {
21
21
  var width = _ref.width,
22
22
  itemName = _ref.itemName;
23
- return /*#__PURE__*/React.createElement(_linkingCommon.Skeleton, {
23
+ return /*#__PURE__*/React.createElement(_skeleton.Skeleton, {
24
24
  borderRadius: "var(--ds-radius-small, 8px)",
25
25
  testId: "".concat(itemName, "-empty-state-skeleton"),
26
26
  height: 14,
@@ -143,7 +143,7 @@ var EmptyState = function EmptyState(_ref5) {
143
143
  width: width,
144
144
  padding: padding
145
145
  }
146
- }, /*#__PURE__*/React.createElement(_linkingCommon.Skeleton, {
146
+ }, /*#__PURE__*/React.createElement(_skeleton.Skeleton, {
147
147
  appearance: "darkGray",
148
148
  borderRadius: "var(--ds-radius-full, 9999px)",
149
149
  testId: "empty-state-skeleton",
@@ -24,7 +24,7 @@ var _button = _interopRequireDefault(require("@atlaskit/button/default/button"))
24
24
  var _flagsProvider = require("@atlaskit/flag/flags-provider");
25
25
  var _sortAscending = _interopRequireDefault(require("@atlaskit/icon/core/sort-ascending"));
26
26
  var _sortDescending = _interopRequireDefault(require("@atlaskit/icon/core/sort-descending"));
27
- var _linkingCommon = require("@atlaskit/linking-common");
27
+ var _skeleton = require("@atlaskit/linking-common/skeleton");
28
28
  var _fg = require("@atlaskit/platform-feature-flags/fg");
29
29
  var _extractClosestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/extract-closest-edge");
30
30
  var _reorderWithEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge");
@@ -361,7 +361,7 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
361
361
  return {
362
362
  content: /*#__PURE__*/React.createElement(_compiled.Box, {
363
363
  paddingInline: "space.100"
364
- }, /*#__PURE__*/React.createElement(_linkingCommon.Skeleton, {
364
+ }, /*#__PURE__*/React.createElement(_skeleton.Skeleton, {
365
365
  borderRadius: "var(--ds-radius-large, 8px)",
366
366
  width: "100%",
367
367
  height: 14,
@@ -60,7 +60,7 @@ var _DatasourceViewModeDropDown = require("../../common/modal/mode-switcher/Data
60
60
  var _useViewModeContext2 = require("../../common/modal/mode-switcher/useViewModeContext");
61
61
  var _searchCount = _interopRequireDefault(require("../../common/modal/search-count"));
62
62
  var _siteSelector = require("../../common/modal/site-selector");
63
- var _issueLikeTable = require("../../issue-like-table");
63
+ var _emptyState = _interopRequireDefault(require("../../issue-like-table/empty-state"));
64
64
  var _ui = require("../basic-filters/ui");
65
65
  var _isQueryTooComplex = require("../basic-filters/utils/isQueryTooComplex");
66
66
  var _jiraSearchContainer = require("../jira-search-container");
@@ -335,7 +335,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
335
335
  // persist the empty state when making the initial /data request which contains the columns
336
336
  return /*#__PURE__*/_react.default.createElement(_contentContainer.ContentContainer, {
337
337
  withTableBorder: !!jql
338
- }, !!jql ? /*#__PURE__*/_react.default.createElement(_issueLikeTable.EmptyState, {
338
+ }, !!jql ? /*#__PURE__*/_react.default.createElement(_emptyState.default, {
339
339
  testId: "jira-datasource-modal--empty-state"
340
340
  }) : /*#__PURE__*/_react.default.createElement(_initialStateView.InitialStateView, {
341
341
  icon: /*#__PURE__*/_react.default.createElement(_search.RichIconSearch, {
@@ -1,6 +1,6 @@
1
1
  import { useCallback } from 'react';
2
2
  import { useCrossProductUrlWrapper } from '@atlaskit/analytics-cross-product/useCrossProductUrlWrapper';
3
- import { useSmartCardContext } from '@atlaskit/link-provider/context';
3
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
4
4
  import { functionWithFG } from '@atlaskit/platform-feature-flags-react/function-with-fg';
5
5
  const DATASOURCE_XPC_BRIDGE = 'linkDatasource';
6
6
  const XPC_QUERY_PARAM = 'xpis';
@@ -1,6 +1,6 @@
1
1
  import { useCallback } from 'react';
2
2
  import { NetworkError } from '@atlaskit/linking-common';
3
- import { getTraceId } from '@atlaskit/linking-common/utils';
3
+ import { getTraceId } from '@atlaskit/linking-common/utils/get-trace-id';
4
4
  import { useDatasourceAnalyticsEvents } from '../analytics';
5
5
  import { logToSentry } from './logToSentry';
6
6
  const getNetworkFields = error => {
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { useSmartCardContext } from '@atlaskit/link-provider';
2
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
3
3
  export const useIsInPDFRender = () => {
4
4
  const smartCardContext = useSmartCardContext();
5
5
  return useMemo(() => {
@@ -1,17 +1,17 @@
1
1
  /** @deprecated Use @atlaskit/link-datasource/confluence-search-modal */
2
- export { default as ConfluenceSearchConfigModal } from './ui/confluence-search-modal';
2
+ export { ConfluenceSearchConfigModalWithWrappers as ConfluenceSearchConfigModal } from './ui/confluence-search-modal/ConfluenceSearchConfigModalWithWrappers';
3
3
 
4
4
  /** @deprecated Use @atlaskit/link-datasource/jira-issues-modal */
5
- export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
5
+ export { JiraIssuesConfigModalWithWrappers as JiraIssuesConfigModal } from './ui/jira-issues-modal/JiraIssuesConfigModalWithWrappers';
6
6
 
7
7
  /** @deprecated Use @atlaskit/link-datasource/assets-modal */
8
- export { default as AssetsConfigModal } from './ui/assets-modal';
8
+ export { AssetsConfigModalWithWrappers as AssetsConfigModal } from './ui/assets-modal/AssetsConfigModalWithWrappers';
9
9
 
10
10
  /** @deprecated Use @atlaskit/link-datasource/datasource-table-view */
11
- export { default as DatasourceTableView } from './ui/datasource-table-view';
11
+ export { DatasourceTableViewWithWrappers as DatasourceTableView } from './ui/datasource-table-view/DatasourceTableViewWithWrappers';
12
12
 
13
13
  /** @deprecated Use @atlaskit/link-datasource/assets-modal (AssetsConfigModal) */
14
- export { default as JSMAssetsConfigModal } from './ui/assets-modal';
14
+ export { AssetsConfigModalWithWrappers as JSMAssetsConfigModal } from './ui/assets-modal/AssetsConfigModalWithWrappers';
15
15
 
16
16
  /** @deprecated Use @atlaskit/link-datasource/utils/schema */
17
17
  export { buildDatasourceAdf } from './common/utils/schema-utils';
@@ -0,0 +1,8 @@
1
+ import { cache } from './getUnitsRolloutSettings';
2
+
3
+ /**
4
+ * Test-only: clear the cached units rollout settings so each test starts with a clean slate.
5
+ */
6
+ export const __clearUnitsRolloutSettingsCacheForTests = () => {
7
+ cache.promise = undefined;
8
+ };
@@ -1,4 +1,4 @@
1
- import { request } from '@atlaskit/linking-common';
1
+ import { request } from '@atlaskit/linking-common/api';
2
2
  import { FetchError } from './FetchError';
3
3
  import { PermissionError } from './PermissionError';
4
4
  import { getStatusCodeGroup } from './getStatusCodeGroup';
@@ -1,4 +1,4 @@
1
- import { request } from '@atlaskit/linking-common';
1
+ import { request } from '@atlaskit/linking-common/api';
2
2
  import { FetchError } from './FetchError';
3
3
  import { PermissionError } from './PermissionError';
4
4
  import { getStatusCodeGroup } from './getStatusCodeGroup';
@@ -1,5 +1,5 @@
1
1
  import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/hooks';
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
2
+ import { isUnitsIsolationEnabled } from './isUnitsIsolationEnabled';
3
3
  export const getAccessibleProducts = async product => {
4
4
  const requestConfig = {
5
5
  method: 'POST',
@@ -13,7 +13,7 @@ export const getAccessibleProducts = async product => {
13
13
  productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
14
14
  })
15
15
  };
16
- const endpoint = fg('linking_platform_link_datasource_unit_compliant') ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
16
+ const endpoint = (await isUnitsIsolationEnabled()) ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
17
17
  const response = await fetch(endpoint, requestConfig);
18
18
  if (response.ok) {
19
19
  const res = await response.json();
@@ -0,0 +1,112 @@
1
+ import { request } from '@atlaskit/linking-common';
2
+ const AGG_URL = '/gateway/api/graphql';
3
+ const TENANT_CONTEXT_OPERATION_NAME = 'link_datasource_tenantContext';
4
+ const UNITS_ROLLOUT_SETTINGS_OPERATION_NAME = 'link_datasource_unitSettings';
5
+
6
+ /**
7
+ * `Query.admin_unitSettings` is keyed by org id, which the browser does not know, so the org id
8
+ * is resolved from the host the product is currently served from.
9
+ */
10
+ export const tenantContextQuery = `
11
+ query ${TENANT_CONTEXT_OPERATION_NAME}($hostNames: [String!]) {
12
+ tenantContexts(hostNames: $hostNames) {
13
+ orgId
14
+ }
15
+ }
16
+ `;
17
+
18
+ /**
19
+ * `admin_unitSettings` exposes both flags of the rollout and is callable with the session of the
20
+ * end user, so no opt-in directive or admin OAuth scope is needed from the browser.
21
+ */
22
+ export const unitsRolloutSettingsQuery = `
23
+ query ${UNITS_ROLLOUT_SETTINGS_OPERATION_NAME}($orgId: ID!) {
24
+ admin_unitSettings(orgId: $orgId) {
25
+ boundaryEnforced
26
+ endUsersLaunched
27
+ }
28
+ }
29
+ `;
30
+ /**
31
+ * When the rollout settings cannot be resolved we keep the pre-isolation behaviour, which is
32
+ * what every org gets today while the unit settings are unset. The settings are only
33
+ * written when an org is activated - they are not backfilled - so `null` is expected for orgs
34
+ * that have not been activated yet and must be read as `false`.
35
+ */
36
+ const DEFAULT_SETTINGS = {
37
+ boundaryEnforced: false,
38
+ endUsersLaunched: false
39
+ };
40
+
41
+ /**
42
+ * Holds the in-flight/resolved request so that the settings are only fetched once per page load.
43
+ */
44
+ export const cache = {};
45
+
46
+ /**
47
+ * AGG answers with a 200 and an `errors` array for query level failures, so those have to be
48
+ * turned into a rejection explicitly rather than being read as an empty response.
49
+ */
50
+ const requestGraphQL = async (operationName, query, variables) => {
51
+ var _response$errors, _response$data;
52
+ const response = await request('post', AGG_URL, {
53
+ operationName,
54
+ query,
55
+ variables
56
+ });
57
+ if (response !== null && response !== void 0 && (_response$errors = response.errors) !== null && _response$errors !== void 0 && _response$errors.length) {
58
+ const messages = response.errors.map(error => error === null || error === void 0 ? void 0 : error.message).filter(Boolean).join(', ');
59
+ throw new Error(`${operationName} failed: ${messages || 'unknown error'}`);
60
+ }
61
+ return (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : undefined;
62
+ };
63
+ const fetchOrgId = async () => {
64
+ var _window$location;
65
+ const hostName = typeof window !== 'undefined' ? (_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname : undefined;
66
+ if (!hostName) {
67
+ return undefined;
68
+ }
69
+ const data = await requestGraphQL(TENANT_CONTEXT_OPERATION_NAME, tenantContextQuery, {
70
+ hostNames: [hostName]
71
+ });
72
+ for (const tenantContext of (_data$tenantContexts = data === null || data === void 0 ? void 0 : data.tenantContexts) !== null && _data$tenantContexts !== void 0 ? _data$tenantContexts : []) {
73
+ var _data$tenantContexts;
74
+ if (tenantContext !== null && tenantContext !== void 0 && tenantContext.orgId) {
75
+ return tenantContext.orgId;
76
+ }
77
+ }
78
+ return undefined;
79
+ };
80
+ const fetchUnitsRolloutSettings = async () => {
81
+ var _settings$boundaryEnf, _settings$endUsersLau;
82
+ const orgId = await fetchOrgId();
83
+ if (!orgId) {
84
+ return DEFAULT_SETTINGS;
85
+ }
86
+ const data = await requestGraphQL(UNITS_ROLLOUT_SETTINGS_OPERATION_NAME, unitsRolloutSettingsQuery, {
87
+ orgId
88
+ });
89
+ const settings = data === null || data === void 0 ? void 0 : data.admin_unitSettings;
90
+ return {
91
+ boundaryEnforced: (_settings$boundaryEnf = settings === null || settings === void 0 ? void 0 : settings.boundaryEnforced) !== null && _settings$boundaryEnf !== void 0 ? _settings$boundaryEnf : false,
92
+ endUsersLaunched: (_settings$endUsersLau = settings === null || settings === void 0 ? void 0 : settings.endUsersLaunched) !== null && _settings$endUsersLau !== void 0 ? _settings$endUsersLau : false
93
+ };
94
+ };
95
+
96
+ /**
97
+ * Reads the org's units rollout settings (`boundaryEnforced` and `endUsersLaunched`) from the
98
+ * TCS key exposed by AGG's `Query.admin_unitSettings`.
99
+ *
100
+ * The result is cached for the lifetime of the page because the settings only change when an
101
+ * admin activates or launches units, which requires a reload to be picked up anyway. A failed
102
+ * request is not cached so that a later call can retry.
103
+ */
104
+ export const getUnitsRolloutSettings = () => {
105
+ if (!cache.promise) {
106
+ cache.promise = fetchUnitsRolloutSettings().catch(() => {
107
+ cache.promise = undefined;
108
+ return DEFAULT_SETTINGS;
109
+ });
110
+ }
111
+ return cache.promise;
112
+ };
@@ -1,4 +1,4 @@
1
- import { request } from '@atlaskit/linking-common';
1
+ import { request } from '@atlaskit/linking-common/api';
2
2
  import { FetchError } from './FetchError';
3
3
  import { PermissionError } from './PermissionError';
4
4
  import { getStatusCodeGroup } from './getStatusCodeGroup';
@@ -0,0 +1,34 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
2
+ import { getUnitsRolloutSettings } from './getUnitsRolloutSettings';
3
+
4
+ /**
5
+ * Whether unit isolation behaviour should be applied for the current org.
6
+ *
7
+ * An org is isolated when units GA is on, the org has been opted in to the rollout - either by
8
+ * org id or by cloud id - *and* the org has actually launched units with boundary enforcement
9
+ * turned on:
10
+ *
11
+ * `cc-units-ga on -> (orgId gate on || cloudId gate on) -> endUsersLaunched && boundaryEnforced -> isolate`
12
+ *
13
+ * `cc-units-ga` is the units GA master gate and acts as the killswitch: while it is off nothing
14
+ * else is evaluated and the current, non-isolated behaviour is kept. The AGG call is only made
15
+ * when one of the rollout gates passes, so orgs outside of the rollout do not pay for an extra
16
+ * request.
17
+ */
18
+ export const isUnitsIsolationEnabled = async () => {
19
+ if (!fg('cc-units-ga')) {
20
+ return false;
21
+ }
22
+
23
+ // Both rollout gates are always evaluated so that exposure is recorded consistently.
24
+ const isOrgInRollout = fg('linking_platform_link_datasource_unit_compliant');
25
+ const isCloudInRollout = fg('linking_platform_link_datasource_unit_compliant_cloud_id');
26
+ if (!isOrgInRollout && !isCloudInRollout) {
27
+ return false;
28
+ }
29
+ const {
30
+ boundaryEnforced,
31
+ endUsersLaunched
32
+ } = await getUnitsRolloutSettings();
33
+ return boundaryEnforced && endUsersLaunched;
34
+ };
@@ -1,4 +1,4 @@
1
- import { request } from '@atlaskit/linking-common';
1
+ import { request } from '@atlaskit/linking-common/api';
2
2
  // Resolves the primary Unit workspace via the unit-aware resolver, keyed by the
3
3
  // current-site cloudId. Gated at the call-site behind
4
4
  // `astral_units_workspace_host_resolver`.
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useMemo } from 'react';
2
- import { request } from '@atlaskit/linking-common';
2
+ import { request } from '@atlaskit/linking-common/api';
3
3
  import { fieldValuesQuery, hydrateJQLQuery, userHydration, userQuery } from './utils';
4
4
  const AGG_BASE_URL = '/gateway/api/graphql';
5
5
  export const useBasicFilterAGG = () => {
@@ -1,4 +1,4 @@
1
- import { request } from '@atlaskit/linking-common';
1
+ import { request } from '@atlaskit/linking-common/api';
2
2
  import { FetchError } from './FetchError';
3
3
  import { PermissionError } from './PermissionError';
4
4
  import { getStatusCodeGroup } from './getStatusCodeGroup';
@@ -7,7 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
7
  import { AccessRequired } from '../../../common/error-state/access-required';
8
8
  import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
9
9
  import { NoResults } from '../../../common/error-state/no-results';
10
- import { EmptyState } from '../../../issue-like-table';
10
+ import EmptyState from '../../../issue-like-table/empty-state';
11
11
  import { IssueLikeDataTableView } from '../../../issue-like-table/issue-like-data-table-view';
12
12
  import { InitialStateView } from './initial-state-view';
13
13
  export const MODAL_HEIGHT = 420;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Skeleton } from '@atlaskit/linking-common';
2
+ import { Skeleton } from '@atlaskit/linking-common/skeleton';
3
3
  export const AssetsAqlSearchInputSkeleton = () => /*#__PURE__*/React.createElement(Skeleton, {
4
4
  width: "100%",
5
5
  height: "40px",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Skeleton } from '@atlaskit/linking-common';
2
+ import { Skeleton } from '@atlaskit/linking-common/skeleton';
3
3
  export const AssetsObjectSchemaSelectSkeleton = () => /*#__PURE__*/React.createElement(Skeleton, {
4
4
  width: "100%",
5
5
  height: "40px",
@@ -4,7 +4,7 @@ import isEqual from 'lodash/isEqual';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { PopupSelect } from '@atlaskit/select/popup-select';
6
6
  import { useDatasourceAnalyticsEvents } from '../../../../analytics';
7
- import CustomControl from './control';
7
+ import { CustomControl } from './CustomControl';
8
8
  import { CustomCheckboxOption } from './custom-checkbox-option';
9
9
  import CustomDropdownIndicator from './dropdownIndicator';
10
10
  import PopupFooter from './footer';
@@ -38,7 +38,7 @@ import { DatasourceViewModeDropDown } from '../../common/modal/mode-switcher/Dat
38
38
  import { useViewModeContext } from '../../common/modal/mode-switcher/useViewModeContext';
39
39
  import TableSearchCount from '../../common/modal/search-count';
40
40
  import { SiteSelector } from '../../common/modal/site-selector';
41
- import { EmptyState } from '../../issue-like-table';
41
+ import EmptyState from '../../issue-like-table/empty-state';
42
42
  import ConfluenceSearchContainer from '../confluence-search-container';
43
43
  import { confluenceSearchModalMessages } from './messages';
44
44
  const styles = {
@@ -6,7 +6,7 @@ import * as React from 'react';
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
7
  /* eslint-disable @atlaskit/design-system/use-tokens-typography */
8
8
 
9
- import { Skeleton } from '@atlaskit/linking-common';
9
+ import { Skeleton } from '@atlaskit/linking-common/skeleton';
10
10
  const SkeletonComponent = ({
11
11
  width,
12
12
  itemName
@@ -13,7 +13,7 @@ import Button from '@atlaskit/button/default/button';
13
13
  import { FlagsProvider } from '@atlaskit/flag/flags-provider';
14
14
  import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
15
15
  import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
16
- import { Skeleton } from '@atlaskit/linking-common';
16
+ import { Skeleton } from '@atlaskit/linking-common/skeleton';
17
17
  import { fg } from '@atlaskit/platform-feature-flags/fg';
18
18
  import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/extract-closest-edge';
19
19
  import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
@@ -52,7 +52,7 @@ import { DatasourceViewModeDropDown } from '../../common/modal/mode-switcher/Dat
52
52
  import { useViewModeContext } from '../../common/modal/mode-switcher/useViewModeContext';
53
53
  import TableSearchCount from '../../common/modal/search-count';
54
54
  import { SiteSelector } from '../../common/modal/site-selector';
55
- import { EmptyState } from '../../issue-like-table';
55
+ import EmptyState from '../../issue-like-table/empty-state';
56
56
  import { availableBasicFilterTypes } from '../basic-filters/ui';
57
57
  import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
58
58
  import { JiraSearchContainer } from '../jira-search-container';
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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; }
4
4
  import { useCallback } from 'react';
5
5
  import { useCrossProductUrlWrapper } from '@atlaskit/analytics-cross-product/useCrossProductUrlWrapper';
6
- import { useSmartCardContext } from '@atlaskit/link-provider/context';
6
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
7
7
  import { functionWithFG } from '@atlaskit/platform-feature-flags-react/function-with-fg';
8
8
  var DATASOURCE_XPC_BRIDGE = 'linkDatasource';
9
9
  var XPC_QUERY_PARAM = 'xpis';
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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; }
4
4
  import { useCallback } from 'react';
5
5
  import { NetworkError } from '@atlaskit/linking-common';
6
- import { getTraceId } from '@atlaskit/linking-common/utils';
6
+ import { getTraceId } from '@atlaskit/linking-common/utils/get-trace-id';
7
7
  import { useDatasourceAnalyticsEvents } from '../analytics';
8
8
  import { logToSentry } from './logToSentry';
9
9
  var getNetworkFields = function getNetworkFields(error) {
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { useSmartCardContext } from '@atlaskit/link-provider';
2
+ import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
3
3
  export var useIsInPDFRender = function useIsInPDFRender() {
4
4
  var smartCardContext = useSmartCardContext();
5
5
  return useMemo(function () {
package/dist/esm/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  /** @deprecated Use @atlaskit/link-datasource/confluence-search-modal */
2
- export { default as ConfluenceSearchConfigModal } from './ui/confluence-search-modal';
2
+ export { ConfluenceSearchConfigModalWithWrappers as ConfluenceSearchConfigModal } from './ui/confluence-search-modal/ConfluenceSearchConfigModalWithWrappers';
3
3
 
4
4
  /** @deprecated Use @atlaskit/link-datasource/jira-issues-modal */
5
- export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
5
+ export { JiraIssuesConfigModalWithWrappers as JiraIssuesConfigModal } from './ui/jira-issues-modal/JiraIssuesConfigModalWithWrappers';
6
6
 
7
7
  /** @deprecated Use @atlaskit/link-datasource/assets-modal */
8
- export { default as AssetsConfigModal } from './ui/assets-modal';
8
+ export { AssetsConfigModalWithWrappers as AssetsConfigModal } from './ui/assets-modal/AssetsConfigModalWithWrappers';
9
9
 
10
10
  /** @deprecated Use @atlaskit/link-datasource/datasource-table-view */
11
- export { default as DatasourceTableView } from './ui/datasource-table-view';
11
+ export { DatasourceTableViewWithWrappers as DatasourceTableView } from './ui/datasource-table-view/DatasourceTableViewWithWrappers';
12
12
 
13
13
  /** @deprecated Use @atlaskit/link-datasource/assets-modal (AssetsConfigModal) */
14
- export { default as JSMAssetsConfigModal } from './ui/assets-modal';
14
+ export { AssetsConfigModalWithWrappers as JSMAssetsConfigModal } from './ui/assets-modal/AssetsConfigModalWithWrappers';
15
15
 
16
16
  /** @deprecated Use @atlaskit/link-datasource/utils/schema */
17
17
  export { buildDatasourceAdf } from './common/utils/schema-utils';
@@ -0,0 +1,8 @@
1
+ import { cache } from './getUnitsRolloutSettings';
2
+
3
+ /**
4
+ * Test-only: clear the cached units rollout settings so each test starts with a clean slate.
5
+ */
6
+ export var __clearUnitsRolloutSettingsCacheForTests = function __clearUnitsRolloutSettingsCacheForTests() {
7
+ cache.promise = undefined;
8
+ };
@@ -1,6 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { request } from '@atlaskit/linking-common';
3
+ import { request } from '@atlaskit/linking-common/api';
4
4
  import { FetchError } from './FetchError';
5
5
  import { PermissionError } from './PermissionError';
6
6
  import { getStatusCodeGroup } from './getStatusCodeGroup';
@@ -1,6 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { request } from '@atlaskit/linking-common';
3
+ import { request } from '@atlaskit/linking-common/api';
4
4
  import { FetchError } from './FetchError';
5
5
  import { PermissionError } from './PermissionError';
6
6
  import { getStatusCodeGroup } from './getStatusCodeGroup';