@atlaskit/link-datasource 6.13.0 → 6.13.2

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 (72) hide show
  1. package/CHANGELOG.md +23 -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/search-container/aql-search-input/loading-state.js +2 -2
  17. package/dist/cjs/ui/assets-modal/search-container/object-schema-select/loading-state.js +2 -2
  18. package/dist/cjs/ui/common/modal/popup-select/index.js +2 -2
  19. package/dist/cjs/ui/issue-like-table/empty-state/index.js +3 -3
  20. package/dist/cjs/ui/issue-like-table/issue-like-data-table-view.js +2 -2
  21. package/dist/es2019/analytics/xpc/useDatasourceCrossProductAttribution.js +1 -1
  22. package/dist/es2019/hooks/useErrorLogger.js +1 -1
  23. package/dist/es2019/hooks/useIsInPDFRender.js +1 -1
  24. package/dist/es2019/index.js +5 -5
  25. package/dist/es2019/services/__clearUnitsRolloutSettingsCacheForTests.js +8 -0
  26. package/dist/es2019/services/fetchObjectSchema.js +1 -1
  27. package/dist/es2019/services/fetchObjectSchemas.js +1 -1
  28. package/dist/es2019/services/getAvailableSites.js +2 -2
  29. package/dist/es2019/services/getUnitsRolloutSettings.js +112 -0
  30. package/dist/es2019/services/getWorkspaceId.js +1 -1
  31. package/dist/es2019/services/isUnitsIsolationEnabled.js +34 -0
  32. package/dist/es2019/services/resolvePrimaryWorkspace.js +1 -1
  33. package/dist/es2019/services/useBasicFilterAGG.js +1 -1
  34. package/dist/es2019/services/validateAql.js +1 -1
  35. package/dist/es2019/ui/assets-modal/search-container/aql-search-input/loading-state.js +1 -1
  36. package/dist/es2019/ui/assets-modal/search-container/object-schema-select/loading-state.js +1 -1
  37. package/dist/es2019/ui/common/modal/popup-select/index.js +1 -1
  38. package/dist/es2019/ui/issue-like-table/empty-state/index.js +1 -1
  39. package/dist/es2019/ui/issue-like-table/issue-like-data-table-view.js +1 -1
  40. package/dist/esm/analytics/xpc/useDatasourceCrossProductAttribution.js +1 -1
  41. package/dist/esm/hooks/useErrorLogger.js +1 -1
  42. package/dist/esm/hooks/useIsInPDFRender.js +1 -1
  43. package/dist/esm/index.js +5 -5
  44. package/dist/esm/services/__clearUnitsRolloutSettingsCacheForTests.js +8 -0
  45. package/dist/esm/services/fetchObjectSchema.js +1 -1
  46. package/dist/esm/services/fetchObjectSchemas.js +1 -1
  47. package/dist/esm/services/getAvailableSites.js +32 -19
  48. package/dist/esm/services/getUnitsRolloutSettings.js +192 -0
  49. package/dist/esm/services/getWorkspaceId.js +1 -1
  50. package/dist/esm/services/isUnitsIsolationEnabled.js +57 -0
  51. package/dist/esm/services/resolvePrimaryWorkspace.js +1 -1
  52. package/dist/esm/services/useBasicFilterAGG.js +1 -1
  53. package/dist/esm/services/validateAql.js +1 -1
  54. package/dist/esm/ui/assets-modal/search-container/aql-search-input/loading-state.js +1 -1
  55. package/dist/esm/ui/assets-modal/search-container/object-schema-select/loading-state.js +1 -1
  56. package/dist/esm/ui/common/modal/popup-select/index.js +1 -1
  57. package/dist/esm/ui/issue-like-table/empty-state/index.js +1 -1
  58. package/dist/esm/ui/issue-like-table/issue-like-data-table-view.js +1 -1
  59. package/dist/types/common/utils/locale/fetch-messages-for-locale.d.ts +1 -1
  60. package/dist/types/index.d.ts +5 -5
  61. package/dist/types/services/__clearUnitsRolloutSettingsCacheForTests.d.ts +4 -0
  62. package/dist/types/services/getUnitsRolloutSettings.d.ts +29 -0
  63. package/dist/types/services/isUnitsIsolationEnabled.d.ts +15 -0
  64. package/dist/types/ui/common/modal/datasource-context/DatasourceContextProviderProps.d.ts +1 -1
  65. package/dist/types/ui/common/modal/datasource-modal/createDatasourceModal.d.ts +1 -1
  66. package/examples-helpers/buildAssetsIssuesTable.tsx +1 -1
  67. package/examples-helpers/buildConfluenceSearchTable.tsx +2 -2
  68. package/examples-helpers/buildIssueLikeTable.tsx +1 -1
  69. package/examples-helpers/buildIssueLikeTableLoadingError.tsx +1 -1
  70. package/examples-helpers/buildJiraIssuesTable.tsx +3 -2
  71. package/examples-helpers/smartLinkCustomClient.ts +1 -1
  72. package/package.json +12 -5
