@jetbrains/ring-ui-built 7.0.65 → 7.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_helpers/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +18 -26
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { createRoot } from 'react-dom/client';
|
|
5
3
|
import LocalStorage from '../storage/storage-local.js';
|
|
@@ -25,8 +23,6 @@ import '../icon/icon.js';
|
|
|
25
23
|
import 'util-deprecate';
|
|
26
24
|
import '../icon/icon.constants.js';
|
|
27
25
|
import '../_helpers/icon-svg.js';
|
|
28
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
29
|
-
import 'core-js/modules/es.string.replace.js';
|
|
30
26
|
import '../global/memoize.js';
|
|
31
27
|
import '../loader-inline/loader-inline.js';
|
|
32
28
|
import '../global/dom.js';
|
|
@@ -46,7 +42,6 @@ import 'sniffr';
|
|
|
46
42
|
import '../tab-trap/tab-trap.js';
|
|
47
43
|
import '../global/configuration.js';
|
|
48
44
|
import '../popup/position.js';
|
|
49
|
-
import 'core-js/modules/es.array.sort.js';
|
|
50
45
|
import '../popup/popup.consts.js';
|
|
51
46
|
import '../popup/position-css.js';
|
|
52
47
|
import '../dialog/dialog.js';
|
|
@@ -87,271 +82,271 @@ function ignorePostponedCatchReason(reason) {
|
|
|
87
82
|
throw reason;
|
|
88
83
|
}
|
|
89
84
|
class UserAgreementService {
|
|
85
|
+
config;
|
|
90
86
|
constructor(config) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
_defineProperty(this, "_notifyAboutShowing", () => {
|
|
131
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
132
|
-
command: showMessage,
|
|
133
|
-
tabId: this.tabId
|
|
134
|
-
}));
|
|
135
|
-
});
|
|
136
|
-
_defineProperty(this, "_notifyAboutHiding", () => {
|
|
137
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
138
|
-
command: hideMessage,
|
|
139
|
-
tabId: this.tabId
|
|
140
|
-
}));
|
|
141
|
-
});
|
|
142
|
-
_defineProperty(this, "getUserAgreement", async () => {
|
|
143
|
-
this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
|
|
144
|
-
return this.userAgreement;
|
|
145
|
-
});
|
|
146
|
-
_defineProperty(this, "getUserConsent", async () => {
|
|
87
|
+
if (!config) {
|
|
88
|
+
throw new Error('Please pass a config to UserAgreementService');
|
|
89
|
+
}
|
|
90
|
+
if (!config.getUserAgreement) {
|
|
91
|
+
throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
|
|
92
|
+
}
|
|
93
|
+
if (!config.getUserConsent) {
|
|
94
|
+
throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
|
|
95
|
+
}
|
|
96
|
+
if (!config.setUserConsent) {
|
|
97
|
+
throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
|
|
98
|
+
}
|
|
99
|
+
this.config = config;
|
|
100
|
+
this.interval = config.interval || this.interval;
|
|
101
|
+
}
|
|
102
|
+
_dialogPromise = null;
|
|
103
|
+
_alertPromise = null;
|
|
104
|
+
tabId = Math.random();
|
|
105
|
+
interval = ONE_HOUR;
|
|
106
|
+
container = document.createElement('div');
|
|
107
|
+
reactRoot = createRoot(this.container);
|
|
108
|
+
storage = new LocalStorage();
|
|
109
|
+
checkingPromise = null;
|
|
110
|
+
guest = false;
|
|
111
|
+
userAgreement = DEFAULT_AGREEMENT;
|
|
112
|
+
userConsent = DEFAULT_CONSENT;
|
|
113
|
+
intervalId;
|
|
114
|
+
startChecking = () => {
|
|
115
|
+
this.intervalId = window.setInterval(() => this.checkConsentAndShowDialog().catch(ignorePostponedCatchReason), this.interval);
|
|
116
|
+
window.addEventListener('storage', this.onStorageEvent);
|
|
117
|
+
this.checkConsentAndShowDialog().catch(ignorePostponedCatchReason);
|
|
118
|
+
};
|
|
119
|
+
stopChecking = () => {
|
|
120
|
+
clearInterval(this.intervalId);
|
|
121
|
+
window.removeEventListener('storage', this.onStorageEvent);
|
|
122
|
+
this.hideDialog();
|
|
123
|
+
};
|
|
124
|
+
onStorageEvent = event => {
|
|
125
|
+
if (event.key === storageKey && event.newValue !== null) {
|
|
147
126
|
const {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} =
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return this.userConsent;
|
|
158
|
-
});
|
|
159
|
-
_defineProperty(this, "checkConsentAndShowDialog", async withoutNotifications => {
|
|
160
|
-
if (await this.checkConsent()) {
|
|
161
|
-
return this.hideDialogAndAlert(withoutNotifications);
|
|
162
|
-
}
|
|
163
|
-
return this.showDialogOrAlert(withoutNotifications);
|
|
164
|
-
});
|
|
165
|
-
_defineProperty(this, "checkConsent", async () => {
|
|
166
|
-
if (!this.checkingPromise) {
|
|
167
|
-
this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
|
|
127
|
+
tabId,
|
|
128
|
+
command
|
|
129
|
+
} = JSON.parse(event.newValue);
|
|
130
|
+
if (tabId !== this.tabId) {
|
|
131
|
+
if (command === showMessage) {
|
|
132
|
+
this.checkConsentAndShowDialog(true);
|
|
133
|
+
} else if (command === hideMessage) {
|
|
134
|
+
this.hideDialogAndAlert(true);
|
|
135
|
+
}
|
|
168
136
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
_notifyAboutShowing = () => {
|
|
140
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
141
|
+
command: showMessage,
|
|
142
|
+
tabId: this.tabId
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
_notifyAboutHiding = () => {
|
|
146
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
147
|
+
command: hideMessage,
|
|
148
|
+
tabId: this.tabId
|
|
149
|
+
}));
|
|
150
|
+
};
|
|
151
|
+
getUserAgreement = async () => {
|
|
152
|
+
this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
|
|
153
|
+
return this.userAgreement;
|
|
154
|
+
};
|
|
155
|
+
getUserConsent = async () => {
|
|
156
|
+
const {
|
|
157
|
+
guest,
|
|
158
|
+
endUserAgreementConsent
|
|
159
|
+
} = await this.config.getUserConsent();
|
|
160
|
+
this.guest = guest;
|
|
161
|
+
if (guest) {
|
|
162
|
+
this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
|
|
163
|
+
} else {
|
|
164
|
+
this.userConsent = endUserAgreementConsent || this.userConsent;
|
|
165
|
+
}
|
|
166
|
+
return this.userConsent;
|
|
167
|
+
};
|
|
168
|
+
checkConsentAndShowDialog = async withoutNotifications => {
|
|
169
|
+
if (await this.checkConsent()) {
|
|
170
|
+
return this.hideDialogAndAlert(withoutNotifications);
|
|
171
|
+
}
|
|
172
|
+
return this.showDialogOrAlert(withoutNotifications);
|
|
173
|
+
};
|
|
174
|
+
checkConsent = async () => {
|
|
175
|
+
if (!this.checkingPromise) {
|
|
176
|
+
this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
|
|
177
|
+
}
|
|
178
|
+
const [userAgreement, userConsent] = await this.checkingPromise;
|
|
179
|
+
this.checkingPromise = null;
|
|
180
|
+
const {
|
|
181
|
+
enabled,
|
|
182
|
+
majorVersion: actualVersion
|
|
183
|
+
} = userAgreement;
|
|
184
|
+
const {
|
|
185
|
+
accepted,
|
|
186
|
+
majorVersion: acceptedVersion
|
|
187
|
+
} = userConsent;
|
|
188
|
+
return !enabled || accepted && actualVersion === acceptedVersion;
|
|
189
|
+
};
|
|
190
|
+
alertKey;
|
|
191
|
+
showAlert = withoutNotifications => {
|
|
192
|
+
if (this._alertPromise) {
|
|
193
|
+
return this._alertPromise;
|
|
194
|
+
}
|
|
195
|
+
this._alertPromise = new Promise((resolve, reject) => {
|
|
175
196
|
const {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
197
|
+
userAgreement,
|
|
198
|
+
reviewNow,
|
|
199
|
+
remindLater
|
|
200
|
+
} = this.config.translations || {};
|
|
201
|
+
const onRemind = () => {
|
|
202
|
+
this.hideDialogAndAlert(withoutNotifications);
|
|
203
|
+
reject('Postponed');
|
|
204
|
+
};
|
|
205
|
+
const onReview = async () => {
|
|
206
|
+
await this.showDialog(true, false, {
|
|
207
|
+
onRemindLater: onRemind
|
|
208
|
+
});
|
|
209
|
+
this.hideAlert(withoutNotifications);
|
|
210
|
+
resolve();
|
|
211
|
+
};
|
|
212
|
+
const message = jsxs(Group, {
|
|
213
|
+
children: [jsx("span", {
|
|
214
|
+
children: userAgreement || 'User Agreement'
|
|
215
|
+
}), jsx(Link, {
|
|
216
|
+
onClick: onReview,
|
|
217
|
+
"data-test": 'review',
|
|
218
|
+
children: reviewNow || 'Review now'
|
|
219
|
+
}), jsx(Link, {
|
|
220
|
+
onClick: onRemind,
|
|
221
|
+
"data-test": 'later',
|
|
222
|
+
children: remindLater || 'Remind me later'
|
|
223
|
+
})]
|
|
224
|
+
});
|
|
225
|
+
this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
|
|
226
|
+
closeable: false
|
|
227
|
+
});
|
|
180
228
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
229
|
+
if (!withoutNotifications) {
|
|
230
|
+
this._notifyAboutShowing();
|
|
231
|
+
}
|
|
232
|
+
return this._alertPromise;
|
|
233
|
+
};
|
|
234
|
+
hideAlert = withoutNotifications => {
|
|
235
|
+
const {
|
|
236
|
+
onRemindLater
|
|
237
|
+
} = this.config;
|
|
238
|
+
alertService.remove(this.alertKey);
|
|
239
|
+
this.alertKey = null;
|
|
240
|
+
this._alertPromise = null;
|
|
241
|
+
if (onRemindLater) {
|
|
242
|
+
onRemindLater();
|
|
243
|
+
}
|
|
244
|
+
if (!withoutNotifications) {
|
|
245
|
+
this._notifyAboutHiding();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
showDialog = (withoutNotifications, preview = false, restOptions) => {
|
|
249
|
+
const {
|
|
250
|
+
translations,
|
|
251
|
+
onDialogShow
|
|
252
|
+
} = this.config;
|
|
253
|
+
const {
|
|
254
|
+
content
|
|
255
|
+
} = this.userAgreement;
|
|
256
|
+
const show = true;
|
|
257
|
+
if (!this._dialogPromise) {
|
|
258
|
+
this._dialogPromise = new Promise((resolve, reject) => {
|
|
259
|
+
const onAccept = async () => {
|
|
260
|
+
await this.onAccept();
|
|
201
261
|
resolve();
|
|
202
262
|
};
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
263
|
+
const onDecline = async () => {
|
|
264
|
+
await this.onDecline();
|
|
265
|
+
reject();
|
|
266
|
+
};
|
|
267
|
+
const onClose = this.hideDialogAndAlert;
|
|
268
|
+
const props = {
|
|
269
|
+
children: content,
|
|
270
|
+
show,
|
|
271
|
+
onAccept,
|
|
272
|
+
onDecline,
|
|
273
|
+
onClose,
|
|
274
|
+
translations,
|
|
275
|
+
preview,
|
|
276
|
+
...restOptions
|
|
277
|
+
};
|
|
278
|
+
this.reactRoot.render(jsx(ControlsHeightContext.Provider, {
|
|
279
|
+
value: getGlobalControlsHeight(),
|
|
280
|
+
children: jsx(UserAgreement, {
|
|
281
|
+
...props
|
|
282
|
+
})
|
|
283
|
+
}));
|
|
284
|
+
if (onDialogShow) {
|
|
285
|
+
onDialogShow();
|
|
286
|
+
}
|
|
219
287
|
});
|
|
220
288
|
if (!withoutNotifications) {
|
|
221
289
|
this._notifyAboutShowing();
|
|
222
290
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
291
|
+
}
|
|
292
|
+
return this._dialogPromise;
|
|
293
|
+
};
|
|
294
|
+
hideDialog = withoutNotifications => {
|
|
295
|
+
const {
|
|
296
|
+
onDialogHide
|
|
297
|
+
} = this.config;
|
|
298
|
+
this.reactRoot.render(null);
|
|
299
|
+
if (onDialogHide) {
|
|
300
|
+
onDialogHide();
|
|
301
|
+
this._dialogPromise = null;
|
|
235
302
|
if (!withoutNotifications) {
|
|
236
303
|
this._notifyAboutHiding();
|
|
237
304
|
}
|
|
238
|
-
});
|
|
239
|
-
_defineProperty(this, "showDialog", function (withoutNotifications) {
|
|
240
|
-
let preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
241
|
-
let restOptions = arguments.length > 2 ? arguments[2] : undefined;
|
|
242
|
-
const {
|
|
243
|
-
translations,
|
|
244
|
-
onDialogShow
|
|
245
|
-
} = _this.config;
|
|
246
|
-
const {
|
|
247
|
-
content
|
|
248
|
-
} = _this.userAgreement;
|
|
249
|
-
const show = true;
|
|
250
|
-
if (!_this._dialogPromise) {
|
|
251
|
-
_this._dialogPromise = new Promise((resolve, reject) => {
|
|
252
|
-
const onAccept = async () => {
|
|
253
|
-
await _this.onAccept();
|
|
254
|
-
resolve();
|
|
255
|
-
};
|
|
256
|
-
const onDecline = async () => {
|
|
257
|
-
await _this.onDecline();
|
|
258
|
-
reject();
|
|
259
|
-
};
|
|
260
|
-
const onClose = _this.hideDialogAndAlert;
|
|
261
|
-
const props = _objectSpread2({
|
|
262
|
-
children: content,
|
|
263
|
-
show,
|
|
264
|
-
onAccept,
|
|
265
|
-
onDecline,
|
|
266
|
-
onClose,
|
|
267
|
-
translations,
|
|
268
|
-
preview
|
|
269
|
-
}, restOptions);
|
|
270
|
-
_this.reactRoot.render(jsx(ControlsHeightContext.Provider, {
|
|
271
|
-
value: getGlobalControlsHeight(),
|
|
272
|
-
children: jsx(UserAgreement, _objectSpread2({}, props))
|
|
273
|
-
}));
|
|
274
|
-
if (onDialogShow) {
|
|
275
|
-
onDialogShow();
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
if (!withoutNotifications) {
|
|
279
|
-
_this._notifyAboutShowing();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return _this._dialogPromise;
|
|
283
|
-
});
|
|
284
|
-
_defineProperty(this, "hideDialog", withoutNotifications => {
|
|
285
|
-
const {
|
|
286
|
-
onDialogHide
|
|
287
|
-
} = this.config;
|
|
288
|
-
this.reactRoot.render(null);
|
|
289
|
-
if (onDialogHide) {
|
|
290
|
-
onDialogHide();
|
|
291
|
-
this._dialogPromise = null;
|
|
292
|
-
if (!withoutNotifications) {
|
|
293
|
-
this._notifyAboutHiding();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
_defineProperty(this, "showDialogOrAlert", (withoutNotifications, preview, restOptions) => {
|
|
298
|
-
if (this.guest && !this.userAgreement.requiredForREST) {
|
|
299
|
-
return this.showAlert(withoutNotifications);
|
|
300
|
-
}
|
|
301
|
-
return this.showDialog(withoutNotifications, preview, restOptions);
|
|
302
|
-
});
|
|
303
|
-
_defineProperty(this, "hideDialogAndAlert", withoutNotifications => {
|
|
304
|
-
this.hideAlert(withoutNotifications);
|
|
305
|
-
this.hideDialog(withoutNotifications);
|
|
306
|
-
});
|
|
307
|
-
_defineProperty(this, "onAccept", async () => {
|
|
308
|
-
const {
|
|
309
|
-
setUserConsent,
|
|
310
|
-
onAccept
|
|
311
|
-
} = this.config;
|
|
312
|
-
if (this.guest) {
|
|
313
|
-
const {
|
|
314
|
-
majorVersion,
|
|
315
|
-
minorVersion
|
|
316
|
-
} = this.userAgreement;
|
|
317
|
-
this.userConsent = {
|
|
318
|
-
majorVersion,
|
|
319
|
-
minorVersion,
|
|
320
|
-
accepted: true
|
|
321
|
-
};
|
|
322
|
-
await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
|
|
323
|
-
} else {
|
|
324
|
-
this.userConsent = await setUserConsent();
|
|
325
|
-
}
|
|
326
|
-
this.hideDialog();
|
|
327
|
-
if (onAccept) {
|
|
328
|
-
onAccept();
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
_defineProperty(this, "onDecline", () => {
|
|
332
|
-
const {
|
|
333
|
-
onDecline
|
|
334
|
-
} = this.config;
|
|
335
|
-
this.hideDialog();
|
|
336
|
-
if (onDecline) {
|
|
337
|
-
onDecline();
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
if (!config) {
|
|
341
|
-
throw new Error('Please pass a config to UserAgreementService');
|
|
342
305
|
}
|
|
343
|
-
|
|
344
|
-
|
|
306
|
+
};
|
|
307
|
+
showDialogOrAlert = (withoutNotifications, preview, restOptions) => {
|
|
308
|
+
if (this.guest && !this.userAgreement.requiredForREST) {
|
|
309
|
+
return this.showAlert(withoutNotifications);
|
|
345
310
|
}
|
|
346
|
-
|
|
347
|
-
|
|
311
|
+
return this.showDialog(withoutNotifications, preview, restOptions);
|
|
312
|
+
};
|
|
313
|
+
hideDialogAndAlert = withoutNotifications => {
|
|
314
|
+
this.hideAlert(withoutNotifications);
|
|
315
|
+
this.hideDialog(withoutNotifications);
|
|
316
|
+
};
|
|
317
|
+
onAccept = async () => {
|
|
318
|
+
const {
|
|
319
|
+
setUserConsent,
|
|
320
|
+
onAccept
|
|
321
|
+
} = this.config;
|
|
322
|
+
if (this.guest) {
|
|
323
|
+
const {
|
|
324
|
+
majorVersion,
|
|
325
|
+
minorVersion
|
|
326
|
+
} = this.userAgreement;
|
|
327
|
+
this.userConsent = {
|
|
328
|
+
majorVersion,
|
|
329
|
+
minorVersion,
|
|
330
|
+
accepted: true
|
|
331
|
+
};
|
|
332
|
+
await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
|
|
333
|
+
} else {
|
|
334
|
+
this.userConsent = await setUserConsent();
|
|
348
335
|
}
|
|
349
|
-
|
|
350
|
-
|
|
336
|
+
this.hideDialog();
|
|
337
|
+
if (onAccept) {
|
|
338
|
+
onAccept();
|
|
351
339
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
340
|
+
};
|
|
341
|
+
onDecline = () => {
|
|
342
|
+
const {
|
|
343
|
+
onDecline
|
|
344
|
+
} = this.config;
|
|
345
|
+
this.hideDialog();
|
|
346
|
+
if (onDecline) {
|
|
347
|
+
onDecline();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
355
350
|
}
|
|
356
351
|
|
|
357
352
|
export { UserAgreementService as default, hideMessage, showMessage };
|