@atlaskit/link-datasource 4.23.7 → 4.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/services/getAvailableSites.js +57 -1
- package/dist/cjs/services/useAvailableSites.js +2 -1
- package/dist/cjs/ui/common/modal/popup-select/menu-list/selectMessage.js +2 -1
- package/dist/es2019/services/getAvailableSites.js +21 -0
- package/dist/es2019/services/useAvailableSites.js +3 -2
- package/dist/es2019/ui/common/modal/popup-select/menu-list/selectMessage.js +2 -1
- package/dist/esm/services/getAvailableSites.js +56 -0
- package/dist/esm/services/useAvailableSites.js +3 -2
- package/dist/esm/ui/common/modal/popup-select/menu-list/selectMessage.js +2 -1
- package/dist/types/services/getAvailableSites.d.ts +1 -0
- package/dist/types-ts4.5/services/getAvailableSites.d.ts +1 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 4.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d7522ef39f5e2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7522ef39f5e2) -
|
|
8
|
+
NAVX-1885 Setting SLLV filter empty/error states to have heading h2 instead of h4 for a11y
|
|
9
|
+
|
|
10
|
+
## 4.24.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`c5708bc569bf5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c5708bc569bf5) -
|
|
15
|
+
NAVX-1818 migrating SLLV site selector to use /v2/accessible-products endpoint instead of
|
|
16
|
+
/available-sites
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 4.23.7
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -4,9 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getAvailableSites = void 0;
|
|
7
|
+
exports.getAvailableSites = exports.getAccessibleProducts = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _hooks = require("@atlaskit/linking-common/hooks");
|
|
10
11
|
var getAvailableSites = exports.getAvailableSites = /*#__PURE__*/function () {
|
|
11
12
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(product) {
|
|
12
13
|
var requestConfig, response, res;
|
|
@@ -61,4 +62,59 @@ var getAvailableSites = exports.getAvailableSites = /*#__PURE__*/function () {
|
|
|
61
62
|
return function getAvailableSites(_x) {
|
|
62
63
|
return _ref.apply(this, arguments);
|
|
63
64
|
};
|
|
65
|
+
}();
|
|
66
|
+
var getAccessibleProducts = exports.getAccessibleProducts = /*#__PURE__*/function () {
|
|
67
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(product) {
|
|
68
|
+
var requestConfig, response, res;
|
|
69
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
70
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
requestConfig = {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
credentials: 'include',
|
|
75
|
+
headers: {
|
|
76
|
+
Accept: 'application/json',
|
|
77
|
+
'Cache-Control': 'no-cache',
|
|
78
|
+
'Content-Type': 'application/json'
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
_context2.next = 3;
|
|
85
|
+
return fetch("/gateway/api/v2/accessible-products", requestConfig);
|
|
86
|
+
case 3:
|
|
87
|
+
response = _context2.sent;
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
_context2.next = 9;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
_context2.next = 7;
|
|
93
|
+
return response.json();
|
|
94
|
+
case 7:
|
|
95
|
+
res = _context2.sent;
|
|
96
|
+
return _context2.abrupt("return", (0, _hooks.mapAccessibleProductsToAvailableSites)(res));
|
|
97
|
+
case 9:
|
|
98
|
+
_context2.t0 = Error;
|
|
99
|
+
_context2.next = 12;
|
|
100
|
+
return response.text();
|
|
101
|
+
case 12:
|
|
102
|
+
_context2.t1 = _context2.sent;
|
|
103
|
+
if (_context2.t1) {
|
|
104
|
+
_context2.next = 15;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
_context2.t1 = 'Something went wrong';
|
|
108
|
+
case 15:
|
|
109
|
+
_context2.t2 = _context2.t1;
|
|
110
|
+
throw new _context2.t0(_context2.t2);
|
|
111
|
+
case 17:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context2.stop();
|
|
114
|
+
}
|
|
115
|
+
}, _callee2);
|
|
116
|
+
}));
|
|
117
|
+
return function getAccessibleProducts(_x2) {
|
|
118
|
+
return _ref2.apply(this, arguments);
|
|
119
|
+
};
|
|
64
120
|
}();
|
|
@@ -10,6 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = require("react");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _getAvailableSites = require("./getAvailableSites");
|
|
14
15
|
var useAvailableSites = exports.useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
15
16
|
var _useState = (0, _react.useState)(undefined),
|
|
@@ -24,7 +25,7 @@ var useAvailableSites = exports.useAvailableSites = function useAvailableSites(p
|
|
|
24
25
|
while (1) switch (_context.prev = _context.next) {
|
|
25
26
|
case 0:
|
|
26
27
|
_context.next = 2;
|
|
27
|
-
return (0, _getAvailableSites.getAvailableSites)(product);
|
|
28
|
+
return (0, _platformFeatureFlags.fg)('navx-1819-link-create-confluence-site-migration') ? (0, _getAvailableSites.getAccessibleProducts)(product) : (0, _getAvailableSites.getAvailableSites)(product);
|
|
28
29
|
case 2:
|
|
29
30
|
sites = _context.sent;
|
|
30
31
|
sortedAvailableSites = (0, _toConsumableArray2.default)(sites).sort(function (a, b) {
|
|
@@ -30,7 +30,8 @@ var CustomSelectMessage = function CustomSelectMessage(_ref) {
|
|
|
30
30
|
alignItems: "center",
|
|
31
31
|
justifyContent: "center"
|
|
32
32
|
}, icon), /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
33
|
-
size: "small"
|
|
33
|
+
size: "small",
|
|
34
|
+
as: "h2"
|
|
34
35
|
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message)), description && /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
35
36
|
size: "medium"
|
|
36
37
|
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, description)));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/hooks';
|
|
1
2
|
export const getAvailableSites = async product => {
|
|
2
3
|
const requestConfig = {
|
|
3
4
|
method: 'POST',
|
|
@@ -17,4 +18,24 @@ export const getAvailableSites = async product => {
|
|
|
17
18
|
return res.sites;
|
|
18
19
|
}
|
|
19
20
|
throw new Error((await response.text()) || 'Something went wrong');
|
|
21
|
+
};
|
|
22
|
+
export const getAccessibleProducts = async product => {
|
|
23
|
+
const requestConfig = {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
credentials: 'include',
|
|
26
|
+
headers: {
|
|
27
|
+
Accept: 'application/json',
|
|
28
|
+
'Cache-Control': 'no-cache',
|
|
29
|
+
'Content-Type': 'application/json'
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify({
|
|
32
|
+
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
const response = await fetch(`/gateway/api/v2/accessible-products`, requestConfig);
|
|
36
|
+
if (response.ok) {
|
|
37
|
+
const res = await response.json();
|
|
38
|
+
return mapAccessibleProductsToAvailableSites(res);
|
|
39
|
+
}
|
|
40
|
+
throw new Error((await response.text()) || 'Something went wrong');
|
|
20
41
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { getAccessibleProducts, getAvailableSites } from './getAvailableSites';
|
|
3
4
|
export const useAvailableSites = (product, cloudId) => {
|
|
4
5
|
const [availableSites, setAvailableSites] = useState(undefined);
|
|
5
6
|
useEffect(() => {
|
|
6
7
|
const fetchSiteDisplayNames = async () => {
|
|
7
|
-
const sites = await getAvailableSites(product);
|
|
8
|
+
const sites = await (fg('navx-1819-link-create-confluence-site-migration') ? getAccessibleProducts(product) : getAvailableSites(product));
|
|
8
9
|
const sortedAvailableSites = [...sites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
9
10
|
setAvailableSites(sortedAvailableSites);
|
|
10
11
|
};
|
|
@@ -24,7 +24,8 @@ const CustomSelectMessage = ({
|
|
|
24
24
|
alignItems: "center",
|
|
25
25
|
justifyContent: "center"
|
|
26
26
|
}, icon), /*#__PURE__*/React.createElement(Heading, {
|
|
27
|
-
size: "small"
|
|
27
|
+
size: "small",
|
|
28
|
+
as: "h2"
|
|
28
29
|
}, /*#__PURE__*/React.createElement(FormattedMessage, message)), description && /*#__PURE__*/React.createElement(Text, {
|
|
29
30
|
size: "medium"
|
|
30
31
|
}, /*#__PURE__*/React.createElement(FormattedMessage, description)));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/hooks';
|
|
3
4
|
export var getAvailableSites = /*#__PURE__*/function () {
|
|
4
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(product) {
|
|
5
6
|
var requestConfig, response, res;
|
|
@@ -54,4 +55,59 @@ export var getAvailableSites = /*#__PURE__*/function () {
|
|
|
54
55
|
return function getAvailableSites(_x) {
|
|
55
56
|
return _ref.apply(this, arguments);
|
|
56
57
|
};
|
|
58
|
+
}();
|
|
59
|
+
export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
60
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(product) {
|
|
61
|
+
var requestConfig, response, res;
|
|
62
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
63
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
requestConfig = {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
credentials: 'include',
|
|
68
|
+
headers: {
|
|
69
|
+
Accept: 'application/json',
|
|
70
|
+
'Cache-Control': 'no-cache',
|
|
71
|
+
'Content-Type': 'application/json'
|
|
72
|
+
},
|
|
73
|
+
body: JSON.stringify({
|
|
74
|
+
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
_context2.next = 3;
|
|
78
|
+
return fetch("/gateway/api/v2/accessible-products", requestConfig);
|
|
79
|
+
case 3:
|
|
80
|
+
response = _context2.sent;
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
_context2.next = 9;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
_context2.next = 7;
|
|
86
|
+
return response.json();
|
|
87
|
+
case 7:
|
|
88
|
+
res = _context2.sent;
|
|
89
|
+
return _context2.abrupt("return", mapAccessibleProductsToAvailableSites(res));
|
|
90
|
+
case 9:
|
|
91
|
+
_context2.t0 = Error;
|
|
92
|
+
_context2.next = 12;
|
|
93
|
+
return response.text();
|
|
94
|
+
case 12:
|
|
95
|
+
_context2.t1 = _context2.sent;
|
|
96
|
+
if (_context2.t1) {
|
|
97
|
+
_context2.next = 15;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
_context2.t1 = 'Something went wrong';
|
|
101
|
+
case 15:
|
|
102
|
+
_context2.t2 = _context2.t1;
|
|
103
|
+
throw new _context2.t0(_context2.t2);
|
|
104
|
+
case 17:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context2.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee2);
|
|
109
|
+
}));
|
|
110
|
+
return function getAccessibleProducts(_x2) {
|
|
111
|
+
return _ref2.apply(this, arguments);
|
|
112
|
+
};
|
|
57
113
|
}();
|
|
@@ -3,7 +3,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { getAccessibleProducts, getAvailableSites } from './getAvailableSites';
|
|
7
8
|
export var useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
8
9
|
var _useState = useState(undefined),
|
|
9
10
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -17,7 +18,7 @@ export var useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
|
17
18
|
while (1) switch (_context.prev = _context.next) {
|
|
18
19
|
case 0:
|
|
19
20
|
_context.next = 2;
|
|
20
|
-
return getAvailableSites(product);
|
|
21
|
+
return fg('navx-1819-link-create-confluence-site-migration') ? getAccessibleProducts(product) : getAvailableSites(product);
|
|
21
22
|
case 2:
|
|
22
23
|
sites = _context.sent;
|
|
23
24
|
sortedAvailableSites = _toConsumableArray(sites).sort(function (a, b) {
|
|
@@ -23,7 +23,8 @@ var CustomSelectMessage = function CustomSelectMessage(_ref) {
|
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
justifyContent: "center"
|
|
25
25
|
}, icon), /*#__PURE__*/React.createElement(Heading, {
|
|
26
|
-
size: "small"
|
|
26
|
+
size: "small",
|
|
27
|
+
as: "h2"
|
|
27
28
|
}, /*#__PURE__*/React.createElement(FormattedMessage, message)), description && /*#__PURE__*/React.createElement(Text, {
|
|
28
29
|
size: "medium"
|
|
29
30
|
}, /*#__PURE__*/React.createElement(FormattedMessage, description)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@atlaskit/layering": "^3.0.0",
|
|
65
65
|
"@atlaskit/link": "^3.2.0",
|
|
66
66
|
"@atlaskit/link-client-extension": "^6.0.0",
|
|
67
|
-
"@atlaskit/linking-common": "^9.
|
|
67
|
+
"@atlaskit/linking-common": "^9.7.0",
|
|
68
68
|
"@atlaskit/linking-types": "^14.0.0",
|
|
69
69
|
"@atlaskit/logo": "^19.7.0",
|
|
70
70
|
"@atlaskit/lozenge": "^13.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@atlaskit/primitives": "^14.15.0",
|
|
80
80
|
"@atlaskit/react-select": "^3.6.0",
|
|
81
81
|
"@atlaskit/select": "^21.3.0",
|
|
82
|
-
"@atlaskit/smart-card": "^42.
|
|
82
|
+
"@atlaskit/smart-card": "^42.1.0",
|
|
83
83
|
"@atlaskit/smart-user-picker": "^8.2.0",
|
|
84
84
|
"@atlaskit/spinner": "^19.0.0",
|
|
85
85
|
"@atlaskit/tag": "^14.1.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@af/visual-regression": "workspace:^",
|
|
109
109
|
"@atlaskit/json-ld-types": "^1.4.0",
|
|
110
110
|
"@atlaskit/link-provider": "^4.0.0",
|
|
111
|
-
"@atlaskit/link-test-helpers": "^8.
|
|
111
|
+
"@atlaskit/link-test-helpers": "^8.4.0",
|
|
112
112
|
"@atlaskit/ssr": "workspace:^",
|
|
113
113
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
114
114
|
"@faker-js/faker": "^7.5.0",
|
|
@@ -187,6 +187,9 @@
|
|
|
187
187
|
},
|
|
188
188
|
"navx-1241-sllv-filters-add-tooltip-to-options": {
|
|
189
189
|
"type": "boolean"
|
|
190
|
+
},
|
|
191
|
+
"navx-1819-link-create-confluence-site-migration": {
|
|
192
|
+
"type": "boolean"
|
|
190
193
|
}
|
|
191
194
|
},
|
|
192
195
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/9c893299-a527-4457-9b46-f3bc4c828766"
|