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