@atlaskit/link-datasource 4.30.5 → 4.30.6
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 +8 -0
- package/dist/cjs/services/getAvailableSites.js +6 -61
- package/dist/cjs/services/useAvailableSites.js +1 -2
- package/dist/es2019/services/getAvailableSites.js +0 -20
- package/dist/es2019/services/useAvailableSites.js +2 -3
- package/dist/esm/services/getAvailableSites.js +5 -60
- package/dist/esm/services/useAvailableSites.js +2 -3
- package/dist/types/services/getAvailableSites.d.ts +0 -1
- package/dist/types-ts4.5/services/getAvailableSites.d.ts +0 -1
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 4.30.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`37aa215f58706`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/37aa215f58706) -
|
|
8
|
+
NAVX-1904 cleaning up navx-1819-link-create-confluence-site-migration
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 4.30.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4,11 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.getAccessibleProducts = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _hooks = require("@atlaskit/linking-common/hooks");
|
|
11
|
-
var
|
|
11
|
+
var getAccessibleProducts = exports.getAccessibleProducts = /*#__PURE__*/function () {
|
|
12
12
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(product) {
|
|
13
13
|
var requestConfig, response, res;
|
|
14
14
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -23,11 +23,11 @@ var getAvailableSites = exports.getAvailableSites = /*#__PURE__*/function () {
|
|
|
23
23
|
'Content-Type': 'application/json'
|
|
24
24
|
},
|
|
25
25
|
body: JSON.stringify({
|
|
26
|
-
|
|
26
|
+
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
27
27
|
})
|
|
28
28
|
};
|
|
29
29
|
_context.next = 3;
|
|
30
|
-
return fetch("/gateway/api/
|
|
30
|
+
return fetch("/gateway/api/v2/accessible-products", requestConfig);
|
|
31
31
|
case 3:
|
|
32
32
|
response = _context.sent;
|
|
33
33
|
if (!response.ok) {
|
|
@@ -38,7 +38,7 @@ var getAvailableSites = exports.getAvailableSites = /*#__PURE__*/function () {
|
|
|
38
38
|
return response.json();
|
|
39
39
|
case 7:
|
|
40
40
|
res = _context.sent;
|
|
41
|
-
return _context.abrupt("return", res.
|
|
41
|
+
return _context.abrupt("return", (0, _hooks.mapAccessibleProductsToAvailableSites)(res.data));
|
|
42
42
|
case 9:
|
|
43
43
|
_context.t0 = Error;
|
|
44
44
|
_context.next = 12;
|
|
@@ -59,62 +59,7 @@ var getAvailableSites = exports.getAvailableSites = /*#__PURE__*/function () {
|
|
|
59
59
|
}
|
|
60
60
|
}, _callee);
|
|
61
61
|
}));
|
|
62
|
-
return function
|
|
62
|
+
return function getAccessibleProducts(_x) {
|
|
63
63
|
return _ref.apply(this, arguments);
|
|
64
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.data));
|
|
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
|
-
};
|
|
120
65
|
}();
|
|
@@ -10,7 +10,6 @@ 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");
|
|
14
13
|
var _getAvailableSites = require("./getAvailableSites");
|
|
15
14
|
var useAvailableSites = exports.useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
16
15
|
var _useState = (0, _react.useState)(undefined),
|
|
@@ -25,7 +24,7 @@ var useAvailableSites = exports.useAvailableSites = function useAvailableSites(p
|
|
|
25
24
|
while (1) switch (_context.prev = _context.next) {
|
|
26
25
|
case 0:
|
|
27
26
|
_context.next = 2;
|
|
28
|
-
return (0,
|
|
27
|
+
return (0, _getAvailableSites.getAccessibleProducts)(product);
|
|
29
28
|
case 2:
|
|
30
29
|
sites = _context.sent;
|
|
31
30
|
sortedAvailableSites = (0, _toConsumableArray2.default)(sites).sort(function (a, b) {
|
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/hooks';
|
|
2
|
-
export const getAvailableSites = async product => {
|
|
3
|
-
const requestConfig = {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
credentials: 'include',
|
|
6
|
-
headers: {
|
|
7
|
-
Accept: 'application/json',
|
|
8
|
-
'Cache-Control': 'no-cache',
|
|
9
|
-
'Content-Type': 'application/json'
|
|
10
|
-
},
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
products: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
13
|
-
})
|
|
14
|
-
};
|
|
15
|
-
const response = await fetch(`/gateway/api/available-sites`, requestConfig);
|
|
16
|
-
if (response.ok) {
|
|
17
|
-
const res = await response.json();
|
|
18
|
-
return res.sites;
|
|
19
|
-
}
|
|
20
|
-
throw new Error((await response.text()) || 'Something went wrong');
|
|
21
|
-
};
|
|
22
2
|
export const getAccessibleProducts = async product => {
|
|
23
3
|
const requestConfig = {
|
|
24
4
|
method: 'POST',
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { getAccessibleProducts, getAvailableSites } from './getAvailableSites';
|
|
2
|
+
import { getAccessibleProducts } from './getAvailableSites';
|
|
4
3
|
export const useAvailableSites = (product, cloudId) => {
|
|
5
4
|
const [availableSites, setAvailableSites] = useState(undefined);
|
|
6
5
|
useEffect(() => {
|
|
7
6
|
const fetchSiteDisplayNames = async () => {
|
|
8
|
-
const sites = await
|
|
7
|
+
const sites = await getAccessibleProducts(product);
|
|
9
8
|
const sortedAvailableSites = [...sites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
10
9
|
setAvailableSites(sortedAvailableSites);
|
|
11
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export var
|
|
4
|
+
export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
5
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(product) {
|
|
6
6
|
var requestConfig, response, res;
|
|
7
7
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -16,11 +16,11 @@ export var getAvailableSites = /*#__PURE__*/function () {
|
|
|
16
16
|
'Content-Type': 'application/json'
|
|
17
17
|
},
|
|
18
18
|
body: JSON.stringify({
|
|
19
|
-
|
|
19
|
+
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
20
20
|
})
|
|
21
21
|
};
|
|
22
22
|
_context.next = 3;
|
|
23
|
-
return fetch("/gateway/api/
|
|
23
|
+
return fetch("/gateway/api/v2/accessible-products", requestConfig);
|
|
24
24
|
case 3:
|
|
25
25
|
response = _context.sent;
|
|
26
26
|
if (!response.ok) {
|
|
@@ -31,7 +31,7 @@ export var getAvailableSites = /*#__PURE__*/function () {
|
|
|
31
31
|
return response.json();
|
|
32
32
|
case 7:
|
|
33
33
|
res = _context.sent;
|
|
34
|
-
return _context.abrupt("return", res.
|
|
34
|
+
return _context.abrupt("return", mapAccessibleProductsToAvailableSites(res.data));
|
|
35
35
|
case 9:
|
|
36
36
|
_context.t0 = Error;
|
|
37
37
|
_context.next = 12;
|
|
@@ -52,62 +52,7 @@ export var getAvailableSites = /*#__PURE__*/function () {
|
|
|
52
52
|
}
|
|
53
53
|
}, _callee);
|
|
54
54
|
}));
|
|
55
|
-
return function
|
|
55
|
+
return function getAccessibleProducts(_x) {
|
|
56
56
|
return _ref.apply(this, arguments);
|
|
57
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.data));
|
|
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
|
-
};
|
|
113
58
|
}();
|
|
@@ -3,8 +3,7 @@ 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 {
|
|
7
|
-
import { getAccessibleProducts, getAvailableSites } from './getAvailableSites';
|
|
6
|
+
import { getAccessibleProducts } from './getAvailableSites';
|
|
8
7
|
export var useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
9
8
|
var _useState = useState(undefined),
|
|
10
9
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -18,7 +17,7 @@ export var useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
|
18
17
|
while (1) switch (_context.prev = _context.next) {
|
|
19
18
|
case 0:
|
|
20
19
|
_context.next = 2;
|
|
21
|
-
return
|
|
20
|
+
return getAccessibleProducts(product);
|
|
22
21
|
case 2:
|
|
23
22
|
sites = _context.sent;
|
|
24
23
|
sortedAvailableSites = _toConsumableArray(sites).sort(function (a, b) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "4.30.
|
|
3
|
+
"version": "4.30.6",
|
|
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.4.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.9.0",
|
|
68
68
|
"@atlaskit/linking-types": "^14.2.0",
|
|
69
69
|
"@atlaskit/logo": "^19.9.0",
|
|
70
70
|
"@atlaskit/lozenge": "^13.1.0",
|
|
@@ -76,16 +76,16 @@
|
|
|
76
76
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
77
77
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^2.0.0",
|
|
78
78
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
79
|
-
"@atlaskit/primitives": "^16.
|
|
79
|
+
"@atlaskit/primitives": "^16.4.0",
|
|
80
80
|
"@atlaskit/react-select": "^3.9.0",
|
|
81
81
|
"@atlaskit/select": "^21.4.0",
|
|
82
|
-
"@atlaskit/smart-card": "^43.
|
|
82
|
+
"@atlaskit/smart-card": "^43.11.0",
|
|
83
83
|
"@atlaskit/smart-user-picker": "^8.4.0",
|
|
84
84
|
"@atlaskit/spinner": "^19.0.0",
|
|
85
85
|
"@atlaskit/tag": "^14.1.0",
|
|
86
86
|
"@atlaskit/textfield": "^8.1.0",
|
|
87
87
|
"@atlaskit/theme": "^21.0.0",
|
|
88
|
-
"@atlaskit/tokens": "^8.
|
|
88
|
+
"@atlaskit/tokens": "^8.4.0",
|
|
89
89
|
"@atlaskit/tooltip": "^20.10.0",
|
|
90
90
|
"@atlaskit/ufo": "^0.4.0",
|
|
91
91
|
"@atlaskit/width-detector": "^5.0.0",
|
|
@@ -179,9 +179,6 @@
|
|
|
179
179
|
"navx-1334-datasource-deep-compare-params": {
|
|
180
180
|
"type": "boolean"
|
|
181
181
|
},
|
|
182
|
-
"navx-1819-link-create-confluence-site-migration": {
|
|
183
|
-
"type": "boolean"
|
|
184
|
-
},
|
|
185
182
|
"navx-1895-new-logo-design": {
|
|
186
183
|
"type": "boolean"
|
|
187
184
|
},
|