@jetbrains/ring-ui 5.0.36 → 5.0.38
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/editable-heading/editable-heading.d.ts +4 -2
- package/components/editable-heading/editable-heading.js +3 -3
- package/components/input/input.css +2 -0
- package/components/query-assist/query-assist.js +1 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
- package/dist/_helpers/anchor.js +0 -1
- package/dist/_helpers/card.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
- package/dist/_helpers/footer.js +2 -13
- package/dist/_helpers/query-assist__suggestions.js +0 -10
- package/dist/_helpers/select__filter.js +0 -11
- package/dist/_helpers/services-link.js +0 -2
- package/dist/_helpers/sidebar.js +0 -12
- package/dist/_helpers/theme.js +0 -3
- package/dist/_helpers/title.js +0 -9
- package/dist/alert/alert.js +2 -32
- package/dist/alert/container.js +0 -5
- package/dist/alert-service/alert-service.js +0 -26
- package/dist/analytics/analytics.js +0 -22
- package/dist/analytics/analytics__custom-plugin.js +0 -38
- package/dist/analytics/analytics__fus-plugin.js +0 -20
- package/dist/analytics/analytics__ga-plugin.js +0 -13
- package/dist/analytics/analytics__plugin-utils.js +0 -8
- package/dist/analytics-ng/analytics-ng.js +3 -9
- package/dist/auth/auth.js +2 -3
- package/dist/auth/auth__core.js +30 -243
- package/dist/auth/background-flow.js +2 -25
- package/dist/auth/down-notification.js +0 -7
- package/dist/auth/iframe-flow.js +2 -26
- package/dist/auth/landing.js +2 -6
- package/dist/auth/request-builder.js +0 -11
- package/dist/auth/response-parser.js +4 -26
- package/dist/auth/storage.js +4 -60
- package/dist/auth/token-validator.js +6 -42
- package/dist/auth/window-flow.js +2 -34
- package/dist/auth-dialog/auth-dialog.js +2 -12
- package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
- package/dist/auth-ng/auth-ng.js +6 -22
- package/dist/auth-ng/auth-ng.mock.js +0 -4
- package/dist/autofocus-ng/autofocus-ng.js +0 -5
- package/dist/avatar/avatar.js +4 -17
- package/dist/avatar/fallback-avatar.js +2 -9
- package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
- package/dist/badge/badge.js +0 -3
- package/dist/button/button.js +0 -8
- package/dist/button-group/button-group.js +0 -3
- package/dist/button-group/caption.js +0 -2
- package/dist/button-group-ng/button-group-ng.js +0 -4
- package/dist/button-ng/button-ng.js +3 -21
- package/dist/button-set/button-set.js +0 -3
- package/dist/button-set-ng/button-set-ng.js +0 -2
- package/dist/button-toolbar/button-toolbar.js +0 -3
- package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
- package/dist/caret/caret.js +2 -53
- package/dist/checkbox/checkbox.js +0 -12
- package/dist/code/code.js +3 -25
- package/dist/compiler-ng/compiler-ng.js +0 -5
- package/dist/confirm/confirm.js +0 -6
- package/dist/confirm-service/confirm-service.js +10 -8
- package/dist/content-layout/content-layout.js +0 -7
- package/dist/contenteditable/contenteditable.js +6 -13
- package/dist/data-list/data-list.js +4 -28
- package/dist/data-list/item.js +0 -15
- package/dist/data-list/selection.js +0 -27
- package/dist/date-picker/consts.js +0 -7
- package/dist/date-picker/date-input.js +0 -20
- package/dist/date-picker/date-picker.js +2 -36
- package/dist/date-picker/date-popup.js +18 -71
- package/dist/date-picker/day.js +0 -14
- package/dist/date-picker/month-names.js +0 -9
- package/dist/date-picker/month-slider.js +0 -10
- package/dist/date-picker/month.js +2 -4
- package/dist/date-picker/months.js +6 -13
- package/dist/date-picker/years.js +0 -14
- package/dist/dialog/dialog.js +0 -19
- package/dist/dialog-ng/dialog-ng.js +17 -105
- package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
- package/dist/dropdown/dropdown.js +2 -33
- package/dist/dropdown-menu/dropdown-menu.js +4 -8
- package/dist/editable-heading/editable-heading.d.ts +4 -2
- package/dist/editable-heading/editable-heading.js +7 -6
- package/dist/error-bubble/error-bubble.js +2 -4
- package/dist/error-message/error-message.js +0 -3
- package/dist/footer-ng/footer-ng.js +0 -13
- package/dist/form-ng/form-ng.js +1 -21
- package/dist/global/angular-component-factory.js +0 -10
- package/dist/global/compose.js +0 -1
- package/dist/global/composeRefs.js +0 -1
- package/dist/global/controls-height.js +0 -2
- package/dist/global/create-stateful-context.js +0 -5
- package/dist/global/data-tests.js +0 -4
- package/dist/global/dom.js +2 -11
- package/dist/global/focus-sensor-hoc.js +4 -33
- package/dist/global/fuzzy-highlight.js +2 -16
- package/dist/global/get-event-key.js +8 -17
- package/dist/global/get-uid.js +0 -2
- package/dist/global/linear-function.js +0 -2
- package/dist/global/listeners.js +0 -13
- package/dist/global/memoize.js +0 -2
- package/dist/global/normalize-indent.js +2 -5
- package/dist/global/react-dom-renderer.js +0 -8
- package/dist/global/react-render-adapter.js +0 -7
- package/dist/global/rerender-hoc.js +0 -7
- package/dist/global/ring-angular-component.js +0 -5
- package/dist/global/schedule-raf.js +0 -5
- package/dist/global/trivial-template-tag.js +2 -3
- package/dist/global/url.js +0 -27
- package/dist/grid/col.js +0 -4
- package/dist/grid/grid.js +0 -3
- package/dist/grid/row.js +0 -5
- package/dist/group/group.js +0 -3
- package/dist/header/header.js +0 -5
- package/dist/header/logo.js +0 -4
- package/dist/header/profile.js +0 -7
- package/dist/header/services.js +0 -11
- package/dist/header/smart-profile.js +4 -18
- package/dist/header/smart-services.js +0 -17
- package/dist/header/tray-icon.js +2 -3
- package/dist/header/tray.js +0 -3
- package/dist/heading/heading.js +0 -5
- package/dist/http/http.js +20 -65
- package/dist/http/http.mock.js +2 -14
- package/dist/hub-source/hub-source.js +0 -32
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +0 -12
- package/dist/icon/icon.js +0 -13
- package/dist/icon/icon__constants.js +0 -4
- package/dist/icon/icon__svg.js +0 -10
- package/dist/icon-ng/icon-ng.js +2 -7
- package/dist/input/input.js +0 -30
- package/dist/input-ng/input-ng.js +0 -17
- package/dist/island/adaptive-island-hoc.js +0 -7
- package/dist/island/content.js +0 -25
- package/dist/island/header.js +0 -7
- package/dist/island/island.js +0 -4
- package/dist/island-legacy/content-legacy.js +0 -2
- package/dist/island-legacy/header-legacy.js +0 -2
- package/dist/island-legacy/island-legacy.js +0 -2
- package/dist/island-ng/island-content-ng.js +0 -3
- package/dist/link/clickableLink.js +2 -10
- package/dist/link/link.js +2 -9
- package/dist/link-ng/link-ng.js +0 -2
- package/dist/list/consts.js +0 -4
- package/dist/list/list.js +6 -128
- package/dist/list/list__custom.js +0 -4
- package/dist/list/list__hint.js +0 -3
- package/dist/list/list__item.js +0 -8
- package/dist/list/list__link.js +2 -3
- package/dist/list/list__separator.js +0 -1
- package/dist/list/list__title.js +0 -1
- package/dist/list/list__users-groups-source.js +4 -17
- package/dist/loader/loader.js +0 -10
- package/dist/loader/loader__core.js +6 -70
- package/dist/loader-inline/loader-inline.js +0 -3
- package/dist/loader-ng/loader-ng.js +0 -7
- package/dist/loader-screen/loader-screen.js +0 -3
- package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
- package/dist/login-dialog/login-dialog.js +0 -15
- package/dist/login-dialog/service.js +2 -4
- package/dist/markdown/code.js +0 -2
- package/dist/markdown/heading.js +0 -1
- package/dist/markdown/link.js +0 -1
- package/dist/markdown/markdown.js +0 -2
- package/dist/message/message.js +0 -24
- package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
- package/dist/old-browsers-message/old-browsers-message.js +2 -21
- package/dist/old-browsers-message/white-list.js +2 -6
- package/dist/pager/pager.js +2 -39
- package/dist/panel/panel.js +0 -3
- package/dist/permissions/permissions.js +1 -43
- package/dist/permissions/permissions__cache.js +12 -63
- package/dist/permissions-ng/permissions-ng.js +11 -19
- package/dist/place-under-ng/place-under-ng.js +0 -19
- package/dist/popup/popup.consts.js +0 -11
- package/dist/popup/popup.js +6 -68
- package/dist/popup/position.js +8 -30
- package/dist/popup-menu/popup-menu.js +4 -13
- package/dist/progress-bar/progress-bar.js +0 -14
- package/dist/promised-click-ng/promised-click-ng.js +3 -22
- package/dist/query-assist/query-assist.js +17 -201
- package/dist/radio/radio.js +0 -6
- package/dist/radio/radio__item.js +0 -9
- package/dist/radio-ng/radio-ng.js +0 -4
- package/dist/save-field-ng/save-field-ng.js +1 -37
- package/dist/select/select.js +18 -208
- package/dist/select/select__popup.js +4 -76
- package/dist/select-ng/select-ng.js +18 -74
- package/dist/select-ng/select-ng__lazy.js +2 -17
- package/dist/select-ng/select-ng__options.js +3 -29
- package/dist/shortcuts/core.js +4 -56
- package/dist/shortcuts/shortcuts-hoc.js +0 -4
- package/dist/shortcuts/shortcuts.js +0 -10
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
- package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
- package/dist/sidebar-ng/sidebar-ng.js +2 -12
- package/dist/storage/storage.js +2 -5
- package/dist/storage/storage__fallback.js +2 -48
- package/dist/storage/storage__local.js +0 -23
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +0 -37
- package/dist/table/cell.js +0 -2
- package/dist/table/disable-hover-hoc.js +0 -9
- package/dist/table/header-cell.js +0 -8
- package/dist/table/header.js +0 -16
- package/dist/table/multitable.js +0 -23
- package/dist/table/row-with-focus-sensor.js +0 -12
- package/dist/table/row.js +0 -18
- package/dist/table/selection-adapter.js +0 -2
- package/dist/table/selection-shortcuts-hoc.js +8 -42
- package/dist/table/selection.js +0 -50
- package/dist/table/smart-table.js +0 -9
- package/dist/table/table.js +6 -37
- package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
- package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
- package/dist/tabs/collapsible-more.js +0 -5
- package/dist/tabs/collapsible-tab.js +0 -4
- package/dist/tabs/collapsible-tabs.js +8 -28
- package/dist/tabs/dumb-tabs.js +0 -8
- package/dist/tabs/smart-tabs.js +0 -6
- package/dist/tabs/tab-link.js +0 -1
- package/dist/tabs/tab.js +0 -2
- package/dist/tabs-ng/tabs-ng.js +13 -29
- package/dist/tag/tag.js +0 -24
- package/dist/tags-input/tags-input.js +0 -76
- package/dist/tags-list/tags-list.js +0 -6
- package/dist/template-ng/template-ng.js +0 -12
- package/dist/text/text.js +0 -3
- package/dist/theme-ng/theme-ng.js +0 -8
- package/dist/title-ng/title-ng.js +6 -17
- package/dist/toggle/toggle.js +0 -4
- package/dist/tooltip/tooltip.js +4 -35
- package/dist/tooltip-ng/tooltip-ng.js +2 -8
- package/dist/user-agreement/service.js +0 -62
- package/dist/user-agreement/user-agreement.js +0 -8
- package/dist/user-card/smart-user-card-tooltip.js +2 -8
- package/dist/user-card/tooltip.js +0 -3
- package/package.json +37 -37
|
@@ -6,24 +6,17 @@ import '../global/url.js';
|
|
|
6
6
|
class TokenValidationError extends ExtendableError {
|
|
7
7
|
constructor(message, cause) {
|
|
8
8
|
super(message);
|
|
9
|
-
|
|
10
9
|
_defineProperty(this, "cause", void 0);
|
|
11
|
-
|
|
12
10
|
_defineProperty(this, "authRedirect", void 0);
|
|
13
|
-
|
|
14
11
|
this.cause = cause;
|
|
15
12
|
this.authRedirect = true;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
}
|
|
19
15
|
class TokenValidator {
|
|
20
16
|
constructor(config, getUser, storage) {
|
|
21
17
|
_defineProperty(this, "_getUser", void 0);
|
|
22
|
-
|
|
23
18
|
_defineProperty(this, "_config", void 0);
|
|
24
|
-
|
|
25
19
|
_defineProperty(this, "_storage", void 0);
|
|
26
|
-
|
|
27
20
|
this._getUser = getUser;
|
|
28
21
|
this._config = config;
|
|
29
22
|
this._storage = storage;
|
|
@@ -34,8 +27,6 @@ class TokenValidator {
|
|
|
34
27
|
* @return {number} epoch, seconds since 1970
|
|
35
28
|
* @private
|
|
36
29
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
30
|
static _epoch() {
|
|
40
31
|
const milliseconds = 1000.0;
|
|
41
32
|
return Math.round(Date.now() / milliseconds);
|
|
@@ -45,7 +36,6 @@ class TokenValidator {
|
|
|
45
36
|
*/
|
|
46
37
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
47
38
|
|
|
48
|
-
|
|
49
39
|
/**
|
|
50
40
|
* Check token validity against all conditions.
|
|
51
41
|
* @returns {Promise.<string>}
|
|
@@ -57,8 +47,6 @@ class TokenValidator {
|
|
|
57
47
|
* Check token validity against all conditions.
|
|
58
48
|
* @returns {Promise.<string>}
|
|
59
49
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
50
|
validateToken() {
|
|
63
51
|
return this._getValidatedToken([TokenValidator._validateExistence, TokenValidator._validateExpiration, this._validateScopes.bind(this), this._validateAgainstUser.bind(this)]);
|
|
64
52
|
}
|
|
@@ -68,8 +56,6 @@ class TokenValidator {
|
|
|
68
56
|
* @return {Promise.<StoredToken>}
|
|
69
57
|
* @private
|
|
70
58
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
59
|
static _validateExistence(storedToken) {
|
|
74
60
|
if (!storedToken || !storedToken.accessToken) {
|
|
75
61
|
throw new TokenValidator.TokenValidationError('Token not found');
|
|
@@ -81,8 +67,6 @@ class TokenValidator {
|
|
|
81
67
|
* @return {Promise.<StoredToken>}
|
|
82
68
|
* @private
|
|
83
69
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
70
|
static _validateExpiration(_ref) {
|
|
87
71
|
let {
|
|
88
72
|
expires,
|
|
@@ -90,7 +74,6 @@ class TokenValidator {
|
|
|
90
74
|
} = _ref;
|
|
91
75
|
const REFRESH_BEFORE_RATIO = 6;
|
|
92
76
|
const refreshBefore = lifeTime ? Math.ceil(lifeTime / REFRESH_BEFORE_RATIO) : TokenValidator.DEFAULT_REFRESH_BEFORE;
|
|
93
|
-
|
|
94
77
|
if (expires && expires < TokenValidator._epoch() + refreshBefore) {
|
|
95
78
|
throw new TokenValidator.TokenValidationError('Token expired');
|
|
96
79
|
}
|
|
@@ -101,8 +84,6 @@ class TokenValidator {
|
|
|
101
84
|
* @return {Promise.<StoredToken>}
|
|
102
85
|
* @private
|
|
103
86
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
87
|
_validateScopes(storedToken) {
|
|
107
88
|
const {
|
|
108
89
|
scope,
|
|
@@ -111,10 +92,8 @@ class TokenValidator {
|
|
|
111
92
|
const requiredScopes = optionalScopes ? scope.filter(scopeId => !optionalScopes.includes(scopeId)) : scope;
|
|
112
93
|
const hasAllScopes = requiredScopes.every(scopeId => {
|
|
113
94
|
var _storedToken$scopes;
|
|
114
|
-
|
|
115
95
|
return (_storedToken$scopes = storedToken.scopes) === null || _storedToken$scopes === void 0 ? void 0 : _storedToken$scopes.includes(scopeId);
|
|
116
96
|
});
|
|
117
|
-
|
|
118
97
|
if (!hasAllScopes) {
|
|
119
98
|
throw new TokenValidator.TokenValidationError('Token doesn\'t match required scopes');
|
|
120
99
|
}
|
|
@@ -124,8 +103,6 @@ class TokenValidator {
|
|
|
124
103
|
* @param {string} error
|
|
125
104
|
* @return {boolean}
|
|
126
105
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
106
|
static shouldRefreshToken(error) {
|
|
130
107
|
return error === 'invalid_grant' || error === 'invalid_request' || error === 'invalid_token';
|
|
131
108
|
}
|
|
@@ -135,27 +112,23 @@ class TokenValidator {
|
|
|
135
112
|
* @return {Promise.<StoredToken>}
|
|
136
113
|
* @private
|
|
137
114
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
115
|
async _validateAgainstUser(storedToken) {
|
|
141
116
|
try {
|
|
142
|
-
return await this._getUser(storedToken.accessToken);
|
|
117
|
+
return await this._getUser(storedToken.accessToken);
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
119
|
} catch (errorResponse) {
|
|
144
120
|
let response = {};
|
|
145
|
-
|
|
146
121
|
try {
|
|
147
122
|
response = await errorResponse.response.json();
|
|
148
|
-
} catch (e) {
|
|
123
|
+
} catch (e) {
|
|
124
|
+
// Skip JSON parsing errors
|
|
149
125
|
}
|
|
150
|
-
|
|
151
126
|
if (errorResponse.status === CODE.UNAUTHORIZED || TokenValidator.shouldRefreshToken(response.error)) {
|
|
152
127
|
var _errorResponse$data, _errorResponse$data2;
|
|
153
|
-
|
|
154
128
|
// Token expired
|
|
155
129
|
throw new TokenValidator.TokenValidationError(response.error || errorResponse.message, (_errorResponse$data = errorResponse.data) !== null && _errorResponse$data !== void 0 && _errorResponse$data.error ? new Error((_errorResponse$data2 = errorResponse.data) === null || _errorResponse$data2 === void 0 ? void 0 : _errorResponse$data2.error) : undefined);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
130
|
+
}
|
|
131
|
+
// Request unexpectedly failed
|
|
159
132
|
throw errorResponse;
|
|
160
133
|
}
|
|
161
134
|
}
|
|
@@ -163,7 +136,6 @@ class TokenValidator {
|
|
|
163
136
|
* Token Validator function
|
|
164
137
|
* @typedef {(function(StoredToken): Promise<StoredToken>)} TokenValidator
|
|
165
138
|
*/
|
|
166
|
-
|
|
167
139
|
/**
|
|
168
140
|
* Gets stored token and applies provided validators
|
|
169
141
|
* @param {TokenValidator[]} validators An array of validation
|
|
@@ -173,26 +145,18 @@ class TokenValidator {
|
|
|
173
145
|
* have {authRedirect: true}.
|
|
174
146
|
* @private
|
|
175
147
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
148
|
async _getValidatedToken(validators) {
|
|
179
149
|
const storedToken = await this._storage.getToken();
|
|
180
|
-
|
|
181
150
|
if (storedToken == null) {
|
|
182
151
|
throw new TokenValidator.TokenValidationError('Token not found');
|
|
183
152
|
}
|
|
184
|
-
|
|
185
153
|
for (let i = 0; i < validators.length; i++) {
|
|
186
154
|
await validators[i](storedToken);
|
|
187
155
|
}
|
|
188
|
-
|
|
189
156
|
return storedToken.accessToken;
|
|
190
157
|
}
|
|
191
|
-
|
|
192
158
|
}
|
|
193
|
-
|
|
194
159
|
_defineProperty(TokenValidator, "DEFAULT_REFRESH_BEFORE", 10 * 60);
|
|
195
|
-
|
|
196
160
|
_defineProperty(TokenValidator, "TokenValidationError", TokenValidationError);
|
|
197
161
|
|
|
198
162
|
export { TokenValidationError, TokenValidator as default };
|
package/dist/auth/window-flow.js
CHANGED
|
@@ -8,37 +8,26 @@ const CLOSED_CHECK_INTERVAL = 200;
|
|
|
8
8
|
class WindowFlow {
|
|
9
9
|
constructor(requestBuilder, storage) {
|
|
10
10
|
_defineProperty(this, "_timeoutId", undefined);
|
|
11
|
-
|
|
12
11
|
_defineProperty(this, "_requestBuilder", void 0);
|
|
13
|
-
|
|
14
12
|
_defineProperty(this, "_storage", void 0);
|
|
15
|
-
|
|
16
13
|
_defineProperty(this, "reject", void 0);
|
|
17
|
-
|
|
18
14
|
_defineProperty(this, "_loginWindow", void 0);
|
|
19
|
-
|
|
20
15
|
_defineProperty(this, "_promise", void 0);
|
|
21
|
-
|
|
22
16
|
_defineProperty(this, "checkIsClosed", () => {
|
|
23
17
|
var _this$_loginWindow;
|
|
24
|
-
|
|
25
18
|
if ((_this$_loginWindow = this._loginWindow) !== null && _this$_loginWindow !== void 0 && _this$_loginWindow.closed) {
|
|
26
19
|
this.stop();
|
|
27
20
|
return;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
this._timeoutId = window.setTimeout(this.checkIsClosed, CLOSED_CHECK_INTERVAL);
|
|
31
23
|
});
|
|
32
|
-
|
|
33
24
|
_defineProperty(this, "_reset", () => {
|
|
34
25
|
this._promise = null;
|
|
35
26
|
this._loginWindow = null;
|
|
36
27
|
clearTimeout(this._timeoutId);
|
|
37
28
|
});
|
|
38
|
-
|
|
39
29
|
this._requestBuilder = requestBuilder;
|
|
40
30
|
this._storage = storage;
|
|
41
|
-
|
|
42
31
|
this._reset();
|
|
43
32
|
}
|
|
44
33
|
/**
|
|
@@ -46,8 +35,6 @@ class WindowFlow {
|
|
|
46
35
|
* @param {string} url
|
|
47
36
|
* @private
|
|
48
37
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
38
|
_openWindow(url) {
|
|
52
39
|
const height = 700;
|
|
53
40
|
const width = 750;
|
|
@@ -59,10 +46,9 @@ class WindowFlow {
|
|
|
59
46
|
/**
|
|
60
47
|
* Initiates authorization in window
|
|
61
48
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
49
|
async _load() {
|
|
65
|
-
const authRequest = await this._requestBuilder.prepareAuthRequest(
|
|
50
|
+
const authRequest = await this._requestBuilder.prepareAuthRequest(
|
|
51
|
+
// eslint-disable-next-line camelcase
|
|
66
52
|
{
|
|
67
53
|
request_credentials: 'required',
|
|
68
54
|
auth_mode: 'bypass_to_login'
|
|
@@ -72,75 +58,57 @@ class WindowFlow {
|
|
|
72
58
|
return new Promise((resolve, reject) => {
|
|
73
59
|
this.reject = reject;
|
|
74
60
|
let cleanRun;
|
|
75
|
-
|
|
76
61
|
const cleanUp = () => {
|
|
77
62
|
var _this$_loginWindow2;
|
|
78
|
-
|
|
79
63
|
if (cleanRun) {
|
|
80
64
|
return;
|
|
81
65
|
}
|
|
82
|
-
|
|
83
66
|
cleanRun = true;
|
|
84
67
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
85
|
-
|
|
86
68
|
removeStateListener();
|
|
87
69
|
removeTokenListener();
|
|
88
70
|
/* eslint-enable @typescript-eslint/no-use-before-define */
|
|
89
|
-
|
|
90
71
|
(_this$_loginWindow2 = this._loginWindow) === null || _this$_loginWindow2 === void 0 ? void 0 : _this$_loginWindow2.close();
|
|
91
72
|
clearTimeout(this._timeoutId);
|
|
92
73
|
};
|
|
93
|
-
|
|
94
74
|
const removeTokenListener = this._storage.onTokenChange(token => {
|
|
95
75
|
if (token) {
|
|
96
76
|
cleanUp();
|
|
97
77
|
resolve(token.accessToken);
|
|
98
78
|
}
|
|
99
79
|
});
|
|
100
|
-
|
|
101
80
|
const removeStateListener = this._storage.onStateChange(authRequest.stateId, state => {
|
|
102
81
|
if (state && state.error) {
|
|
103
82
|
cleanUp();
|
|
104
83
|
reject(new AuthResponseParser.AuthError(state));
|
|
105
84
|
}
|
|
106
85
|
});
|
|
107
|
-
|
|
108
86
|
if (this._loginWindow == null || this._loginWindow.closed) {
|
|
109
87
|
this._loginWindow = this._openWindow(authRequest.url);
|
|
110
88
|
} else {
|
|
111
89
|
this._loginWindow.location.href = authRequest.url;
|
|
112
90
|
}
|
|
113
|
-
|
|
114
91
|
this.checkIsClosed();
|
|
115
92
|
});
|
|
116
93
|
}
|
|
117
|
-
|
|
118
94
|
stop() {
|
|
119
95
|
if (this._loginWindow != null) {
|
|
120
96
|
this._loginWindow.close();
|
|
121
97
|
}
|
|
122
|
-
|
|
123
98
|
if (this.reject) {
|
|
124
99
|
this.reject('Authorization window closed');
|
|
125
100
|
}
|
|
126
|
-
|
|
127
101
|
this._reset();
|
|
128
102
|
}
|
|
129
|
-
|
|
130
103
|
authorize() {
|
|
131
104
|
if (this._promise != null && this._loginWindow != null && !this._loginWindow.closed) {
|
|
132
105
|
this._loginWindow.focus();
|
|
133
|
-
|
|
134
106
|
return this._promise;
|
|
135
107
|
}
|
|
136
|
-
|
|
137
108
|
this._promise = this._load();
|
|
138
|
-
|
|
139
109
|
this._promise.then(this._reset, this._reset);
|
|
140
|
-
|
|
141
110
|
return this._promise;
|
|
142
111
|
}
|
|
143
|
-
|
|
144
112
|
}
|
|
145
113
|
|
|
146
114
|
export { WindowFlow as default };
|
|
@@ -44,29 +44,25 @@ var modules_ae521deb = {"unit":"8px","dialog":"dialog_rui_159b","content":"conte
|
|
|
44
44
|
class AuthDialog extends Component {
|
|
45
45
|
constructor() {
|
|
46
46
|
super(...arguments);
|
|
47
|
-
|
|
48
47
|
_defineProperty(this, "state", {
|
|
49
48
|
retrying: false
|
|
50
49
|
});
|
|
51
|
-
|
|
52
50
|
_defineProperty(this, "onEscPress", () => {
|
|
53
51
|
if (this.props.cancelOnEsc) {
|
|
54
52
|
this.props.onCancel();
|
|
55
53
|
}
|
|
56
54
|
});
|
|
57
|
-
|
|
58
55
|
_defineProperty(this, "onRetryPress", async () => {
|
|
59
56
|
if (!this.props.onTryAgain || this.state.retrying) {
|
|
60
57
|
return;
|
|
61
58
|
}
|
|
62
|
-
|
|
63
59
|
this.setState({
|
|
64
60
|
retrying: true
|
|
65
61
|
});
|
|
66
|
-
|
|
67
62
|
try {
|
|
68
63
|
await this.props.onTryAgain();
|
|
69
|
-
} catch (e) {
|
|
64
|
+
} catch (e) {
|
|
65
|
+
// do nothing, error is handled in onTryAgain
|
|
70
66
|
} finally {
|
|
71
67
|
this.setState({
|
|
72
68
|
retrying: false
|
|
@@ -74,15 +70,12 @@ class AuthDialog extends Component {
|
|
|
74
70
|
}
|
|
75
71
|
});
|
|
76
72
|
}
|
|
77
|
-
|
|
78
73
|
componentDidMount() {
|
|
79
74
|
window.addEventListener('online', this.onRetryPress);
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
componentWillUnmount() {
|
|
83
77
|
window.removeEventListener('online', this.onRetryPress);
|
|
84
78
|
}
|
|
85
|
-
|
|
86
79
|
render() {
|
|
87
80
|
const {
|
|
88
81
|
show,
|
|
@@ -139,9 +132,7 @@ class AuthDialog extends Component {
|
|
|
139
132
|
onClick: onCancel
|
|
140
133
|
}, cancelLabel))));
|
|
141
134
|
}
|
|
142
|
-
|
|
143
135
|
}
|
|
144
|
-
|
|
145
136
|
_defineProperty(AuthDialog, "propTypes", {
|
|
146
137
|
className: PropTypes.string,
|
|
147
138
|
title: PropTypes.string,
|
|
@@ -159,7 +150,6 @@ _defineProperty(AuthDialog, "propTypes", {
|
|
|
159
150
|
onCancel: PropTypes.func,
|
|
160
151
|
onTryAgain: PropTypes.func
|
|
161
152
|
});
|
|
162
|
-
|
|
163
153
|
_defineProperty(AuthDialog, "defaultProps", {
|
|
164
154
|
loginCaption: 'Log in',
|
|
165
155
|
loginToCaption: 'Log in to %serviceName%',
|
|
@@ -44,19 +44,17 @@ import '../heading/heading.js';
|
|
|
44
44
|
/**
|
|
45
45
|
* @name Auth Dialog Service
|
|
46
46
|
*/
|
|
47
|
-
|
|
48
47
|
const containerElement = document.createElement('div');
|
|
49
48
|
/**
|
|
50
49
|
* Renders AuthDialog into virtual node to skip maintaining container
|
|
51
50
|
*/
|
|
52
|
-
|
|
53
51
|
function renderAuthDialog(props) {
|
|
54
52
|
render( /*#__PURE__*/React.createElement(AuthDialog, props), containerElement);
|
|
55
53
|
}
|
|
56
|
-
|
|
57
54
|
function showAuthDialog() {
|
|
58
55
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59
|
-
renderAuthDialog({
|
|
56
|
+
renderAuthDialog({
|
|
57
|
+
...props,
|
|
60
58
|
show: true
|
|
61
59
|
});
|
|
62
60
|
return () => {
|
package/dist/auth-ng/auth-ng.js
CHANGED
|
@@ -68,7 +68,6 @@ import '../auth/token-validator.js';
|
|
|
68
68
|
/**
|
|
69
69
|
* @name Auth Ng
|
|
70
70
|
*/
|
|
71
|
-
|
|
72
71
|
const angularModule = angular.module('Ring.auth', []);
|
|
73
72
|
angularModule.provider('auth', ["$httpProvider", function provider($httpProvider) {
|
|
74
73
|
/**
|
|
@@ -78,15 +77,14 @@ angularModule.provider('auth', ["$httpProvider", function provider($httpProvider
|
|
|
78
77
|
/**
|
|
79
78
|
* @type {{cleanHash: boolean}} config
|
|
80
79
|
*/
|
|
81
|
-
|
|
82
80
|
const defaultConfig = {
|
|
83
81
|
cleanHash: false //prevents infinite redirect on angular>1.2.26
|
|
84
|
-
|
|
85
82
|
};
|
|
86
83
|
|
|
87
84
|
this.init = authInstance => {
|
|
88
85
|
auth = authInstance;
|
|
89
86
|
};
|
|
87
|
+
|
|
90
88
|
/**
|
|
91
89
|
* @param {{
|
|
92
90
|
* serverUri: string,
|
|
@@ -96,34 +94,27 @@ angularModule.provider('auth', ["$httpProvider", function provider($httpProvider
|
|
|
96
94
|
* cleanHash: boolean?
|
|
97
95
|
* }} config
|
|
98
96
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
97
|
this.config = config => {
|
|
102
98
|
const configCopy = angular.extend({}, defaultConfig, config);
|
|
103
99
|
auth = new Auth(configCopy);
|
|
104
100
|
};
|
|
105
|
-
|
|
106
101
|
$httpProvider.interceptors.push(['$q', '$injector', 'auth', ($q, $injector, authInstance) => {
|
|
107
102
|
function urlEndsWith(config, suffix) {
|
|
108
103
|
return config && config.url && config.url.indexOf(suffix) === config.url.length - suffix.length;
|
|
109
104
|
}
|
|
110
|
-
|
|
111
105
|
return {
|
|
112
106
|
request(config) {
|
|
113
107
|
if (!authInstance || urlEndsWith(config, '.html') || config && config.noAuthorization) {
|
|
114
108
|
// Don't intercept angular template requests
|
|
115
109
|
return config;
|
|
116
110
|
}
|
|
117
|
-
|
|
118
111
|
return authInstance.promise.then(() => authInstance.auth.requestToken()).then(accessToken => {
|
|
119
112
|
if (accessToken) {
|
|
120
113
|
config.headers.Authorization = `Bearer ${accessToken}`;
|
|
121
114
|
}
|
|
122
|
-
|
|
123
115
|
return config;
|
|
124
116
|
});
|
|
125
117
|
},
|
|
126
|
-
|
|
127
118
|
responseError(rejection) {
|
|
128
119
|
if (authInstance && !urlEndsWith(rejection.config, '.html') && rejection.data != null && Auth.shouldRefreshToken(rejection.data.error)) {
|
|
129
120
|
// Use $injector to avoid circular dependency
|
|
@@ -141,10 +132,8 @@ angularModule.provider('auth', ["$httpProvider", function provider($httpProvider
|
|
|
141
132
|
url
|
|
142
133
|
}));
|
|
143
134
|
}
|
|
144
|
-
|
|
145
135
|
return $q.reject(rejection);
|
|
146
136
|
}
|
|
147
|
-
|
|
148
137
|
};
|
|
149
138
|
}]);
|
|
150
139
|
this.$get = ["$injector", "$log", "$sniffer", function get($injector, $log, $sniffer) {
|
|
@@ -153,48 +142,43 @@ angularModule.provider('auth', ["$httpProvider", function provider($httpProvider
|
|
|
153
142
|
$log.warn('Auth wasn\'t initialized');
|
|
154
143
|
return null;
|
|
155
144
|
}
|
|
156
|
-
|
|
157
145
|
if (auth.config.reloadOnUserChange === false) {
|
|
158
146
|
auth.addListener('userChange', () => {
|
|
159
147
|
const $route = $injector.get('$route');
|
|
160
148
|
$route.reload();
|
|
161
149
|
});
|
|
162
150
|
}
|
|
151
|
+
|
|
163
152
|
/**
|
|
164
153
|
* @type {Promise.<string>}
|
|
165
154
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
155
|
const authInitPromise = auth.init();
|
|
156
|
+
|
|
169
157
|
/**
|
|
170
158
|
* @param {string?} restoreLocationURL
|
|
171
159
|
*/
|
|
172
|
-
|
|
173
160
|
function restoreLocation(restoreLocationURL) {
|
|
174
161
|
if (restoreLocationURL) {
|
|
175
162
|
const bases = document.getElementsByTagName('base');
|
|
176
163
|
let baseURI = auth.config.redirectUri;
|
|
177
|
-
|
|
178
164
|
if (bases.length > 0) {
|
|
179
165
|
baseURI = bases[0].href;
|
|
180
166
|
}
|
|
181
|
-
|
|
182
167
|
if (restoreLocationURL.indexOf(baseURI) === 0) {
|
|
183
168
|
const $location = $injector.get('$location');
|
|
184
|
-
let relativeURI = restoreLocationURL.substr(baseURI.length);
|
|
169
|
+
let relativeURI = restoreLocationURL.substr(baseURI.length);
|
|
170
|
+
|
|
171
|
+
// We have to turn url with hash to simple relative url in HashbangInHtml5 mode
|
|
185
172
|
// And there is no other and documented way to detect that mode
|
|
186
173
|
// @see http://stackoverflow.com/a/16678065
|
|
187
|
-
|
|
188
174
|
if ($location.$$html5 && !$sniffer.history) {
|
|
189
175
|
// eslint-disable-line angular/no-private-call
|
|
190
176
|
relativeURI = relativeURI.replace(/^#\//, '');
|
|
191
177
|
}
|
|
192
|
-
|
|
193
178
|
$location.url(relativeURI).replace();
|
|
194
179
|
}
|
|
195
180
|
}
|
|
196
181
|
}
|
|
197
|
-
|
|
198
182
|
authInitPromise.then(restoreLocation, e => {
|
|
199
183
|
if (!e.authRedirect) {
|
|
200
184
|
$log.error(e);
|
|
@@ -9,20 +9,16 @@ function AuthProviderMock() {
|
|
|
9
9
|
return {
|
|
10
10
|
auth: {
|
|
11
11
|
addListener() {},
|
|
12
|
-
|
|
13
12
|
getAPIPath() {
|
|
14
13
|
return '/';
|
|
15
14
|
},
|
|
16
|
-
|
|
17
15
|
requestToken() {
|
|
18
16
|
return promise;
|
|
19
17
|
},
|
|
20
|
-
|
|
21
18
|
http: {
|
|
22
19
|
get() {
|
|
23
20
|
return promise;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
}
|
|
27
23
|
},
|
|
28
24
|
promise
|
|
@@ -18,24 +18,19 @@ angularModule.directive('rgAutofocus', function rgAutofocusDirective() {
|
|
|
18
18
|
if (!element) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
if (element.hasAttribute(RING_SELECT) || element.tagName.toLowerCase() === RING_SELECT) {
|
|
23
22
|
focusOnElement(element.querySelector(RING_SELECT_SELECTOR));
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
if (element.matches(FOCUSABLE_ELEMENTS) && element.focus) {
|
|
28
26
|
element.focus();
|
|
29
27
|
return;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
const focusableChild = element.querySelector(FOCUSABLE_ELEMENTS);
|
|
33
|
-
|
|
34
30
|
if (focusableChild && focusableChild.focus) {
|
|
35
31
|
focusableChild.focus();
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
return (scope, iElement, iAttrs) => {
|
|
40
35
|
const element = iElement[0];
|
|
41
36
|
scope.$watch(iAttrs.rgAutofocus, newValue => {
|
package/dist/avatar/avatar.js
CHANGED
|
@@ -12,9 +12,7 @@ var modules_61ca8c75 = {"avatar":"avatar_rui_a03e","subavatar":"subavatar_rui_a0
|
|
|
12
12
|
/**
|
|
13
13
|
* @name Avatar
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
15
|
var Size;
|
|
17
|
-
|
|
18
16
|
(function (Size) {
|
|
19
17
|
Size[Size["Size18"] = 18] = "Size18";
|
|
20
18
|
Size[Size["Size20"] = 20] = "Size20";
|
|
@@ -25,28 +23,23 @@ var Size;
|
|
|
25
23
|
Size[Size["Size48"] = 48] = "Size48";
|
|
26
24
|
Size[Size["Size56"] = 56] = "Size56";
|
|
27
25
|
})(Size || (Size = {}));
|
|
28
|
-
|
|
29
26
|
class Avatar extends PureComponent {
|
|
30
27
|
constructor() {
|
|
31
28
|
super(...arguments);
|
|
32
|
-
|
|
33
29
|
_defineProperty(this, "state", {
|
|
34
30
|
errorUrl: ''
|
|
35
31
|
});
|
|
36
|
-
|
|
37
32
|
_defineProperty(this, "handleError", () => {
|
|
38
33
|
this.setState({
|
|
39
34
|
errorUrl: this.props.url
|
|
40
35
|
});
|
|
41
36
|
});
|
|
42
|
-
|
|
43
37
|
_defineProperty(this, "handleSuccess", () => {
|
|
44
38
|
this.setState({
|
|
45
39
|
errorUrl: ''
|
|
46
40
|
});
|
|
47
41
|
});
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
render() {
|
|
51
44
|
const {
|
|
52
45
|
size,
|
|
@@ -75,7 +68,6 @@ class Avatar extends PureComponent {
|
|
|
75
68
|
width: subavatarSizeString,
|
|
76
69
|
...style
|
|
77
70
|
};
|
|
78
|
-
|
|
79
71
|
if (!url || this.state.errorUrl === url) {
|
|
80
72
|
return /*#__PURE__*/React.createElement("span", _extends({}, restProps, {
|
|
81
73
|
"data-test": "avatar",
|
|
@@ -89,23 +81,21 @@ class Avatar extends PureComponent {
|
|
|
89
81
|
username: username
|
|
90
82
|
}));
|
|
91
83
|
}
|
|
92
|
-
|
|
93
84
|
let src = url;
|
|
94
|
-
|
|
95
85
|
if (!skipParams && !isDataURI(url)) {
|
|
96
86
|
const [urlStart, query] = url.split('?');
|
|
97
|
-
const queryParams = {
|
|
87
|
+
const queryParams = {
|
|
88
|
+
...parseQueryString(query),
|
|
98
89
|
dpr,
|
|
99
90
|
size
|
|
100
91
|
};
|
|
101
92
|
src = encodeURL(urlStart, queryParams);
|
|
102
93
|
}
|
|
103
|
-
|
|
104
94
|
let subavatarSrc = null;
|
|
105
|
-
|
|
106
95
|
if (subavatar && !isDataURI(subavatar)) {
|
|
107
96
|
const [urlStart, query] = subavatar.split('?');
|
|
108
|
-
const queryParams = {
|
|
97
|
+
const queryParams = {
|
|
98
|
+
...parseQueryString(query),
|
|
109
99
|
dpr,
|
|
110
100
|
subavatarSizeString
|
|
111
101
|
};
|
|
@@ -138,9 +128,7 @@ class Avatar extends PureComponent {
|
|
|
138
128
|
}));
|
|
139
129
|
}
|
|
140
130
|
}
|
|
141
|
-
|
|
142
131
|
}
|
|
143
|
-
|
|
144
132
|
_defineProperty(Avatar, "propTypes", {
|
|
145
133
|
dpr: PropTypes.number,
|
|
146
134
|
className: PropTypes.string,
|
|
@@ -153,7 +141,6 @@ _defineProperty(Avatar, "propTypes", {
|
|
|
153
141
|
username: PropTypes.string,
|
|
154
142
|
skipParams: PropTypes.bool
|
|
155
143
|
});
|
|
156
|
-
|
|
157
144
|
_defineProperty(Avatar, "defaultProps", {
|
|
158
145
|
dpr: getPixelRatio(),
|
|
159
146
|
size: Size.Size20,
|
|
@@ -53,10 +53,8 @@ const Sizes = {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const sizeKeys = Object.keys(Sizes).map(Number);
|
|
56
|
-
|
|
57
56
|
function extractLetters(name) {
|
|
58
57
|
const names = name.split(/[\s._]+/).filter(Boolean).map(word => Array.from(word));
|
|
59
|
-
|
|
60
58
|
if (names.length >= 2) {
|
|
61
59
|
return names[0][0].toUpperCase() + names[1][0].toUpperCase();
|
|
62
60
|
} else if (names.length === 1) {
|
|
@@ -68,21 +66,16 @@ function extractLetters(name) {
|
|
|
68
66
|
} else {
|
|
69
67
|
return 'XX';
|
|
70
68
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
}
|
|
70
|
+
// https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0#gistcomment-2775538
|
|
74
71
|
const BASE = 32;
|
|
75
|
-
|
|
76
72
|
function hashCode(s) {
|
|
77
73
|
let h = 0;
|
|
78
|
-
|
|
79
74
|
for (let i = 0; i < s.length; i++) {
|
|
80
75
|
h = Math.imul(BASE - 1, h) + s.charCodeAt(i) | 0;
|
|
81
76
|
}
|
|
82
|
-
|
|
83
77
|
return h;
|
|
84
78
|
}
|
|
85
|
-
|
|
86
79
|
function FallbackAvatar(_ref) {
|
|
87
80
|
let {
|
|
88
81
|
username,
|