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