@atlaskit/smart-card 27.0.0 → 27.1.0
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/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +25 -57
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -20
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -7
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +6 -8
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +9 -10
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +1 -3
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +1 -3
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +1 -6
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +6 -34
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +5 -7
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +7 -8
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +0 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +0 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +1 -8
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +24 -57
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +6 -8
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +9 -10
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +1 -3
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +1 -3
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +1 -6
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +7 -5
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +3 -8
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +0 -1
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +3 -5
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +5 -6
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +1 -3
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +1 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +7 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +3 -8
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +0 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +3 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +5 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +1 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +1 -3
- package/package.json +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -138
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -51
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -131
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +0 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +0 -3
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getAutomationStackFromLocalStorage = exports.getAutomationStack = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var AUTOMATION_LOCAL_STORAGE_PREFIX = 'automationPlatform';
|
|
12
|
-
var AUTOMATION_LOCAL_STORAGE_STACK = 'automationStack';
|
|
13
|
-
var AUTOMATION_DEV_STACK_URL = 'https://localhost:8082/devStack.json';
|
|
14
|
-
var getAutomationProdStackUrl = function getAutomationProdStackUrl(cloudId) {
|
|
15
|
-
return "/gateway/api/automation/internal-api/jira/".concat(cloudId, "/pro/rest/environments");
|
|
16
|
-
};
|
|
17
|
-
var getLatestPreProdStack = /*#__PURE__*/function () {
|
|
18
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cloudId) {
|
|
19
|
-
var response, stacksResponse, preProdStacks, _preProdStacks, _preProdStacks$, latestPreProdStack;
|
|
20
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
|
-
while (1) switch (_context.prev = _context.next) {
|
|
22
|
-
case 0:
|
|
23
|
-
_context.prev = 0;
|
|
24
|
-
_context.next = 3;
|
|
25
|
-
return fetch(getAutomationProdStackUrl(cloudId));
|
|
26
|
-
case 3:
|
|
27
|
-
response = _context.sent;
|
|
28
|
-
_context.next = 6;
|
|
29
|
-
return response.json();
|
|
30
|
-
case 6:
|
|
31
|
-
stacksResponse = _context.sent;
|
|
32
|
-
preProdStacks = stacksResponse.prod.otherStacks.filter(function (_ref2) {
|
|
33
|
-
var releasedSuccessfully = _ref2.releasedSuccessfully;
|
|
34
|
-
return !releasedSuccessfully;
|
|
35
|
-
}).map(function (_ref3) {
|
|
36
|
-
var stack = _ref3.stack;
|
|
37
|
-
return stack;
|
|
38
|
-
});
|
|
39
|
-
_preProdStacks = (0, _slicedToArray2.default)(preProdStacks, 1), _preProdStacks$ = _preProdStacks[0], latestPreProdStack = _preProdStacks$ === void 0 ? null : _preProdStacks$;
|
|
40
|
-
return _context.abrupt("return", latestPreProdStack);
|
|
41
|
-
case 12:
|
|
42
|
-
_context.prev = 12;
|
|
43
|
-
_context.t0 = _context["catch"](0);
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
|
-
console.warn("Failed to fetch pre-prod stack from ".concat(getAutomationProdStackUrl(cloudId), " with error: ").concat(_context.t0));
|
|
46
|
-
return _context.abrupt("return", null);
|
|
47
|
-
case 16:
|
|
48
|
-
case "end":
|
|
49
|
-
return _context.stop();
|
|
50
|
-
}
|
|
51
|
-
}, _callee, null, [[0, 12]]);
|
|
52
|
-
}));
|
|
53
|
-
return function getLatestPreProdStack(_x) {
|
|
54
|
-
return _ref.apply(this, arguments);
|
|
55
|
-
};
|
|
56
|
-
}();
|
|
57
|
-
var _getAutomationKeyFromLocalStorage = function _getAutomationKeyFromLocalStorage(key) {
|
|
58
|
-
return window.localStorage.getItem("".concat(AUTOMATION_LOCAL_STORAGE_PREFIX, ":").concat(key));
|
|
59
|
-
};
|
|
60
|
-
var getAutomationDevStackFromLocalServer = /*#__PURE__*/function () {
|
|
61
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
62
|
-
var devStackResponse, devStack;
|
|
63
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
64
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
_context2.prev = 0;
|
|
67
|
-
_context2.next = 3;
|
|
68
|
-
return fetch(AUTOMATION_DEV_STACK_URL);
|
|
69
|
-
case 3:
|
|
70
|
-
devStackResponse = _context2.sent;
|
|
71
|
-
_context2.next = 6;
|
|
72
|
-
return devStackResponse.json();
|
|
73
|
-
case 6:
|
|
74
|
-
devStack = _context2.sent;
|
|
75
|
-
return _context2.abrupt("return", devStack.name);
|
|
76
|
-
case 10:
|
|
77
|
-
_context2.prev = 10;
|
|
78
|
-
_context2.t0 = _context2["catch"](0);
|
|
79
|
-
// eslint-disable-next-line no-console
|
|
80
|
-
console.warn("Failed to fetch dev stack from ".concat(AUTOMATION_DEV_STACK_URL, " with error: ").concat(_context2.t0));
|
|
81
|
-
return _context2.abrupt("return", null);
|
|
82
|
-
case 14:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context2.stop();
|
|
85
|
-
}
|
|
86
|
-
}, _callee2, null, [[0, 10]]);
|
|
87
|
-
}));
|
|
88
|
-
return function getAutomationDevStackFromLocalServer() {
|
|
89
|
-
return _ref4.apply(this, arguments);
|
|
90
|
-
};
|
|
91
|
-
}();
|
|
92
|
-
var getAutomationStackFromLocalStorage = exports.getAutomationStackFromLocalStorage = function getAutomationStackFromLocalStorage() {
|
|
93
|
-
return _getAutomationKeyFromLocalStorage(AUTOMATION_LOCAL_STORAGE_STACK);
|
|
94
|
-
};
|
|
95
|
-
var getAutomationStack = exports.getAutomationStack = /*#__PURE__*/function () {
|
|
96
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(env, cloudId) {
|
|
97
|
-
var stack, stackOverride;
|
|
98
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
99
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
100
|
-
case 0:
|
|
101
|
-
if (!(env === 'prod')) {
|
|
102
|
-
_context3.next = 2;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
return _context3.abrupt("return", 'pro');
|
|
106
|
-
case 2:
|
|
107
|
-
if (!(env === 'pre-prod')) {
|
|
108
|
-
_context3.next = 7;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
_context3.next = 5;
|
|
112
|
-
return getLatestPreProdStack(cloudId);
|
|
113
|
-
case 5:
|
|
114
|
-
stack = _context3.sent;
|
|
115
|
-
return _context3.abrupt("return", stack !== null && stack !== void 0 ? stack : 'pro');
|
|
116
|
-
case 7:
|
|
117
|
-
_context3.next = 9;
|
|
118
|
-
return getAutomationDevStackFromLocalServer();
|
|
119
|
-
case 9:
|
|
120
|
-
_context3.t0 = _context3.sent;
|
|
121
|
-
if (_context3.t0) {
|
|
122
|
-
_context3.next = 12;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
_context3.t0 = getAutomationStackFromLocalStorage();
|
|
126
|
-
case 12:
|
|
127
|
-
stackOverride = _context3.t0;
|
|
128
|
-
return _context3.abrupt("return", stackOverride || 'staging');
|
|
129
|
-
case 14:
|
|
130
|
-
case "end":
|
|
131
|
-
return _context3.stop();
|
|
132
|
-
}
|
|
133
|
-
}, _callee3);
|
|
134
|
-
}));
|
|
135
|
-
return function getAutomationStack(_x2, _x3) {
|
|
136
|
-
return _ref5.apply(this, arguments);
|
|
137
|
-
};
|
|
138
|
-
}();
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const AUTOMATION_LOCAL_STORAGE_PREFIX = 'automationPlatform';
|
|
2
|
-
const AUTOMATION_LOCAL_STORAGE_STACK = 'automationStack';
|
|
3
|
-
const AUTOMATION_DEV_STACK_URL = 'https://localhost:8082/devStack.json';
|
|
4
|
-
const getAutomationProdStackUrl = cloudId => `/gateway/api/automation/internal-api/jira/${cloudId}/pro/rest/environments`;
|
|
5
|
-
const getLatestPreProdStack = async cloudId => {
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(getAutomationProdStackUrl(cloudId));
|
|
8
|
-
const stacksResponse = await response.json();
|
|
9
|
-
const preProdStacks = stacksResponse.prod.otherStacks.filter(({
|
|
10
|
-
releasedSuccessfully
|
|
11
|
-
}) => !releasedSuccessfully).map(({
|
|
12
|
-
stack
|
|
13
|
-
}) => stack);
|
|
14
|
-
const [latestPreProdStack = null] = preProdStacks;
|
|
15
|
-
return latestPreProdStack;
|
|
16
|
-
} catch (e) {
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.warn(`Failed to fetch pre-prod stack from ${getAutomationProdStackUrl(cloudId)} with error: ${e}`);
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const _getAutomationKeyFromLocalStorage = key => {
|
|
23
|
-
return window.localStorage.getItem(`${AUTOMATION_LOCAL_STORAGE_PREFIX}:${key}`);
|
|
24
|
-
};
|
|
25
|
-
const getAutomationDevStackFromLocalServer = async () => {
|
|
26
|
-
try {
|
|
27
|
-
const devStackResponse = await fetch(AUTOMATION_DEV_STACK_URL);
|
|
28
|
-
const devStack = await devStackResponse.json();
|
|
29
|
-
return devStack.name;
|
|
30
|
-
} catch (e) {
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
console.warn(`Failed to fetch dev stack from ${AUTOMATION_DEV_STACK_URL} with error: ${e}`);
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export const getAutomationStackFromLocalStorage = () => _getAutomationKeyFromLocalStorage(AUTOMATION_LOCAL_STORAGE_STACK);
|
|
37
|
-
export const getAutomationStack = async (env, cloudId) => {
|
|
38
|
-
if (env === 'prod') {
|
|
39
|
-
return 'pro';
|
|
40
|
-
}
|
|
41
|
-
if (env === 'pre-prod') {
|
|
42
|
-
const stack = await getLatestPreProdStack(cloudId);
|
|
43
|
-
return stack !== null && stack !== void 0 ? stack : 'pro';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// We fetch the dev stack name from local server (barrel webpack dev server) if it's available.
|
|
47
|
-
// However, this requires that devWatch is running locally.
|
|
48
|
-
// To use manual triggers without running devWatch, set the local storage value to your stack name e.g. devltan3. The full key is: automationPlatform:automationStack
|
|
49
|
-
const stackOverride = (await getAutomationDevStackFromLocalServer()) || getAutomationStackFromLocalStorage();
|
|
50
|
-
return stackOverride || 'staging';
|
|
51
|
-
};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
var AUTOMATION_LOCAL_STORAGE_PREFIX = 'automationPlatform';
|
|
5
|
-
var AUTOMATION_LOCAL_STORAGE_STACK = 'automationStack';
|
|
6
|
-
var AUTOMATION_DEV_STACK_URL = 'https://localhost:8082/devStack.json';
|
|
7
|
-
var getAutomationProdStackUrl = function getAutomationProdStackUrl(cloudId) {
|
|
8
|
-
return "/gateway/api/automation/internal-api/jira/".concat(cloudId, "/pro/rest/environments");
|
|
9
|
-
};
|
|
10
|
-
var getLatestPreProdStack = /*#__PURE__*/function () {
|
|
11
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cloudId) {
|
|
12
|
-
var response, stacksResponse, preProdStacks, _preProdStacks, _preProdStacks$, latestPreProdStack;
|
|
13
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
-
while (1) switch (_context.prev = _context.next) {
|
|
15
|
-
case 0:
|
|
16
|
-
_context.prev = 0;
|
|
17
|
-
_context.next = 3;
|
|
18
|
-
return fetch(getAutomationProdStackUrl(cloudId));
|
|
19
|
-
case 3:
|
|
20
|
-
response = _context.sent;
|
|
21
|
-
_context.next = 6;
|
|
22
|
-
return response.json();
|
|
23
|
-
case 6:
|
|
24
|
-
stacksResponse = _context.sent;
|
|
25
|
-
preProdStacks = stacksResponse.prod.otherStacks.filter(function (_ref2) {
|
|
26
|
-
var releasedSuccessfully = _ref2.releasedSuccessfully;
|
|
27
|
-
return !releasedSuccessfully;
|
|
28
|
-
}).map(function (_ref3) {
|
|
29
|
-
var stack = _ref3.stack;
|
|
30
|
-
return stack;
|
|
31
|
-
});
|
|
32
|
-
_preProdStacks = _slicedToArray(preProdStacks, 1), _preProdStacks$ = _preProdStacks[0], latestPreProdStack = _preProdStacks$ === void 0 ? null : _preProdStacks$;
|
|
33
|
-
return _context.abrupt("return", latestPreProdStack);
|
|
34
|
-
case 12:
|
|
35
|
-
_context.prev = 12;
|
|
36
|
-
_context.t0 = _context["catch"](0);
|
|
37
|
-
// eslint-disable-next-line no-console
|
|
38
|
-
console.warn("Failed to fetch pre-prod stack from ".concat(getAutomationProdStackUrl(cloudId), " with error: ").concat(_context.t0));
|
|
39
|
-
return _context.abrupt("return", null);
|
|
40
|
-
case 16:
|
|
41
|
-
case "end":
|
|
42
|
-
return _context.stop();
|
|
43
|
-
}
|
|
44
|
-
}, _callee, null, [[0, 12]]);
|
|
45
|
-
}));
|
|
46
|
-
return function getLatestPreProdStack(_x) {
|
|
47
|
-
return _ref.apply(this, arguments);
|
|
48
|
-
};
|
|
49
|
-
}();
|
|
50
|
-
var _getAutomationKeyFromLocalStorage = function _getAutomationKeyFromLocalStorage(key) {
|
|
51
|
-
return window.localStorage.getItem("".concat(AUTOMATION_LOCAL_STORAGE_PREFIX, ":").concat(key));
|
|
52
|
-
};
|
|
53
|
-
var getAutomationDevStackFromLocalServer = /*#__PURE__*/function () {
|
|
54
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
55
|
-
var devStackResponse, devStack;
|
|
56
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
57
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
58
|
-
case 0:
|
|
59
|
-
_context2.prev = 0;
|
|
60
|
-
_context2.next = 3;
|
|
61
|
-
return fetch(AUTOMATION_DEV_STACK_URL);
|
|
62
|
-
case 3:
|
|
63
|
-
devStackResponse = _context2.sent;
|
|
64
|
-
_context2.next = 6;
|
|
65
|
-
return devStackResponse.json();
|
|
66
|
-
case 6:
|
|
67
|
-
devStack = _context2.sent;
|
|
68
|
-
return _context2.abrupt("return", devStack.name);
|
|
69
|
-
case 10:
|
|
70
|
-
_context2.prev = 10;
|
|
71
|
-
_context2.t0 = _context2["catch"](0);
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
console.warn("Failed to fetch dev stack from ".concat(AUTOMATION_DEV_STACK_URL, " with error: ").concat(_context2.t0));
|
|
74
|
-
return _context2.abrupt("return", null);
|
|
75
|
-
case 14:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee2, null, [[0, 10]]);
|
|
80
|
-
}));
|
|
81
|
-
return function getAutomationDevStackFromLocalServer() {
|
|
82
|
-
return _ref4.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}();
|
|
85
|
-
export var getAutomationStackFromLocalStorage = function getAutomationStackFromLocalStorage() {
|
|
86
|
-
return _getAutomationKeyFromLocalStorage(AUTOMATION_LOCAL_STORAGE_STACK);
|
|
87
|
-
};
|
|
88
|
-
export var getAutomationStack = /*#__PURE__*/function () {
|
|
89
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(env, cloudId) {
|
|
90
|
-
var stack, stackOverride;
|
|
91
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
92
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
93
|
-
case 0:
|
|
94
|
-
if (!(env === 'prod')) {
|
|
95
|
-
_context3.next = 2;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
return _context3.abrupt("return", 'pro');
|
|
99
|
-
case 2:
|
|
100
|
-
if (!(env === 'pre-prod')) {
|
|
101
|
-
_context3.next = 7;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
_context3.next = 5;
|
|
105
|
-
return getLatestPreProdStack(cloudId);
|
|
106
|
-
case 5:
|
|
107
|
-
stack = _context3.sent;
|
|
108
|
-
return _context3.abrupt("return", stack !== null && stack !== void 0 ? stack : 'pro');
|
|
109
|
-
case 7:
|
|
110
|
-
_context3.next = 9;
|
|
111
|
-
return getAutomationDevStackFromLocalServer();
|
|
112
|
-
case 9:
|
|
113
|
-
_context3.t0 = _context3.sent;
|
|
114
|
-
if (_context3.t0) {
|
|
115
|
-
_context3.next = 12;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
_context3.t0 = getAutomationStackFromLocalStorage();
|
|
119
|
-
case 12:
|
|
120
|
-
stackOverride = _context3.t0;
|
|
121
|
-
return _context3.abrupt("return", stackOverride || 'staging');
|
|
122
|
-
case 14:
|
|
123
|
-
case "end":
|
|
124
|
-
return _context3.stop();
|
|
125
|
-
}
|
|
126
|
-
}, _callee3);
|
|
127
|
-
}));
|
|
128
|
-
return function getAutomationStack(_x2, _x3) {
|
|
129
|
-
return _ref5.apply(this, arguments);
|
|
130
|
-
};
|
|
131
|
-
}();
|