@jetbrains/ring-ui-built 7.0.66 → 7.0.71
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/components/_helpers/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +16 -24
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
package/components/http/http.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { encodeURL, joinBaseURLAndPath } from '../global/url.js';
|
|
4
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
5
|
-
import 'core-js/modules/es.string.replace.js';
|
|
6
2
|
|
|
7
|
-
const _excluded = ["body", "query"],
|
|
8
|
-
_excluded2 = ["headers"],
|
|
9
|
-
_excluded3 = ["headers", "body", "query", "sendRawBody"];
|
|
10
3
|
/**
|
|
11
4
|
* @name HTTP
|
|
12
5
|
*/
|
|
@@ -19,11 +12,10 @@ const defaultFetchConfig = {
|
|
|
19
12
|
credentials: 'same-origin'
|
|
20
13
|
};
|
|
21
14
|
class HTTPError extends Error {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_defineProperty(this, "status", void 0);
|
|
15
|
+
data;
|
|
16
|
+
status;
|
|
17
|
+
constructor(response, data = {}) {
|
|
18
|
+
super(`${response.status} ${response.statusText || ''}`);
|
|
27
19
|
this.data = data;
|
|
28
20
|
this.status = response.status;
|
|
29
21
|
}
|
|
@@ -35,122 +27,61 @@ function isRawBody(params) {
|
|
|
35
27
|
return params.sendRawBody === true;
|
|
36
28
|
}
|
|
37
29
|
class HTTP {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_defineProperty(this, "setAuth", auth => {
|
|
48
|
-
this.requestToken = () => auth.requestToken();
|
|
49
|
-
this.shouldRefreshToken = auth.constructor.shouldRefreshToken;
|
|
50
|
-
this.forceTokenUpdate = () => auth.forceTokenUpdate();
|
|
51
|
-
});
|
|
52
|
-
_defineProperty(this, "setBaseUrl", baseUrl => {
|
|
53
|
-
this.baseUrl = baseUrl;
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "fetch", async function (url) {
|
|
56
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
57
|
-
const {
|
|
58
|
-
body,
|
|
59
|
-
query = {}
|
|
60
|
-
} = params,
|
|
61
|
-
fetchConfig = _objectWithoutProperties(params, _excluded);
|
|
62
|
-
const response = await _this._fetch(_this._makeRequestUrl(url, query), _objectSpread2(_objectSpread2({}, fetchConfig), {}, {
|
|
63
|
-
headers: fetchConfig.headers,
|
|
64
|
-
body: body !== null && body !== undefined && body !== '' ? JSON.stringify(body) : body
|
|
65
|
-
}));
|
|
66
|
-
return _this._processResponse(response);
|
|
67
|
-
});
|
|
68
|
-
_defineProperty(this, "request", async (url, params) => {
|
|
69
|
-
var _this$requestToken;
|
|
70
|
-
let token = await ((_this$requestToken = this.requestToken) === null || _this$requestToken === void 0 ? void 0 : _this$requestToken.call(this));
|
|
71
|
-
let response = await this._performRequest(url, token, params);
|
|
72
|
-
try {
|
|
73
|
-
// Wait for result to catch an HTTP error
|
|
74
|
-
return await this._processResponse(response);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
var _this$shouldRefreshTo;
|
|
77
|
-
if (!(error instanceof HTTPError)) {
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
const shouldRefreshToken = typeof error.data.error === 'string' ? (_this$shouldRefreshTo = this.shouldRefreshToken) === null || _this$shouldRefreshTo === void 0 ? void 0 : _this$shouldRefreshTo.call(this, error.data.error) : false;
|
|
81
|
-
if (shouldRefreshToken) {
|
|
82
|
-
var _this$forceTokenUpdat;
|
|
83
|
-
token = await ((_this$forceTokenUpdat = this.forceTokenUpdate) === null || _this$forceTokenUpdat === void 0 ? void 0 : _this$forceTokenUpdat.call(this));
|
|
84
|
-
response = await this._performRequest(url, token, params);
|
|
85
|
-
return this._processResponse(response);
|
|
86
|
-
}
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
_defineProperty(this, "getMetaForResponse", response => this._requestsMeta.get(response));
|
|
91
|
-
_defineProperty(this, "get", (url, params) => this.request(url, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
92
|
-
method: 'GET'
|
|
93
|
-
})));
|
|
94
|
-
_defineProperty(this, "post", (url, params) => this.request(url, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
95
|
-
method: 'POST'
|
|
96
|
-
})));
|
|
97
|
-
_defineProperty(this, "delete", (url, params) => this.request(url, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
98
|
-
method: 'DELETE'
|
|
99
|
-
})));
|
|
100
|
-
_defineProperty(this, "put", (url, params) => this.request(url, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
101
|
-
method: 'PUT'
|
|
102
|
-
})));
|
|
103
|
-
/**
|
|
104
|
-
* Usage: const {promise, abort} = http.abortify(http.get<{id: string}>)('http://test.com');
|
|
105
|
-
* @param method
|
|
106
|
-
*/
|
|
107
|
-
_defineProperty(this, "abortify", method => function () {
|
|
108
|
-
for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
109
|
-
_ref[_key] = arguments[_key];
|
|
110
|
-
}
|
|
111
|
-
let [url, params] = _ref;
|
|
112
|
-
const ctrl = new AbortController();
|
|
113
|
-
if (params && !('signal' in params)) {
|
|
114
|
-
params.signal = ctrl.signal;
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
promise: method.call(_this, url, params),
|
|
118
|
-
abort: () => ctrl.abort()
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
if (_auth) {
|
|
122
|
-
this.setAuth(_auth);
|
|
30
|
+
baseUrl = null;
|
|
31
|
+
_requestsMeta = new WeakMap();
|
|
32
|
+
fetchConfig;
|
|
33
|
+
requestToken;
|
|
34
|
+
shouldRefreshToken;
|
|
35
|
+
forceTokenUpdate;
|
|
36
|
+
constructor(auth, baseUrl, fetchConfig = {}) {
|
|
37
|
+
if (auth) {
|
|
38
|
+
this.setAuth(auth);
|
|
123
39
|
}
|
|
124
|
-
this.setBaseUrl(
|
|
40
|
+
this.setBaseUrl(baseUrl);
|
|
125
41
|
const {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.fetchConfig =
|
|
130
|
-
|
|
131
|
-
|
|
42
|
+
headers,
|
|
43
|
+
...defaultConfig
|
|
44
|
+
} = defaultFetchConfig;
|
|
45
|
+
this.fetchConfig = {
|
|
46
|
+
...defaultConfig,
|
|
47
|
+
...fetchConfig,
|
|
48
|
+
headers: {
|
|
49
|
+
...headers,
|
|
50
|
+
...fetchConfig.headers
|
|
51
|
+
}
|
|
52
|
+
};
|
|
132
53
|
}
|
|
133
|
-
|
|
134
|
-
|
|
54
|
+
setAuth = auth => {
|
|
55
|
+
this.requestToken = () => auth.requestToken();
|
|
56
|
+
this.shouldRefreshToken = auth.constructor.shouldRefreshToken;
|
|
57
|
+
this.forceTokenUpdate = () => auth.forceTokenUpdate();
|
|
58
|
+
};
|
|
59
|
+
setBaseUrl = baseUrl => {
|
|
60
|
+
this.baseUrl = baseUrl;
|
|
61
|
+
};
|
|
62
|
+
_fetch(...args) {
|
|
63
|
+
return fetch(...args);
|
|
135
64
|
}
|
|
136
65
|
_makeRequestUrl(url, queryObject) {
|
|
137
66
|
const urlWithQuery = encodeURL(url, queryObject);
|
|
138
67
|
return joinBaseURLAndPath(this.baseUrl, urlWithQuery);
|
|
139
68
|
}
|
|
140
|
-
_performRequest(url, token) {
|
|
141
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
69
|
+
_performRequest(url, token, params = {}) {
|
|
142
70
|
const {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const combinedHeaders =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
71
|
+
headers,
|
|
72
|
+
body,
|
|
73
|
+
query = {},
|
|
74
|
+
sendRawBody,
|
|
75
|
+
...fetchConfig
|
|
76
|
+
} = params;
|
|
77
|
+
const combinedHeaders = {
|
|
78
|
+
...this.fetchConfig.headers,
|
|
79
|
+
...(token ? {
|
|
80
|
+
Authorization: `${TOKEN_TYPE} ${token}`
|
|
81
|
+
} : {}),
|
|
82
|
+
...headers
|
|
83
|
+
};
|
|
84
|
+
Object.entries(combinedHeaders).forEach(([key, header]) => {
|
|
154
85
|
if (header === null || header === undefined) {
|
|
155
86
|
Reflect.deleteProperty(combinedHeaders, key);
|
|
156
87
|
}
|
|
@@ -161,11 +92,12 @@ class HTTP {
|
|
|
161
92
|
} else {
|
|
162
93
|
bodyToSend = params.body === null || params.body === undefined || params.body === '' ? params.body : JSON.stringify(body);
|
|
163
94
|
}
|
|
164
|
-
return this._fetch(this._makeRequestUrl(url, query),
|
|
165
|
-
|
|
166
|
-
|
|
95
|
+
return this._fetch(this._makeRequestUrl(url, query), {
|
|
96
|
+
...this.fetchConfig,
|
|
97
|
+
headers: combinedHeaders,
|
|
98
|
+
...fetchConfig,
|
|
167
99
|
body: bodyToSend
|
|
168
|
-
})
|
|
100
|
+
});
|
|
169
101
|
}
|
|
170
102
|
_storeRequestMeta(parsedResponse, rawResponse) {
|
|
171
103
|
const {
|
|
@@ -209,10 +141,73 @@ class HTTP {
|
|
|
209
141
|
return response;
|
|
210
142
|
}
|
|
211
143
|
}
|
|
212
|
-
async
|
|
213
|
-
const
|
|
144
|
+
fetch = async (url, params = {}) => {
|
|
145
|
+
const {
|
|
146
|
+
body,
|
|
147
|
+
query = {},
|
|
148
|
+
...fetchConfig
|
|
149
|
+
} = params;
|
|
150
|
+
const response = await this._fetch(this._makeRequestUrl(url, query), {
|
|
151
|
+
...fetchConfig,
|
|
152
|
+
headers: fetchConfig.headers,
|
|
153
|
+
body: body !== null && body !== undefined && body !== '' ? JSON.stringify(body) : body
|
|
154
|
+
});
|
|
155
|
+
return this._processResponse(response);
|
|
156
|
+
};
|
|
157
|
+
async authorizedFetch(...args) {
|
|
158
|
+
const response = await this._performRequest(...args);
|
|
214
159
|
return this._processResponse(response);
|
|
215
160
|
}
|
|
161
|
+
request = async (url, params) => {
|
|
162
|
+
let token = await this.requestToken?.();
|
|
163
|
+
let response = await this._performRequest(url, token, params);
|
|
164
|
+
try {
|
|
165
|
+
// Wait for result to catch an HTTP error
|
|
166
|
+
return await this._processResponse(response);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if (!(error instanceof HTTPError)) {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
const shouldRefreshToken = typeof error.data.error === 'string' ? this.shouldRefreshToken?.(error.data.error) : false;
|
|
172
|
+
if (shouldRefreshToken) {
|
|
173
|
+
token = await this.forceTokenUpdate?.();
|
|
174
|
+
response = await this._performRequest(url, token, params);
|
|
175
|
+
return this._processResponse(response);
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
getMetaForResponse = response => this._requestsMeta.get(response);
|
|
181
|
+
get = (url, params) => this.request(url, {
|
|
182
|
+
...params,
|
|
183
|
+
method: 'GET'
|
|
184
|
+
});
|
|
185
|
+
post = (url, params) => this.request(url, {
|
|
186
|
+
...params,
|
|
187
|
+
method: 'POST'
|
|
188
|
+
});
|
|
189
|
+
delete = (url, params) => this.request(url, {
|
|
190
|
+
...params,
|
|
191
|
+
method: 'DELETE'
|
|
192
|
+
});
|
|
193
|
+
put = (url, params) => this.request(url, {
|
|
194
|
+
...params,
|
|
195
|
+
method: 'PUT'
|
|
196
|
+
});
|
|
197
|
+
/**
|
|
198
|
+
* Usage: const {promise, abort} = http.abortify(http.get<{id: string}>)('http://test.com');
|
|
199
|
+
* @param method
|
|
200
|
+
*/
|
|
201
|
+
abortify = method => (...[url, params]) => {
|
|
202
|
+
const ctrl = new AbortController();
|
|
203
|
+
if (params && !('signal' in params)) {
|
|
204
|
+
params.signal = ctrl.signal;
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
promise: method.call(this, url, params),
|
|
208
|
+
abort: () => ctrl.abort()
|
|
209
|
+
};
|
|
210
|
+
};
|
|
216
211
|
}
|
|
217
212
|
|
|
218
213
|
export { CODE, HTTPError, HTTP as default, defaultFetchConfig };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/es.regexp.constructor.js';
|
|
3
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
1
|
import HTTP from './http.js';
|
|
6
2
|
import '../global/url.js';
|
|
7
|
-
import 'core-js/modules/es.string.replace.js';
|
|
8
3
|
|
|
9
4
|
const authMock = {
|
|
10
5
|
requestToken: () => 'mock token',
|
|
@@ -12,11 +7,11 @@ const authMock = {
|
|
|
12
7
|
forceTokenUpdate: () => Promise.resolve(null)
|
|
13
8
|
};
|
|
14
9
|
class HTTPMock extends HTTP {
|
|
10
|
+
defaultResponse;
|
|
11
|
+
requests;
|
|
12
|
+
responsesByUrlMap;
|
|
15
13
|
constructor() {
|
|
16
14
|
super(authMock);
|
|
17
|
-
_defineProperty(this, "defaultResponse", void 0);
|
|
18
|
-
_defineProperty(this, "requests", void 0);
|
|
19
|
-
_defineProperty(this, "responsesByUrlMap", void 0);
|
|
20
15
|
this.defaultResponse = null;
|
|
21
16
|
this.requests = [];
|
|
22
17
|
this.responsesByUrlMap = new Map();
|
|
@@ -24,9 +19,10 @@ class HTTPMock extends HTTP {
|
|
|
24
19
|
_fetch(url, params) {
|
|
25
20
|
this.requests = [...this.requests, {
|
|
26
21
|
url,
|
|
27
|
-
params:
|
|
22
|
+
params: {
|
|
23
|
+
...params,
|
|
28
24
|
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body
|
|
29
|
-
}
|
|
25
|
+
}
|
|
30
26
|
}];
|
|
31
27
|
return Promise.resolve({
|
|
32
28
|
status: 200,
|
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
import HTTP from '../http/http.js';
|
|
2
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
3
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
2
|
import '../global/url.js';
|
|
5
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
6
|
-
import 'core-js/modules/es.string.replace.js';
|
|
7
3
|
|
|
8
4
|
const DEFAULT_FIELDS = 'id,name,login,banned,banReason,profile(email/email,avatar/url)';
|
|
9
|
-
function convertUserForCard(hubUser) {
|
|
10
|
-
var _hubUser$profile, _hubUser$profile2;
|
|
11
|
-
let serverUri = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
5
|
+
function convertUserForCard(hubUser, serverUri = '') {
|
|
12
6
|
return {
|
|
13
7
|
name: hubUser.name,
|
|
14
8
|
login: hubUser.login,
|
|
15
9
|
banned: hubUser.banned,
|
|
16
10
|
banReason: hubUser.banReason,
|
|
17
|
-
email:
|
|
18
|
-
avatarUrl:
|
|
19
|
-
href:
|
|
11
|
+
email: hubUser.profile?.email?.email,
|
|
12
|
+
avatarUrl: hubUser.profile?.avatar?.url,
|
|
13
|
+
href: `${serverUri}users/${hubUser.id}`
|
|
20
14
|
};
|
|
21
15
|
}
|
|
22
|
-
function createHubUserCardSource(auth, userId) {
|
|
23
|
-
let fields = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FIELDS;
|
|
16
|
+
function createHubUserCardSource(auth, userId, fields = DEFAULT_FIELDS) {
|
|
24
17
|
const http = new HTTP(auth);
|
|
25
18
|
return async function getHubUser() {
|
|
26
|
-
const hubUser = await http.get(
|
|
19
|
+
const hubUser = await http.get(`${auth.config.serverUri}api/rest/users/${userId}?fields=${fields}`);
|
|
27
20
|
return convertUserForCard(hubUser, auth.config.serverUri);
|
|
28
21
|
};
|
|
29
22
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import HubSource from './hub-source.js';
|
|
4
2
|
|
|
5
3
|
const defaultOptions = {
|
|
@@ -7,17 +5,17 @@ const defaultOptions = {
|
|
|
7
5
|
searchSideThreshold: 200
|
|
8
6
|
};
|
|
9
7
|
class HubSourceUsersGroups {
|
|
8
|
+
auth;
|
|
9
|
+
options;
|
|
10
|
+
usersSource;
|
|
11
|
+
groupsSource;
|
|
10
12
|
constructor(auth, options) {
|
|
11
|
-
_defineProperty(this, "auth", void 0);
|
|
12
|
-
_defineProperty(this, "options", void 0);
|
|
13
|
-
_defineProperty(this, "usersSource", void 0);
|
|
14
|
-
_defineProperty(this, "groupsSource", void 0);
|
|
15
13
|
this.auth = auth;
|
|
16
14
|
this.options = Object.assign({}, defaultOptions, options);
|
|
17
15
|
this.usersSource = new HubSource(auth, 'users', {
|
|
18
16
|
searchMax: this.options.searchMax,
|
|
19
17
|
searchSideThreshold: this.options.searchSideThreshold,
|
|
20
|
-
queryFormatter: query =>
|
|
18
|
+
queryFormatter: query => `nameStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)} or loginStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)}`
|
|
21
19
|
});
|
|
22
20
|
this.groupsSource = new HubSource(auth, 'usergroups', {
|
|
23
21
|
searchMax: this.options.searchMax,
|
|
@@ -26,7 +24,7 @@ class HubSourceUsersGroups {
|
|
|
26
24
|
}
|
|
27
25
|
static wrapMultiwordQuery(query) {
|
|
28
26
|
if (query && query.indexOf(' ') !== -1) {
|
|
29
|
-
return
|
|
27
|
+
return `{${query}}`;
|
|
30
28
|
}
|
|
31
29
|
return query;
|
|
32
30
|
}
|
|
@@ -37,15 +35,13 @@ class HubSourceUsersGroups {
|
|
|
37
35
|
const normalizedQuery = query.toLowerCase();
|
|
38
36
|
return it => it.name.toLowerCase().indexOf(normalizedQuery) !== -1 || it.login.toLowerCase().indexOf(normalizedQuery) !== -1;
|
|
39
37
|
}
|
|
40
|
-
getUsers() {
|
|
41
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
38
|
+
getUsers(query = '') {
|
|
42
39
|
return this.usersSource.get(query, {
|
|
43
40
|
fields: 'id,name,login,total,profile/avatar/url',
|
|
44
41
|
orderBy: 'name'
|
|
45
42
|
}, this.createUsersFilterFn(query));
|
|
46
43
|
}
|
|
47
|
-
getGroups() {
|
|
48
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
44
|
+
getGroups(query = '') {
|
|
49
45
|
return this.groupsSource.get(query, {
|
|
50
46
|
fields: 'id,name,total,userCount,iconUrl',
|
|
51
47
|
orderBy: 'name'
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
1
|
const defaultOptions = {
|
|
4
2
|
searchMax: 20,
|
|
5
3
|
searchSideThreshold: 100,
|
|
6
|
-
queryFormatter: query =>
|
|
4
|
+
queryFormatter: query => `${query} or ${query}*`
|
|
7
5
|
};
|
|
8
6
|
/**
|
|
9
7
|
* HubSource is designed to speed up search requests for small installations.
|
|
@@ -12,13 +10,14 @@ const defaultOptions = {
|
|
|
12
10
|
* select data source.
|
|
13
11
|
*/
|
|
14
12
|
class HubSource {
|
|
13
|
+
static TOP_ALL = -1;
|
|
14
|
+
http;
|
|
15
|
+
relativeUrl;
|
|
16
|
+
options;
|
|
17
|
+
storedData;
|
|
18
|
+
isClientSideSearch;
|
|
19
|
+
filterFn;
|
|
15
20
|
constructor(auth, relativeUrl, options) {
|
|
16
|
-
_defineProperty(this, "http", void 0);
|
|
17
|
-
_defineProperty(this, "relativeUrl", void 0);
|
|
18
|
-
_defineProperty(this, "options", void 0);
|
|
19
|
-
_defineProperty(this, "storedData", void 0);
|
|
20
|
-
_defineProperty(this, "isClientSideSearch", void 0);
|
|
21
|
-
_defineProperty(this, "filterFn", void 0);
|
|
22
21
|
this.http = auth.http;
|
|
23
22
|
this.relativeUrl = relativeUrl;
|
|
24
23
|
this.options = Object.assign({}, defaultOptions, options);
|
|
@@ -106,6 +105,5 @@ class HubSource {
|
|
|
106
105
|
return this.processResults(res);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
_defineProperty(HubSource, "TOP_ALL", -1);
|
|
110
108
|
|
|
111
109
|
export { HubSource as default };
|
|
@@ -2,18 +2,15 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { translate, getTranslations, setTranslations } from './i18n.js';
|
|
5
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
6
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
7
5
|
|
|
8
6
|
const I18nContext = /*#__PURE__*/React.createContext({
|
|
9
7
|
messages: getTranslations(),
|
|
10
8
|
translate
|
|
11
9
|
});
|
|
12
|
-
const I18nContextHolder =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
10
|
+
const I18nContextHolder = ({
|
|
11
|
+
children,
|
|
12
|
+
messages
|
|
13
|
+
}) => {
|
|
17
14
|
useEffect(() => {
|
|
18
15
|
setTranslations(messages);
|
|
19
16
|
}, [messages]);
|
package/components/i18n/i18n.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
-
|
|
4
1
|
var login = "Log in";
|
|
5
2
|
var logout = "Log out";
|
|
6
3
|
var loginTo = "Log in to {{serviceName}}";
|
|
@@ -114,7 +111,7 @@ function warnMissedKeyOnce(key) {
|
|
|
114
111
|
}
|
|
115
112
|
warned.add(key);
|
|
116
113
|
// eslint-disable-next-line no-console
|
|
117
|
-
console.warn(
|
|
114
|
+
console.warn(`Missing localisation for key "${key}"`);
|
|
118
115
|
}
|
|
119
116
|
function setTranslations(newMessages) {
|
|
120
117
|
messages = newMessages;
|
|
@@ -123,7 +120,10 @@ function getTranslations() {
|
|
|
123
120
|
return messages;
|
|
124
121
|
}
|
|
125
122
|
function getTranslationsWithFallback() {
|
|
126
|
-
return
|
|
123
|
+
return {
|
|
124
|
+
...defaultMessages,
|
|
125
|
+
...messages
|
|
126
|
+
};
|
|
127
127
|
}
|
|
128
128
|
function translate(key) {
|
|
129
129
|
var _messages$key;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
3
|
-
import 'core-js/modules/es.string.replace.js';
|
|
4
1
|
import 'react/jsx-runtime';
|
|
5
2
|
import 'react';
|
|
6
3
|
import 'classnames';
|
|
7
4
|
import '../global/memoize.js';
|
|
8
5
|
export { I as default } from '../_helpers/icon-svg.js';
|
|
9
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
package/components/icon/icon.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { PureComponent } from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import deprecate from 'util-deprecate';
|
|
6
5
|
import { Color, Size } from './icon.constants.js';
|
|
7
6
|
import { s as styles, I as IconSVG } from '../_helpers/icon-svg.js';
|
|
8
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
9
|
-
import 'core-js/modules/es.string.replace.js';
|
|
10
7
|
import '../global/memoize.js';
|
|
11
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
12
8
|
|
|
13
|
-
const
|
|
14
|
-
|
|
9
|
+
const warnSize = deprecate(() => {}, `\`size\`, \`width\` and \`height\` props are not recommended to use in Ring UI \`Icon\` component. The intrinsic sizes of SVG icon (\`width\` and \`height\` SVG attributes) are used instead.
|
|
10
|
+
|
|
11
|
+
We strongly recommend to use icons handcrafted for particular sizes. If your icon doesn't exist in the desired size, please ask your designer to draw one. "Responsive" checkmark should be unchecked when exporting icon.'`);
|
|
15
12
|
class Icon extends PureComponent {
|
|
13
|
+
static defaultProps = {
|
|
14
|
+
className: '',
|
|
15
|
+
color: Color.DEFAULT,
|
|
16
|
+
glyph: ''
|
|
17
|
+
};
|
|
18
|
+
static Color = Color;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use icons with appropriate intrinsic sizes instead
|
|
21
|
+
*/
|
|
22
|
+
static Size = Size;
|
|
16
23
|
warnSize() {
|
|
17
24
|
if (this.props.suppressSizeWarning) {
|
|
18
25
|
return;
|
|
@@ -42,18 +49,17 @@ class Icon extends PureComponent {
|
|
|
42
49
|
return undefined;
|
|
43
50
|
}
|
|
44
51
|
render() {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
52
|
+
const {
|
|
53
|
+
className,
|
|
54
|
+
size,
|
|
55
|
+
color,
|
|
56
|
+
loading,
|
|
57
|
+
glyph: Glyph,
|
|
58
|
+
width,
|
|
59
|
+
height,
|
|
60
|
+
suppressSizeWarning,
|
|
61
|
+
...restProps
|
|
62
|
+
} = this.props;
|
|
57
63
|
if (!Glyph) {
|
|
58
64
|
return null;
|
|
59
65
|
}
|
|
@@ -61,9 +67,9 @@ class Icon extends PureComponent {
|
|
|
61
67
|
[styles[color]]: !!color,
|
|
62
68
|
[styles.loading]: loading
|
|
63
69
|
}, className);
|
|
64
|
-
return jsx("span",
|
|
65
|
-
"data-test": 'ring-icon'
|
|
66
|
-
|
|
70
|
+
return jsx("span", {
|
|
71
|
+
"data-test": 'ring-icon',
|
|
72
|
+
...restProps,
|
|
67
73
|
className: classes,
|
|
68
74
|
children: typeof Glyph === 'string' ? jsx(IconSVG, {
|
|
69
75
|
src: Glyph,
|
|
@@ -72,18 +78,8 @@ class Icon extends PureComponent {
|
|
|
72
78
|
className: styles.glyph,
|
|
73
79
|
style: this.getStyle()
|
|
74
80
|
})
|
|
75
|
-
})
|
|
81
|
+
});
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
|
-
_defineProperty(Icon, "defaultProps", {
|
|
79
|
-
className: '',
|
|
80
|
-
color: Color.DEFAULT,
|
|
81
|
-
glyph: ''
|
|
82
|
-
});
|
|
83
|
-
_defineProperty(Icon, "Color", Color);
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Use icons with appropriate intrinsic sizes instead
|
|
86
|
-
*/
|
|
87
|
-
_defineProperty(Icon, "Size", Size);
|
|
88
84
|
|
|
89
85
|
export { Color, Size, Icon as default };
|
package/components/icon/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export { default } from './icon.js';
|
|
2
2
|
export { Color, Size } from './icon.constants.js';
|
|
3
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
4
3
|
import 'react/jsx-runtime';
|
|
5
4
|
import 'react';
|
|
6
5
|
import 'classnames';
|
|
7
6
|
import 'util-deprecate';
|
|
8
7
|
import '../_helpers/icon-svg.js';
|
|
9
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
10
|
-
import 'core-js/modules/es.string.replace.js';
|
|
11
8
|
import '../global/memoize.js';
|
|
12
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|