@@ -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
@@ -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,
@@ -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';
@@ -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';
@@ -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';
@@ -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';
@@ -1,10 +1,10 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/hooks';
4
- import { fg } from '@atlaskit/platform-feature-flags/fg';
4
+ import { isUnitsIsolationEnabled } from './isUnitsIsolationEnabled';
5
5
  export var getAccessibleProducts = /*#__PURE__*/function () {
6
6
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(product) {
7
- var requestConfig, endpoint, response, res, _t, _t2, _t3;
7
+ var requestConfig, endpoint, response, res, _t, _t2, _t3, _t4;
8
8
  return _regeneratorRuntime.wrap(function (_context) {
9
9
  while (1) switch (_context.prev = _context.next) {
10
10
  case 0:
@@ -20,35 +20,48 @@ export var getAccessibleProducts = /*#__PURE__*/function () {
20
20
  productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
21
21
  })
22
22
  };
23
- endpoint = fg('linking_platform_link_datasource_unit_compliant') ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
24
23
  _context.next = 1;
25
- return fetch(endpoint, requestConfig);
24
+ return isUnitsIsolationEnabled();
26
25
  case 1:
27
- response = _context.sent;
28
- if (!response.ok) {
29
- _context.next = 3;
26
+ if (!_context.sent) {
27
+ _context.next = 2;
30
28
  break;
31
29
  }
32
- _context.next = 2;
33
- return response.json();
30
+ _t = '/gateway/api/experimental/v2/accessible-products';
31
+ _context.next = 3;
32
+ break;
34
33
  case 2:
35
- res = _context.sent;
36
- return _context.abrupt("return", mapAccessibleProductsToAvailableSites(res.data));
34
+ _t = '/gateway/api/v2/accessible-products';
37
35
  case 3:
38
- _t = Error;
36
+ endpoint = _t;
39
37
  _context.next = 4;
40
- return response.text();
38
+ return fetch(endpoint, requestConfig);
41
39
  case 4:
42
- _t2 = _context.sent;
43
- if (_t2) {
44
- _context.next = 5;
40
+ response = _context.sent;
41
+ if (!response.ok) {
42
+ _context.next = 6;
45
43
  break;
46
44
  }
47
- _t2 = 'Something went wrong';
45
+ _context.next = 5;
46
+ return response.json();
48
47
  case 5:
49
- _t3 = _t2;
50
- throw new _t(_t3);
48
+ res = _context.sent;
49
+ return _context.abrupt("return", mapAccessibleProductsToAvailableSites(res.data));
51
50
  case 6:
51
+ _t2 = Error;
52
+ _context.next = 7;
53
+ return response.text();
54
+ case 7:
55
+ _t3 = _context.sent;
56
+ if (_t3) {
57
+ _context.next = 8;
58
+ break;
59
+ }
60
+ _t3 = 'Something went wrong';
61
+ case 8:
62
+ _t4 = _t3;
63
+ throw new _t2(_t4);
64
+ case 9:
52
65
  case "end":
53
66
  return _context.stop();
54
67
  }