@jetbrains/ring-ui-built 6.0.30 → 6.0.32
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/_rollupPluginBabelHelpers.js +7 -629
- package/components/_helpers/anchor.js +7 -6
- package/components/_helpers/button__classes.js +16 -14
- package/components/_helpers/caption.js +14 -20
- package/components/_helpers/card.js +95 -105
- package/components/_helpers/dialog__body-scroll-preventer.js +11 -19
- package/components/_helpers/icon__svg.js +22 -25
- package/components/_helpers/input.js +146 -177
- package/components/_helpers/query-assist__suggestions.js +74 -90
- package/components/_helpers/select__filter.js +48 -69
- package/components/_helpers/services-link.js +29 -37
- package/components/_helpers/sidebar.js +99 -107
- package/components/_helpers/tab-link.js +7 -7
- package/components/_helpers/theme.js +31 -40
- package/components/_helpers/title.js +57 -72
- package/components/alert/alert.js +150 -202
- package/components/alert/container.js +32 -41
- package/components/alert-service/alert-service.js +105 -170
- package/components/analytics/analytics.js +12 -22
- package/components/analytics/analytics__custom-plugin.js +54 -75
- package/components/auth/auth.js +4 -36
- package/components/auth/auth__core.js +746 -1471
- package/components/auth/background-flow.js +87 -127
- package/components/auth/down-notification.js +30 -73
- package/components/auth/iframe-flow.js +75 -133
- package/components/auth/request-builder.js +46 -82
- package/components/auth/response-parser.js +86 -116
- package/components/auth/storage.js +171 -334
- package/components/auth/token-validator.js +137 -242
- package/components/auth/window-flow.js +92 -134
- package/components/auth-dialog/auth-dialog.js +114 -172
- package/components/auth-dialog-service/auth-dialog-service.js +8 -31
- package/components/avatar/avatar-example-datauri.js +23 -1
- package/components/avatar/avatar.js +119 -152
- package/components/avatar/fallback-avatar.js +22 -38
- package/components/badge/badge.js +35 -45
- package/components/button/button.js +86 -107
- package/components/button-group/button-group.js +19 -33
- package/components/button-set/button-set.js +20 -32
- package/components/button-toolbar/button-toolbar.js +19 -31
- package/components/caret/caret.js +186 -220
- package/components/checkbox/checkbox.js +76 -101
- package/components/clipboard/clipboard-fallback.js +10 -10
- package/components/clipboard/clipboard.js +35 -132
- package/components/code/code.js +92 -166
- package/components/collapse/collapse-content.js +42 -64
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -14
- package/components/collapse/collapse.js +11 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.js +66 -104
- package/components/confirm-service/confirm-service.js +37 -59
- package/components/content-layout/content-layout.js +43 -64
- package/components/content-layout/sidebar.js +0 -1
- package/components/contenteditable/contenteditable.js +50 -59
- package/components/control-label/control-label.js +9 -9
- package/components/data-list/data-list.js +129 -182
- package/components/data-list/data-list.mock.js +2 -6
- package/components/data-list/item.js +143 -170
- package/components/data-list/selection.js +76 -136
- package/components/data-list/title.js +1 -12
- package/components/date-picker/consts.js +19 -26
- package/components/date-picker/date-input.js +113 -144
- package/components/date-picker/date-picker.js +227 -282
- package/components/date-picker/date-popup.js +350 -395
- package/components/date-picker/day.js +87 -116
- package/components/date-picker/month-names.js +43 -66
- package/components/date-picker/month-slider.js +51 -76
- package/components/date-picker/month.js +16 -25
- package/components/date-picker/months.js +43 -50
- package/components/date-picker/weekdays.js +12 -22
- package/components/date-picker/years.js +83 -110
- package/components/dialog/dialog.js +142 -190
- package/components/dialog/dialog__body-scroll-preventer.js +0 -4
- package/components/dropdown/anchor.js +0 -9
- package/components/dropdown/dropdown.js +182 -213
- package/components/dropdown-menu/dropdown-menu.js +71 -97
- package/components/editable-heading/editable-heading.js +75 -127
- package/components/error-bubble/error-bubble.js +31 -60
- package/components/error-message/error-message.js +39 -59
- package/components/footer/footer.js +27 -30
- package/components/global/compose.js +1 -10
- package/components/global/composeRefs.js +7 -12
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +15 -15
- package/components/global/data-tests.js +6 -14
- package/components/global/dom.js +47 -86
- package/components/global/focus-sensor-hoc.js +122 -132
- package/components/global/fuzzy-highlight.js +22 -36
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +4 -8
- package/components/global/inject-styles.js +10 -15
- package/components/global/listeners.js +27 -51
- package/components/global/memoize.js +6 -12
- package/components/global/normalize-indent.js +19 -50
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/prop-types.js +3 -5
- package/components/global/react-dom-renderer.js +28 -44
- package/components/global/react-render-adapter.js +1 -1
- package/components/global/rerender-hoc.js +12 -30
- package/components/global/schedule-raf.js +5 -6
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +0 -22
- package/components/global/trivial-template-tag.js +3 -10
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -26
- package/components/global/use-event-callback.js +6 -4
- package/components/grid/col.js +35 -52
- package/components/grid/grid.js +17 -31
- package/components/grid/row.js +35 -47
- package/components/group/group.js +17 -25
- package/components/header/header.js +33 -78
- package/components/header/logo.js +20 -36
- package/components/header/profile.js +166 -199
- package/components/header/services-link.js +0 -4
- package/components/header/services.js +73 -116
- package/components/header/smart-profile.js +111 -203
- package/components/header/smart-services.js +62 -113
- package/components/header/tray-icon.js +21 -37
- package/components/header/tray.js +21 -32
- package/components/heading/heading.js +24 -25
- package/components/http/http.d.ts +1 -3
- package/components/http/http.js +203 -353
- package/components/http/http.mock.js +49 -101
- package/components/hub-source/hub-source.js +83 -190
- package/components/hub-source/hub-source__user.js +11 -44
- package/components/hub-source/hub-source__users-groups.js +37 -65
- package/components/i18n/i18n-context.js +7 -10
- package/components/i18n/i18n.js +7 -10
- package/components/icon/icon.js +76 -93
- package/components/icon/icon__svg.js +0 -8
- package/components/icon/index.js +0 -8
- package/components/input/input.js +0 -13
- package/components/island/adaptive-island-hoc.js +30 -43
- package/components/island/content.js +115 -132
- package/components/island/header.js +57 -70
- package/components/island/island.js +28 -40
- package/components/island-legacy/content-legacy.js +17 -25
- package/components/island-legacy/header-legacy.js +19 -27
- package/components/island-legacy/island-legacy.js +17 -25
- package/components/link/clickableLink.js +44 -59
- package/components/link/link.js +57 -68
- package/components/list/consts.js +2 -2
- package/components/list/list.js +611 -698
- package/components/list/list__custom.js +44 -62
- package/components/list/list__hint.js +10 -19
- package/components/list/list__item.js +133 -174
- package/components/list/list__link.js +37 -50
- package/components/list/list__separator.js +14 -24
- package/components/list/list__title.js +22 -32
- package/components/list/list__users-groups-source.js +54 -126
- package/components/loader/loader.js +43 -74
- package/components/loader/loader__core.js +198 -263
- package/components/loader-inline/loader-inline.js +23 -35
- package/components/loader-screen/loader-screen.js +25 -46
- package/components/login-dialog/login-dialog.js +111 -158
- package/components/login-dialog/service.js +8 -34
- package/components/markdown/markdown.js +15 -23
- package/components/message/message.js +161 -203
- package/components/old-browsers-message/old-browsers-message.js +11 -18
- package/components/old-browsers-message/old-browsers-message__stop.js +0 -7
- package/components/old-browsers-message/white-list.js +8 -16
- package/components/pager/pager.js +212 -271
- package/components/panel/panel.js +17 -25
- package/components/permissions/permissions.js +127 -172
- package/components/permissions/permissions__cache.js +194 -224
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +284 -343
- package/components/popup/popup.target.js +9 -8
- package/components/popup/position.js +96 -106
- package/components/popup-menu/popup-menu.js +44 -80
- package/components/progress-bar/progress-bar.js +87 -104
- package/components/query-assist/query-assist.js +838 -916
- package/components/query-assist/query-assist__suggestions.js +1 -30
- package/components/radio/radio.js +19 -34
- package/components/radio/radio__item.js +52 -69
- package/components/select/select.js +852 -957
- package/components/select/select__filter.js +0 -30
- package/components/select/select__popup.js +373 -487
- package/components/shortcuts/core.js +166 -217
- package/components/shortcuts/shortcut-title.js +6 -11
- package/components/shortcuts/shortcuts-hoc.js +19 -45
- package/components/shortcuts/shortcuts.js +50 -75
- package/components/slider/slider.js +99 -122
- package/components/slider/slider.utils.js +14 -24
- package/components/storage/storage.js +4 -33
- package/components/storage/storage__fallback.js +149 -224
- package/components/storage/storage__local.js +90 -153
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +122 -153
- package/components/table/cell.js +14 -26
- package/components/table/disable-hover-hoc.js +33 -51
- package/components/table/header-cell.js +64 -89
- package/components/table/header.js +104 -132
- package/components/table/multitable.js +107 -125
- package/components/table/row-with-focus-sensor.js +25 -69
- package/components/table/row.js +175 -216
- package/components/table/selection-adapter.js +1 -3
- package/components/table/selection-shortcuts-hoc.js +180 -181
- package/components/table/selection.js +156 -226
- package/components/table/smart-table.js +50 -88
- package/components/table/table.js +289 -358
- package/components/tabs/collapsible-more.js +46 -79
- package/components/tabs/collapsible-tab.js +31 -38
- package/components/tabs/collapsible-tabs.js +88 -153
- package/components/tabs/custom-item.js +4 -2
- package/components/tabs/dumb-tabs.js +74 -117
- package/components/tabs/smart-tabs.js +29 -69
- package/components/tabs/tab-link.js +1 -5
- package/components/tabs/tab.js +19 -31
- package/components/tabs/tabs.js +0 -31
- package/components/tag/tag.js +133 -173
- package/components/tags-input/tags-input.js +329 -427
- package/components/tags-list/tags-list.js +57 -78
- package/components/text/text.js +28 -39
- package/components/toggle/toggle.js +56 -70
- package/components/tooltip/tooltip.js +146 -190
- package/components/user-agreement/service.js +228 -371
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +85 -120
- package/components/user-card/card.js +0 -29
- package/components/user-card/smart-user-card-tooltip.js +51 -111
- package/components/user-card/tooltip.js +47 -84
- package/components/user-card/user-card.js +0 -29
- package/package.json +1 -1
@@ -1,8 +1,3 @@
|
|
1
|
-
import { b as _createClass, f as _classCallCheck, _ as _defineProperty, h as _asyncToGenerator, d as _objectSpread2, i as _regeneratorRuntime, j as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.iterator.js';
|
3
|
-
import 'core-js/modules/es.object.to-string.js';
|
4
|
-
import 'core-js/modules/es.promise.js';
|
5
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
6
1
|
import React from 'react';
|
7
2
|
import { createRoot } from 'react-dom/client';
|
8
3
|
import ActualStorage from '../storage/storage.js';
|
@@ -14,24 +9,16 @@ import { ControlsHeightContext, getGlobalControlsHeight } from '../global/contro
|
|
14
9
|
import UserAgreement from './user-agreement.js';
|
15
10
|
import '../storage/storage__local.js';
|
16
11
|
import '../storage/storage__fallback.js';
|
17
|
-
import 'core-js/modules/es.array.concat.js';
|
18
|
-
import 'core-js/modules/es.array.index-of.js';
|
19
|
-
import 'core-js/modules/es.reflect.delete-property.js';
|
20
12
|
import 'deep-equal';
|
21
|
-
import '
|
22
|
-
import 'core-js/modules/es.array.map.js';
|
13
|
+
import '../_helpers/_rollupPluginBabelHelpers.js';
|
23
14
|
import '../global/get-uid.js';
|
24
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
25
15
|
import '../alert/container.js';
|
26
16
|
import 'react-dom';
|
27
17
|
import 'classnames';
|
28
18
|
import 'prop-types';
|
29
19
|
import '../global/data-tests.js';
|
30
|
-
import 'core-js/modules/es.array.reduce.js';
|
31
|
-
import 'core-js/modules/es.object.entries.js';
|
32
20
|
import '../link/clickableLink.js';
|
33
21
|
import '../_helpers/link.js';
|
34
|
-
import 'core-js/modules/es.object.values.js';
|
35
22
|
import '@jetbrains/icons/exception';
|
36
23
|
import '@jetbrains/icons/checkmark';
|
37
24
|
import '@jetbrains/icons/warning';
|
@@ -40,18 +27,9 @@ import '../icon/icon.js';
|
|
40
27
|
import 'util-deprecate';
|
41
28
|
import '../icon/icon__constants.js';
|
42
29
|
import '../_helpers/icon__svg.js';
|
43
|
-
import 'core-js/modules/es.regexp.exec.js';
|
44
|
-
import 'core-js/modules/es.string.replace.js';
|
45
|
-
import 'core-js/modules/es.string.starts-with.js';
|
46
30
|
import '../global/memoize.js';
|
47
|
-
import 'core-js/modules/es.map.js';
|
48
|
-
import 'core-js/modules/es.weak-map.js';
|
49
31
|
import '../loader-inline/loader-inline.js';
|
50
32
|
import '../global/dom.js';
|
51
|
-
import 'core-js/modules/es.object.assign.js';
|
52
|
-
import 'core-js/modules/es.set.js';
|
53
|
-
import 'core-js/modules/es.string.split.js';
|
54
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
55
33
|
import '../button/button.js';
|
56
34
|
import '@jetbrains/icons/chevron-10px';
|
57
35
|
import '../_helpers/button__classes.js';
|
@@ -61,18 +39,11 @@ import '../popup/popup.js';
|
|
61
39
|
import '../global/schedule-raf.js';
|
62
40
|
import '../shortcuts/shortcuts.js';
|
63
41
|
import '../shortcuts/core.js';
|
64
|
-
import 'core-js/modules/es.array.find-index.js';
|
65
|
-
import 'core-js/modules/es.array.includes.js';
|
66
|
-
import 'core-js/modules/es.array.slice.js';
|
67
|
-
import 'core-js/modules/es.array.splice.js';
|
68
|
-
import 'core-js/modules/es.string.includes.js';
|
69
|
-
import 'core-js/modules/es.string.match.js';
|
70
42
|
import 'combokeys';
|
71
43
|
import '../global/sniffer.js';
|
72
44
|
import 'sniffr';
|
73
45
|
import '../tab-trap/tab-trap.js';
|
74
46
|
import '../popup/position.js';
|
75
|
-
import 'core-js/modules/es.array.sort.js';
|
76
47
|
import '../popup/popup.consts.js';
|
77
48
|
import '../dialog/dialog.js';
|
78
49
|
import '../island/island.js';
|
@@ -88,400 +59,286 @@ import '../panel/panel.js';
|
|
88
59
|
import '../i18n/i18n-context.js';
|
89
60
|
import '../i18n/i18n.js';
|
90
61
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
62
|
+
const GUEST_SESSION_KEY = 'end-user-agreement-consent';
|
63
|
+
const ONE_HOUR = 60 * 60 * 1000; // eslint-disable-line @typescript-eslint/no-magic-numbers
|
64
|
+
const storageKey = 'userAgreementKey';
|
65
|
+
const showMessage = 'userAgreementShow';
|
66
|
+
const hideMessage = 'userAgreementHide';
|
67
|
+
const DEFAULT_CONSENT = {
|
97
68
|
accepted: false,
|
98
69
|
majorVersion: 0,
|
99
70
|
minorVersion: 0
|
100
71
|
};
|
101
|
-
|
72
|
+
const DEFAULT_AGREEMENT = {
|
102
73
|
enabled: false,
|
103
74
|
majorVersion: 0,
|
104
75
|
minorVersion: 0,
|
105
76
|
requiredForREST: false,
|
106
77
|
content: ''
|
107
78
|
};
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
79
|
+
class UserAgreementService {
|
80
|
+
config;
|
81
|
+
constructor(config) {
|
82
|
+
if (!config) {
|
83
|
+
throw new Error('Please pass a config to UserAgreementService');
|
84
|
+
}
|
85
|
+
if (!config.getUserAgreement) {
|
86
|
+
throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
|
87
|
+
}
|
88
|
+
if (!config.getUserConsent) {
|
89
|
+
throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
|
90
|
+
}
|
91
|
+
if (!config.setUserConsent) {
|
92
|
+
throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
|
93
|
+
}
|
94
|
+
this.config = config;
|
95
|
+
this.interval = config.interval || this.interval;
|
96
|
+
}
|
97
|
+
_dialogPromise = null;
|
98
|
+
_alertPromise = null;
|
99
|
+
tabId = Math.random();
|
100
|
+
interval = ONE_HOUR;
|
101
|
+
container = document.createElement('div');
|
102
|
+
reactRoot = createRoot(this.container);
|
103
|
+
storage = new ActualStorage();
|
104
|
+
checkingPromise = null;
|
105
|
+
guest = false;
|
106
|
+
userAgreement = DEFAULT_AGREEMENT;
|
107
|
+
userConsent = DEFAULT_CONSENT;
|
108
|
+
intervalId;
|
109
|
+
startChecking = () => {
|
110
|
+
this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
|
111
|
+
window.addEventListener('storage', this.onStorageEvent);
|
112
|
+
this.checkConsentAndShowDialog();
|
113
|
+
};
|
114
|
+
stopChecking = () => {
|
115
|
+
clearInterval(this.intervalId);
|
116
|
+
window.removeEventListener('storage', this.onStorageEvent);
|
117
|
+
this.hideDialog();
|
118
|
+
};
|
119
|
+
onStorageEvent = event => {
|
135
120
|
if (event.key === storageKey && event.newValue != null) {
|
136
|
-
|
137
|
-
tabId
|
138
|
-
command
|
139
|
-
|
121
|
+
const {
|
122
|
+
tabId,
|
123
|
+
command
|
124
|
+
} = JSON.parse(event.newValue);
|
125
|
+
if (tabId !== this.tabId) {
|
140
126
|
if (command === showMessage) {
|
141
|
-
|
127
|
+
this.checkConsentAndShowDialog(true);
|
142
128
|
} else if (command === hideMessage) {
|
143
|
-
|
129
|
+
this.hideDialogAndAlert(true);
|
144
130
|
}
|
145
131
|
}
|
146
132
|
}
|
147
|
-
}
|
148
|
-
|
133
|
+
};
|
134
|
+
_notifyAboutShowing = () => {
|
149
135
|
localStorage.setItem(storageKey, JSON.stringify({
|
150
136
|
command: showMessage,
|
151
|
-
tabId:
|
137
|
+
tabId: this.tabId
|
152
138
|
}));
|
153
|
-
}
|
154
|
-
|
139
|
+
};
|
140
|
+
_notifyAboutHiding = () => {
|
155
141
|
localStorage.setItem(storageKey, JSON.stringify({
|
156
142
|
command: hideMessage,
|
157
|
-
tabId:
|
158
|
-
}));
|
159
|
-
});
|
160
|
-
_defineProperty(this, "getUserAgreement", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
161
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
162
|
-
while (1) switch (_context.prev = _context.next) {
|
163
|
-
case 0:
|
164
|
-
_context.next = 2;
|
165
|
-
return _this.config.getUserAgreement();
|
166
|
-
case 2:
|
167
|
-
_context.t0 = _context.sent;
|
168
|
-
if (_context.t0) {
|
169
|
-
_context.next = 5;
|
170
|
-
break;
|
171
|
-
}
|
172
|
-
_context.t0 = DEFAULT_AGREEMENT;
|
173
|
-
case 5:
|
174
|
-
_this.userAgreement = _context.t0;
|
175
|
-
return _context.abrupt("return", _this.userAgreement);
|
176
|
-
case 7:
|
177
|
-
case "end":
|
178
|
-
return _context.stop();
|
179
|
-
}
|
180
|
-
}, _callee);
|
181
|
-
})));
|
182
|
-
_defineProperty(this, "getUserConsent", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
183
|
-
var _yield$_this$config$g, guest, endUserAgreementConsent;
|
184
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
185
|
-
while (1) switch (_context2.prev = _context2.next) {
|
186
|
-
case 0:
|
187
|
-
_context2.next = 2;
|
188
|
-
return _this.config.getUserConsent();
|
189
|
-
case 2:
|
190
|
-
_yield$_this$config$g = _context2.sent;
|
191
|
-
guest = _yield$_this$config$g.guest;
|
192
|
-
endUserAgreementConsent = _yield$_this$config$g.endUserAgreementConsent;
|
193
|
-
_this.guest = guest;
|
194
|
-
if (!guest) {
|
195
|
-
_context2.next = 15;
|
196
|
-
break;
|
197
|
-
}
|
198
|
-
_context2.next = 9;
|
199
|
-
return _this.storage.get(GUEST_SESSION_KEY);
|
200
|
-
case 9:
|
201
|
-
_context2.t0 = _context2.sent;
|
202
|
-
if (_context2.t0) {
|
203
|
-
_context2.next = 12;
|
204
|
-
break;
|
205
|
-
}
|
206
|
-
_context2.t0 = _this.userConsent;
|
207
|
-
case 12:
|
208
|
-
_this.userConsent = _context2.t0;
|
209
|
-
_context2.next = 16;
|
210
|
-
break;
|
211
|
-
case 15:
|
212
|
-
_this.userConsent = endUserAgreementConsent || _this.userConsent;
|
213
|
-
case 16:
|
214
|
-
return _context2.abrupt("return", _this.userConsent);
|
215
|
-
case 17:
|
216
|
-
case "end":
|
217
|
-
return _context2.stop();
|
218
|
-
}
|
219
|
-
}, _callee2);
|
220
|
-
})));
|
221
|
-
_defineProperty(this, "checkConsentAndShowDialog", /*#__PURE__*/function () {
|
222
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(withoutNotifications) {
|
223
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
224
|
-
while (1) switch (_context3.prev = _context3.next) {
|
225
|
-
case 0:
|
226
|
-
_context3.next = 2;
|
227
|
-
return _this.checkConsent();
|
228
|
-
case 2:
|
229
|
-
if (!_context3.sent) {
|
230
|
-
_context3.next = 6;
|
231
|
-
break;
|
232
|
-
}
|
233
|
-
return _context3.abrupt("return", _this.hideDialogAndAlert(withoutNotifications));
|
234
|
-
case 6:
|
235
|
-
return _context3.abrupt("return", _this.showDialogOrAlert(withoutNotifications));
|
236
|
-
case 7:
|
237
|
-
case "end":
|
238
|
-
return _context3.stop();
|
239
|
-
}
|
240
|
-
}, _callee3);
|
143
|
+
tabId: this.tabId
|
241
144
|
}));
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
145
|
+
};
|
146
|
+
getUserAgreement = async () => {
|
147
|
+
this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
|
148
|
+
return this.userAgreement;
|
149
|
+
};
|
150
|
+
getUserConsent = async () => {
|
151
|
+
const {
|
152
|
+
guest,
|
153
|
+
endUserAgreementConsent
|
154
|
+
} = await this.config.getUserConsent();
|
155
|
+
this.guest = guest;
|
156
|
+
if (guest) {
|
157
|
+
this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
|
158
|
+
} else {
|
159
|
+
this.userConsent = endUserAgreementConsent || this.userConsent;
|
160
|
+
}
|
161
|
+
return this.userConsent;
|
162
|
+
};
|
163
|
+
checkConsentAndShowDialog = async withoutNotifications => {
|
164
|
+
if (await this.checkConsent()) {
|
165
|
+
return this.hideDialogAndAlert(withoutNotifications);
|
166
|
+
} else {
|
167
|
+
return this.showDialogOrAlert(withoutNotifications);
|
168
|
+
}
|
169
|
+
};
|
170
|
+
checkConsent = async () => {
|
171
|
+
if (!this.checkingPromise) {
|
172
|
+
this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
|
173
|
+
}
|
174
|
+
const [userAgreement, userConsent] = await this.checkingPromise;
|
175
|
+
this.checkingPromise = null;
|
176
|
+
const {
|
177
|
+
enabled,
|
178
|
+
majorVersion: actualVersion
|
179
|
+
} = userAgreement;
|
180
|
+
const {
|
181
|
+
accepted,
|
182
|
+
majorVersion: acceptedVersion
|
183
|
+
} = userConsent;
|
184
|
+
return !enabled || accepted && actualVersion === acceptedVersion;
|
185
|
+
};
|
186
|
+
alertKey;
|
187
|
+
showAlert = withoutNotifications => {
|
188
|
+
if (this._alertPromise) {
|
189
|
+
return this._alertPromise;
|
275
190
|
}
|
276
|
-
|
277
|
-
|
278
|
-
userAgreement
|
279
|
-
reviewNow
|
280
|
-
remindLater
|
281
|
-
|
282
|
-
|
191
|
+
this._alertPromise = new Promise((resolve, reject) => {
|
192
|
+
const {
|
193
|
+
userAgreement,
|
194
|
+
reviewNow,
|
195
|
+
remindLater
|
196
|
+
} = this.config.translations || {};
|
197
|
+
const onRemind = () => {
|
198
|
+
this.hideDialogAndAlert(withoutNotifications);
|
283
199
|
reject('Postponed');
|
284
200
|
};
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
});
|
294
|
-
case 2:
|
295
|
-
_this.hideAlert(withoutNotifications);
|
296
|
-
resolve();
|
297
|
-
case 4:
|
298
|
-
case "end":
|
299
|
-
return _context5.stop();
|
300
|
-
}
|
301
|
-
}, _callee5);
|
302
|
-
}));
|
303
|
-
return function onReview() {
|
304
|
-
return _ref6.apply(this, arguments);
|
305
|
-
};
|
306
|
-
}();
|
307
|
-
var message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
|
201
|
+
const onReview = async () => {
|
202
|
+
await this.showDialog(true, false, {
|
203
|
+
onRemindLater: onRemind
|
204
|
+
});
|
205
|
+
this.hideAlert(withoutNotifications);
|
206
|
+
resolve();
|
207
|
+
};
|
208
|
+
const message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
|
308
209
|
onClick: onReview,
|
309
210
|
"data-test": "review"
|
310
211
|
}, reviewNow || 'Review now'), /*#__PURE__*/React.createElement(Link, {
|
311
212
|
onClick: onRemind,
|
312
213
|
"data-test": "later"
|
313
214
|
}, remindLater || 'Remind me later'));
|
314
|
-
|
215
|
+
this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
|
315
216
|
closeable: false
|
316
217
|
});
|
317
218
|
});
|
318
219
|
if (!withoutNotifications) {
|
319
|
-
|
220
|
+
this._notifyAboutShowing();
|
320
221
|
}
|
321
|
-
return
|
322
|
-
}
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
222
|
+
return this._alertPromise;
|
223
|
+
};
|
224
|
+
hideAlert = withoutNotifications => {
|
225
|
+
const {
|
226
|
+
onRemindLater
|
227
|
+
} = this.config;
|
228
|
+
alertService.remove(this.alertKey);
|
229
|
+
this.alertKey = null;
|
230
|
+
this._alertPromise = null;
|
328
231
|
if (onRemindLater) {
|
329
232
|
onRemindLater();
|
330
233
|
}
|
331
234
|
if (!withoutNotifications) {
|
332
|
-
|
235
|
+
this._notifyAboutHiding();
|
333
236
|
}
|
334
|
-
}
|
335
|
-
|
336
|
-
var
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
}
|
358
|
-
}, _callee6);
|
359
|
-
}));
|
360
|
-
return function onAccept() {
|
361
|
-
return _ref7.apply(this, arguments);
|
237
|
+
};
|
238
|
+
showDialog = (() => {
|
239
|
+
var _this = this;
|
240
|
+
return function (withoutNotifications) {
|
241
|
+
let preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
242
|
+
let restOptions = arguments.length > 2 ? arguments[2] : undefined;
|
243
|
+
const {
|
244
|
+
translations,
|
245
|
+
onDialogShow
|
246
|
+
} = _this.config;
|
247
|
+
const {
|
248
|
+
content
|
249
|
+
} = _this.userAgreement;
|
250
|
+
const show = true;
|
251
|
+
if (!_this._dialogPromise) {
|
252
|
+
_this._dialogPromise = new Promise((resolve, reject) => {
|
253
|
+
const onAccept = async () => {
|
254
|
+
await _this.onAccept();
|
255
|
+
resolve();
|
256
|
+
};
|
257
|
+
const onDecline = async () => {
|
258
|
+
await _this.onDecline();
|
259
|
+
reject();
|
362
260
|
};
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
case 3:
|
374
|
-
case "end":
|
375
|
-
return _context7.stop();
|
376
|
-
}
|
377
|
-
}, _callee7);
|
378
|
-
}));
|
379
|
-
return function onDecline() {
|
380
|
-
return _ref8.apply(this, arguments);
|
261
|
+
const onClose = _this.hideDialogAndAlert;
|
262
|
+
const props = {
|
263
|
+
children: content,
|
264
|
+
show,
|
265
|
+
onAccept,
|
266
|
+
onDecline,
|
267
|
+
onClose,
|
268
|
+
translations,
|
269
|
+
preview,
|
270
|
+
...restOptions
|
381
271
|
};
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
preview
|
392
|
-
}, restOptions);
|
393
|
-
_this.reactRoot.render( /*#__PURE__*/React.createElement(ControlsHeightContext.Provider, {
|
394
|
-
value: getGlobalControlsHeight()
|
395
|
-
}, /*#__PURE__*/React.createElement(UserAgreement, props)));
|
396
|
-
if (onDialogShow) {
|
397
|
-
onDialogShow();
|
272
|
+
_this.reactRoot.render( /*#__PURE__*/React.createElement(ControlsHeightContext.Provider, {
|
273
|
+
value: getGlobalControlsHeight()
|
274
|
+
}, /*#__PURE__*/React.createElement(UserAgreement, props)));
|
275
|
+
if (onDialogShow) {
|
276
|
+
onDialogShow();
|
277
|
+
}
|
278
|
+
});
|
279
|
+
if (!withoutNotifications) {
|
280
|
+
_this._notifyAboutShowing();
|
398
281
|
}
|
399
|
-
});
|
400
|
-
if (!withoutNotifications) {
|
401
|
-
_this._notifyAboutShowing();
|
402
282
|
}
|
403
|
-
|
404
|
-
|
405
|
-
});
|
406
|
-
|
407
|
-
|
408
|
-
|
283
|
+
return _this._dialogPromise;
|
284
|
+
};
|
285
|
+
})();
|
286
|
+
hideDialog = withoutNotifications => {
|
287
|
+
const {
|
288
|
+
onDialogHide
|
289
|
+
} = this.config;
|
290
|
+
this.reactRoot.render(null);
|
409
291
|
if (onDialogHide) {
|
410
292
|
onDialogHide();
|
411
|
-
|
293
|
+
this._dialogPromise = null;
|
412
294
|
if (!withoutNotifications) {
|
413
|
-
|
295
|
+
this._notifyAboutHiding();
|
414
296
|
}
|
415
297
|
}
|
416
|
-
}
|
417
|
-
|
418
|
-
if (
|
419
|
-
return
|
298
|
+
};
|
299
|
+
showDialogOrAlert = (withoutNotifications, preview, restOptions) => {
|
300
|
+
if (this.guest && !this.userAgreement.requiredForREST) {
|
301
|
+
return this.showAlert(withoutNotifications);
|
420
302
|
}
|
421
|
-
return
|
422
|
-
}
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
}
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
onAccept();
|
457
|
-
}
|
458
|
-
case 13:
|
459
|
-
case "end":
|
460
|
-
return _context8.stop();
|
461
|
-
}
|
462
|
-
}, _callee8);
|
463
|
-
})));
|
464
|
-
_defineProperty(this, "onDecline", function () {
|
465
|
-
var onDecline = _this.config.onDecline;
|
466
|
-
_this.hideDialog();
|
303
|
+
return this.showDialog(withoutNotifications, preview, restOptions);
|
304
|
+
};
|
305
|
+
hideDialogAndAlert = withoutNotifications => {
|
306
|
+
this.hideAlert(withoutNotifications);
|
307
|
+
this.hideDialog(withoutNotifications);
|
308
|
+
};
|
309
|
+
onAccept = async () => {
|
310
|
+
const {
|
311
|
+
setUserConsent,
|
312
|
+
onAccept
|
313
|
+
} = this.config;
|
314
|
+
if (this.guest) {
|
315
|
+
const {
|
316
|
+
majorVersion,
|
317
|
+
minorVersion
|
318
|
+
} = this.userAgreement;
|
319
|
+
this.userConsent = {
|
320
|
+
majorVersion,
|
321
|
+
minorVersion,
|
322
|
+
accepted: true
|
323
|
+
};
|
324
|
+
await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
|
325
|
+
} else {
|
326
|
+
this.userConsent = await setUserConsent();
|
327
|
+
}
|
328
|
+
this.hideDialog();
|
329
|
+
if (onAccept) {
|
330
|
+
onAccept();
|
331
|
+
}
|
332
|
+
};
|
333
|
+
onDecline = () => {
|
334
|
+
const {
|
335
|
+
onDecline
|
336
|
+
} = this.config;
|
337
|
+
this.hideDialog();
|
467
338
|
if (onDecline) {
|
468
339
|
onDecline();
|
469
340
|
}
|
470
|
-
}
|
471
|
-
|
472
|
-
throw new Error('Please pass a config to UserAgreementService');
|
473
|
-
}
|
474
|
-
if (!config.getUserAgreement) {
|
475
|
-
throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
|
476
|
-
}
|
477
|
-
if (!config.getUserConsent) {
|
478
|
-
throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
|
479
|
-
}
|
480
|
-
if (!config.setUserConsent) {
|
481
|
-
throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
|
482
|
-
}
|
483
|
-
this.config = config;
|
484
|
-
this.interval = config.interval || this.interval;
|
485
|
-
});
|
341
|
+
};
|
342
|
+
}
|
486
343
|
|
487
344
|
export { UserAgreementService as default, hideMessage, showMessage };
|