@jetbrains/ring-ui 4.1.0-beta.9 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/container.css +1 -1
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +1 -1
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.js +1 -0
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +31 -6
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +1 -1
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +5 -2
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +2 -2
- package/components/dialog-ng/dialog-ng.js +7 -8
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/island/island.css +4 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -5
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -1
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +4 -8
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +27 -0
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -1
- package/components/user-agreement/user-agreement.examples.js +7 -4
- package/components/user-agreement/user-agreement.js +1 -0
- package/package.json +75 -78
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -127
- package/dist/_helpers/anchor.js +0 -33
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button__classes.js +0 -39
- package/dist/_helpers/caption.js +0 -25
- package/dist/_helpers/card.js +0 -77
- package/dist/_helpers/date-picker.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -56
- package/dist/_helpers/grid.js +0 -3
- package/dist/_helpers/header.js +0 -3
- package/dist/_helpers/icon__svg.js +0 -83
- package/dist/_helpers/inject-styles.js +0 -22
- package/dist/_helpers/island.js +0 -3
- package/dist/_helpers/list.js +0 -3
- package/dist/_helpers/query-assist__suggestions.js +0 -95
- package/dist/_helpers/select__filter.js +0 -78
- package/dist/_helpers/services-link.js +0 -42
- package/dist/_helpers/sidebar.js +0 -127
- package/dist/_helpers/table.js +0 -3
- package/dist/_helpers/tabs.js +0 -3
- package/dist/_helpers/title.js +0 -99
- package/dist/alert/alert.js +0 -254
- package/dist/alert/container.js +0 -50
- package/dist/alert-service/alert-service.js +0 -159
- package/dist/analytics/analytics.js +0 -116
- package/dist/analytics/analytics__custom-plugin.js +0 -127
- package/dist/analytics/analytics__fus-plugin.js +0 -101
- package/dist/analytics/analytics__ga-plugin.js +0 -66
- package/dist/analytics/analytics__plugin-utils.js +0 -79
- package/dist/auth/auth.js +0 -90
- package/dist/auth/auth__core.js +0 -987
- package/dist/auth/background-flow.js +0 -123
- package/dist/auth/down-notification.js +0 -111
- package/dist/auth/iframe-flow.js +0 -147
- package/dist/auth/landing-entry.js +0 -5
- package/dist/auth/landing.js +0 -84
- package/dist/auth/request-builder.js +0 -75
- package/dist/auth/response-parser.js +0 -117
- package/dist/auth/storage.js +0 -279
- package/dist/auth/token-validator.js +0 -176
- package/dist/auth/window-flow.js +0 -133
- package/dist/auth-dialog/auth-dialog.js +0 -132
- package/dist/auth-dialog-service/auth-dialog-service.js +0 -67
- package/dist/avatar/avatar-example-datauri.js +0 -26
- package/dist/avatar/avatar.js +0 -155
- package/dist/badge/badge.js +0 -52
- package/dist/button/button.js +0 -117
- package/dist/button/button__classes.js +0 -5
- package/dist/button-group/button-group.js +0 -30
- package/dist/button-group/caption.js +0 -5
- package/dist/button-set/button-set.js +0 -27
- package/dist/button-toolbar/button-toolbar.js +0 -30
- package/dist/caret/caret.js +0 -264
- package/dist/checkbox/checkbox.js +0 -110
- package/dist/confirm/confirm.js +0 -122
- package/dist/confirm-service/confirm-service.js +0 -112
- package/dist/content-layout/content-layout.js +0 -67
- package/dist/content-layout/sidebar.js +0 -6
- package/dist/contenteditable/contenteditable.js +0 -81
- package/dist/data-list/data-list.js +0 -203
- package/dist/data-list/data-list.mock.js +0 -190
- package/dist/data-list/item.js +0 -225
- package/dist/data-list/selection.js +0 -101
- package/dist/data-list/title.js +0 -16
- package/dist/date-picker/consts.js +0 -70
- package/dist/date-picker/date-input.js +0 -169
- package/dist/date-picker/date-picker.js +0 -356
- package/dist/date-picker/date-popup.js +0 -459
- package/dist/date-picker/day.js +0 -119
- package/dist/date-picker/formats.js +0 -3
- package/dist/date-picker/month-names.js +0 -92
- package/dist/date-picker/month-slider.js +0 -83
- package/dist/date-picker/month.js +0 -48
- package/dist/date-picker/months.js +0 -121
- package/dist/date-picker/weekdays.js +0 -24
- package/dist/date-picker/years.js +0 -109
- package/dist/dialog/dialog.js +0 -197
- package/dist/dialog/dialog__body-scroll-preventer.js +0 -2
- package/dist/dropdown/anchor.js +0 -16
- package/dist/dropdown/dropdown.js +0 -236
- package/dist/error-bubble/error-bubble.js +0 -59
- package/dist/error-message/error-message.js +0 -55
- package/dist/footer/footer.js +0 -127
- package/dist/global/angular-component-factory.js +0 -83
- package/dist/global/compose.js +0 -9
- package/dist/global/composeRefs.js +0 -15
- package/dist/global/conic-gradient.js +0 -37
- package/dist/global/create-stateful-context.js +0 -54
- package/dist/global/data-tests.js +0 -22
- package/dist/global/dom.js +0 -124
- package/dist/global/focus-sensor-hoc.js +0 -147
- package/dist/global/fuzzy-highlight.js +0 -67
- package/dist/global/get-event-key.js +0 -111
- package/dist/global/get-uid.js +0 -15
- package/dist/global/inject-styles.js +0 -17
- package/dist/global/linear-function.js +0 -18
- package/dist/global/listeners.js +0 -42
- package/dist/global/memoize.js +0 -18
- package/dist/global/normalize-indent.js +0 -28
- package/dist/global/promise-with-timeout.js +0 -13
- package/dist/global/radial-gradient-mask.js +0 -49
- package/dist/global/react-dom-renderer.js +0 -45
- package/dist/global/rerender-hoc.js +0 -53
- package/dist/global/ring-angular-component.js +0 -24
- package/dist/global/schedule-raf.js +0 -31
- package/dist/global/sniffer.js +0 -6
- package/dist/global/supports-css.js +0 -20
- package/dist/global/theme.js +0 -56
- package/dist/global/trivial-template-tag.js +0 -15
- package/dist/global/url.js +0 -163
- package/dist/global/variables_dark.js +0 -57
- package/dist/grid/col.js +0 -62
- package/dist/grid/grid.js +0 -35
- package/dist/grid/row.js +0 -66
- package/dist/group/group.js +0 -34
- package/dist/header/header.js +0 -144
- package/dist/header/logo.js +0 -39
- package/dist/header/profile.js +0 -212
- package/dist/header/services-link.js +0 -10
- package/dist/header/services.js +0 -135
- package/dist/header/smart-profile.js +0 -227
- package/dist/header/smart-services.js +0 -159
- package/dist/header/tray-icon.js +0 -45
- package/dist/header/tray.js +0 -33
- package/dist/heading/heading.js +0 -76
- package/dist/http/http.js +0 -216
- package/dist/http/http.mock.js +0 -65
- package/dist/hub-source/hub-source.js +0 -130
- package/dist/hub-source/hub-source__user.js +0 -28
- package/dist/hub-source/hub-source__users-groups.js +0 -62
- package/dist/icon/icon.js +0 -105
- package/dist/icon/icon__constants.js +0 -33
- package/dist/icon/icon__svg.js +0 -6
- package/dist/icon/index.js +0 -9
- package/dist/input/input.js +0 -231
- package/dist/island/adaptive-island-hoc.js +0 -48
- package/dist/island/content.js +0 -158
- package/dist/island/header.js +0 -85
- package/dist/island/island.js +0 -53
- package/dist/island-legacy/content-legacy.js +0 -28
- package/dist/island-legacy/header-legacy.js +0 -30
- package/dist/island-legacy/island-legacy.js +0 -30
- package/dist/link/clickableLink.js +0 -65
- package/dist/link/link.js +0 -118
- package/dist/list/consts.js +0 -26
- package/dist/list/list.js +0 -800
- package/dist/list/list__custom.js +0 -82
- package/dist/list/list__hint.js +0 -26
- package/dist/list/list__item.js +0 -197
- package/dist/list/list__link.js +0 -65
- package/dist/list/list__separator.js +0 -30
- package/dist/list/list__title.js +0 -39
- package/dist/list/list__users-groups-source.js +0 -124
- package/dist/loader/loader.js +0 -72
- package/dist/loader/loader__core.js +0 -272
- package/dist/loader-inline/inject-styles.js +0 -11
- package/dist/loader-inline/loader-inline.js +0 -58
- package/dist/loader-screen/loader-screen.js +0 -46
- package/dist/login-dialog/login-dialog.js +0 -184
- package/dist/login-dialog/service.js +0 -67
- package/dist/message/message.js +0 -232
- package/dist/old-browsers-message/old-browsers-message.js +0 -101
- package/dist/old-browsers-message/old-browsers-message__stop.js +0 -5
- package/dist/old-browsers-message/white-list.js +0 -34
- package/dist/pager/pager.js +0 -352
- package/dist/panel/panel.js +0 -34
- package/dist/permissions/permissions.js +0 -200
- package/dist/permissions/permissions__cache.js +0 -272
- package/dist/popup/popup.consts.js +0 -41
- package/dist/popup/popup.js +0 -389
- package/dist/popup/popup.target.js +0 -27
- package/dist/popup/position.js +0 -280
- package/dist/popup-menu/popup-menu.js +0 -108
- package/dist/progress-bar/progress-bar.js +0 -111
- package/dist/proxy-attrs/proxy-attrs.js +0 -19
- package/dist/query-assist/query-assist.js +0 -1023
- package/dist/query-assist/query-assist__suggestions.js +0 -43
- package/dist/radio/radio.js +0 -39
- package/dist/radio/radio__item.js +0 -82
- package/dist/select/select.js +0 -1335
- package/dist/select/select__filter.js +0 -49
- package/dist/select/select__popup.js +0 -541
- package/dist/shortcuts/core.js +0 -245
- package/dist/shortcuts/shortcut-title.js +0 -51
- package/dist/shortcuts/shortcuts-hoc.js +0 -43
- package/dist/shortcuts/shortcuts.js +0 -72
- package/dist/storage/storage.js +0 -55
- package/dist/storage/storage__fallback.js +0 -214
- package/dist/storage/storage__local.js +0 -150
- package/dist/style.css +0 -1
- package/dist/tab-trap/tab-trap.js +0 -178
- package/dist/table/cell.js +0 -25
- package/dist/table/disable-hover-hoc.js +0 -53
- package/dist/table/header-cell.js +0 -91
- package/dist/table/header.js +0 -189
- package/dist/table/multitable.js +0 -140
- package/dist/table/row-with-focus-sensor.js +0 -79
- package/dist/table/row.js +0 -270
- package/dist/table/selection-adapter.js +0 -14
- package/dist/table/selection-shortcuts-hoc.js +0 -212
- package/dist/table/selection.js +0 -221
- package/dist/table/smart-table.js +0 -113
- package/dist/table/table.js +0 -405
- package/dist/tabs/collapsible-more.js +0 -193
- package/dist/tabs/collapsible-tab.js +0 -90
- package/dist/tabs/collapsible-tabs.js +0 -361
- package/dist/tabs/custom-item.js +0 -13
- package/dist/tabs/dumb-tabs.js +0 -159
- package/dist/tabs/smart-tabs.js +0 -102
- package/dist/tabs/tab-link.js +0 -35
- package/dist/tabs/tab.js +0 -32
- package/dist/tabs/tabs.js +0 -65
- package/dist/tag/tag.js +0 -190
- package/dist/tags-input/tags-input.js +0 -474
- package/dist/tags-list/tags-list.js +0 -94
- package/dist/text/text.js +0 -38
- package/dist/toggle/toggle.js +0 -80
- package/dist/tooltip/tooltip.js +0 -205
- package/dist/user-card/card.js +0 -14
- package/dist/user-card/smart-user-card-tooltip.js +0 -112
- package/dist/user-card/tooltip.js +0 -91
- package/dist/user-card/user-card.js +0 -46
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _extends, c as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from 'react-dom';
|
|
4
|
-
import getUID from '../global/get-uid.js';
|
|
5
|
-
import Alert, { ANIMATION_TIME } from '../alert/alert.js';
|
|
6
|
-
import Alerts from '../alert/container.js';
|
|
7
|
-
import 'classnames';
|
|
8
|
-
import 'prop-types';
|
|
9
|
-
import '@jetbrains/icons/exception';
|
|
10
|
-
import '@jetbrains/icons/checkmark';
|
|
11
|
-
import '@jetbrains/icons/warning';
|
|
12
|
-
import '@jetbrains/icons/close';
|
|
13
|
-
import '../icon/icon.js';
|
|
14
|
-
import 'util-deprecate';
|
|
15
|
-
import '../icon/icon__constants.js';
|
|
16
|
-
import '../_helpers/icon__svg.js';
|
|
17
|
-
import '../global/memoize.js';
|
|
18
|
-
import '../loader-inline/loader-inline.js';
|
|
19
|
-
import '../global/theme.js';
|
|
20
|
-
import '../global/data-tests.js';
|
|
21
|
-
import '../_helpers/inject-styles.js';
|
|
22
|
-
import '../global/conic-gradient.js';
|
|
23
|
-
import 'conic-gradient';
|
|
24
|
-
import '../global/supports-css.js';
|
|
25
|
-
import '../global/inject-styles.js';
|
|
26
|
-
import '../global/radial-gradient-mask.js';
|
|
27
|
-
import '../global/dom.js';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @name Alert Service
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
class AlertService {
|
|
34
|
-
constructor() {
|
|
35
|
-
_defineProperty(this, "defaultTimeout", 0);
|
|
36
|
-
|
|
37
|
-
_defineProperty(this, "showingAlerts", []);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "containerElement", document.createElement('div'));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_getShowingAlerts() {
|
|
43
|
-
return [...this.showingAlerts];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
renderAlertContainer(alerts) {
|
|
47
|
-
if (alerts.length === 0) {
|
|
48
|
-
return /*#__PURE__*/React.createElement("span", null);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return /*#__PURE__*/React.createElement(Alerts, null, alerts.map(alert => {
|
|
52
|
-
const {
|
|
53
|
-
message,
|
|
54
|
-
key
|
|
55
|
-
} = alert,
|
|
56
|
-
rest = _objectWithoutProperties(alert, ["message", "key"]);
|
|
57
|
-
|
|
58
|
-
return /*#__PURE__*/React.createElement(Alert, _extends({
|
|
59
|
-
key: key
|
|
60
|
-
}, rest), message);
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Renders alert container into virtual node to skip maintaining container
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
renderAlerts() {
|
|
69
|
-
render(this.renderAlertContainer(this.showingAlerts), this.containerElement);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
findSameAlert(message, type) {
|
|
73
|
-
return this.showingAlerts.filter(it => it.type === type && it.message === message)[0];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
startAlertClosing(alert) {
|
|
77
|
-
alert.isClosing = true;
|
|
78
|
-
this.renderAlerts();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
remove(key) {
|
|
82
|
-
const alertToClose = this.showingAlerts.filter(alert => alert.key === key)[0];
|
|
83
|
-
|
|
84
|
-
if (!alertToClose) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.startAlertClosing(alertToClose);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
removeWithoutAnimation(key) {
|
|
92
|
-
this.showingAlerts = this.showingAlerts.filter(alert => alert.key !== key);
|
|
93
|
-
this.renderAlerts();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
stopShakingWhenAnimationDone(shakingAlert) {
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
shakingAlert.showWithAnimation = false;
|
|
99
|
-
shakingAlert.isShaking = false;
|
|
100
|
-
this.renderAlerts();
|
|
101
|
-
}, ANIMATION_TIME);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
addAlert(message, type) {
|
|
105
|
-
let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.defaultTimeout;
|
|
106
|
-
let restOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
107
|
-
const sameAlert = this.findSameAlert(message, type);
|
|
108
|
-
|
|
109
|
-
if (sameAlert) {
|
|
110
|
-
sameAlert.isShaking = true;
|
|
111
|
-
this.renderAlerts();
|
|
112
|
-
this.stopShakingWhenAnimationDone(sameAlert);
|
|
113
|
-
return sameAlert.key;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const alert = _objectSpread2({
|
|
117
|
-
key: getUID('alert-service-'),
|
|
118
|
-
message,
|
|
119
|
-
type,
|
|
120
|
-
timeout,
|
|
121
|
-
isClosing: false,
|
|
122
|
-
onCloseRequest: () => this.startAlertClosing(alert),
|
|
123
|
-
onClose: () => this.removeWithoutAnimation(alert.key)
|
|
124
|
-
}, restOptions);
|
|
125
|
-
|
|
126
|
-
this.showingAlerts = [alert, ...this.showingAlerts];
|
|
127
|
-
this.renderAlerts();
|
|
128
|
-
return alert.key;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
setDefaultTimeout(timeout) {
|
|
132
|
-
this.defaultTimeout = timeout;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
error(message, timeout) {
|
|
136
|
-
return this.addAlert(message, Alert.Type.ERROR, timeout);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
message(message, timeout) {
|
|
140
|
-
return this.addAlert(message, Alert.Type.MESSAGE, timeout);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
warning(message, timeout) {
|
|
144
|
-
return this.addAlert(message, Alert.Type.WARNING, timeout);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
successMessage(message, timeout) {
|
|
148
|
-
return this.addAlert(message, Alert.Type.SUCCESS, timeout);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
loadingMessage(message, timeout) {
|
|
152
|
-
return this.addAlert(message, Alert.Type.LOADING, timeout);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const alertService = new AlertService();
|
|
158
|
-
|
|
159
|
-
export default alertService;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @name Analytics
|
|
3
|
-
*/
|
|
4
|
-
class Analytics {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._plugins = [];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
config(plugins) {
|
|
10
|
-
this._plugins = plugins;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
track(rawTrackingData,
|
|
14
|
-
/* optional */
|
|
15
|
-
additionalData) {
|
|
16
|
-
if (!rawTrackingData) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let splitIdx = rawTrackingData.indexOf(':');
|
|
21
|
-
|
|
22
|
-
if (splitIdx < 0) {
|
|
23
|
-
splitIdx = rawTrackingData.indexOf('_');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (splitIdx < 0) {
|
|
27
|
-
splitIdx = rawTrackingData.length;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const category = rawTrackingData.substr(0, splitIdx);
|
|
31
|
-
const subcategory = rawTrackingData.substr(splitIdx + 1);
|
|
32
|
-
this.trackEvent(category, subcategory, additionalData);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
trackPageView(path) {
|
|
36
|
-
this._plugins.forEach(plugin => {
|
|
37
|
-
plugin.trackPageView(path);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
trackEvent(category, action,
|
|
42
|
-
/* optional */
|
|
43
|
-
additionalData) {
|
|
44
|
-
const subaction = additionalData ? action + this._buildSuffix(additionalData) : null;
|
|
45
|
-
|
|
46
|
-
this._plugins.forEach(plugin => {
|
|
47
|
-
if (plugin.serializeAdditionalInfo) {
|
|
48
|
-
plugin.trackEvent(category, action);
|
|
49
|
-
|
|
50
|
-
if (subaction) {
|
|
51
|
-
plugin.trackEvent(category, subaction);
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
plugin.trackEvent(category, action, additionalData);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
trackShortcutEvent(category, action,
|
|
60
|
-
/* optional */
|
|
61
|
-
additionalData) {
|
|
62
|
-
this.trackEvent(category, action, additionalData);
|
|
63
|
-
this.trackEvent('ring-shortcut', `${category}$${action}`, additionalData);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
trackEntityProperties(entityName, entity, propertiesNames,
|
|
67
|
-
/* optional */
|
|
68
|
-
additionalData) {
|
|
69
|
-
for (let i = 0; i < propertiesNames.length; ++i) {
|
|
70
|
-
const keys = propertiesNames[i].split('.');
|
|
71
|
-
let value = entity;
|
|
72
|
-
|
|
73
|
-
if (!keys.length) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
for (let j = 0; j < keys.length; ++j) {
|
|
78
|
-
if (value.hasOwnProperty(keys[j])) {
|
|
79
|
-
value = value[keys[j]];
|
|
80
|
-
} else {
|
|
81
|
-
value = 'no-value';
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (typeof value === 'string') {
|
|
87
|
-
value = value.toLowerCase().replace(/[._]+/g, '-');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const resultAction = `${keys.join('-')}__${value}`;
|
|
91
|
-
this.trackEvent(entityName, resultAction, additionalData);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
_buildSuffix(additionalData) {
|
|
96
|
-
if (!additionalData) {
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let suffix = '';
|
|
101
|
-
let key;
|
|
102
|
-
|
|
103
|
-
for (key in additionalData) {
|
|
104
|
-
if (additionalData.hasOwnProperty(key)) {
|
|
105
|
-
suffix += `__${key}$${additionalData[key]}`;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return suffix;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var analytics = new Analytics();
|
|
115
|
-
|
|
116
|
-
export default analytics;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import AnalyticsPluginUtils from './analytics__plugin-utils.js';
|
|
2
|
-
import '../global/sniffer.js';
|
|
3
|
-
import 'sniffr';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_FLUSH_INTERVAL = 10000;
|
|
6
|
-
const DEFAULT_FLUSH_MAX_PACK_SIZE = 100;
|
|
7
|
-
class AnalyticsCustomPlugin {
|
|
8
|
-
constructor(send, isDevelopment, flushInterval, flushingAllowedChecker) {
|
|
9
|
-
this._data = [];
|
|
10
|
-
this.config({
|
|
11
|
-
send,
|
|
12
|
-
isDevelopment,
|
|
13
|
-
flushInterval,
|
|
14
|
-
flushingAllowedChecker
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @param config
|
|
19
|
-
* @property {function} config.send
|
|
20
|
-
* @property {boolean} config.isDevelopment
|
|
21
|
-
* @property {number} config.flushInterval
|
|
22
|
-
* @property {function} config.flushingAllowedChecker
|
|
23
|
-
* @property {number} config.flushMaxPackSize
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
config(config) {
|
|
28
|
-
let checkFlushingAllowed = config.flushingAllowedChecker;
|
|
29
|
-
|
|
30
|
-
if (typeof checkFlushingAllowed !== 'function') {
|
|
31
|
-
checkFlushingAllowed = () => true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this._flush = () => {
|
|
35
|
-
if (this._data.length > 0 && checkFlushingAllowed()) {
|
|
36
|
-
config.send(this._data);
|
|
37
|
-
this._data = [];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
this._isDevelopment = config.isDevelopment;
|
|
42
|
-
this._flushInterval = config.flushInterval || DEFAULT_FLUSH_INTERVAL;
|
|
43
|
-
this._flushMaxPackSize = config.flushMaxPackSize || DEFAULT_FLUSH_MAX_PACK_SIZE;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
trackEvent(category, action) {
|
|
47
|
-
this._processEvent(category, action);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
trackPageView(path) {
|
|
51
|
-
if (this._lastPagePath === path) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this._trackPageViewAdditionalInfo(path);
|
|
56
|
-
|
|
57
|
-
this._processEvent('ring-page', path);
|
|
58
|
-
|
|
59
|
-
this._processEvent('ring-navigator_user-agent', AnalyticsPluginUtils.getUserAgentPresentation());
|
|
60
|
-
|
|
61
|
-
this._processEvent('ring-navigator_platform', AnalyticsPluginUtils.npeSaveLowerCase(navigator.platform));
|
|
62
|
-
|
|
63
|
-
this._processEvent('ring-navigator_lang', AnalyticsPluginUtils.npeSaveLowerCase(navigator.language));
|
|
64
|
-
|
|
65
|
-
this._processEvent('ring-device-pixel-ratio', AnalyticsPluginUtils.getDevicePixelRatioPresentation());
|
|
66
|
-
|
|
67
|
-
this._processEvent('ring-screen-width', AnalyticsPluginUtils.getScreenWidthPresentation());
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_initSendSchedule() {
|
|
71
|
-
window.addEventListener('beforeunload', () => {
|
|
72
|
-
this._trackPageViewAdditionalInfo();
|
|
73
|
-
|
|
74
|
-
return this._flush();
|
|
75
|
-
});
|
|
76
|
-
setInterval(this._flush, this._flushInterval);
|
|
77
|
-
this._hasSendSchedule = true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_processEvent(rawCategory, rawAction) {
|
|
81
|
-
if (!this._hasSendSchedule && this._flush) {
|
|
82
|
-
this._initSendSchedule();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const category = AnalyticsPluginUtils.reformatString(rawCategory, true);
|
|
86
|
-
const action = AnalyticsPluginUtils.reformatString(rawAction);
|
|
87
|
-
|
|
88
|
-
if (this._isDevelopment) {
|
|
89
|
-
console.log('TRACKING DATA = ', category, action); // eslint-disable-line no-console
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
this._addDataToFlushingPack({
|
|
93
|
-
category,
|
|
94
|
-
action
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_trackPageViewAdditionalInfo(newPagePath) {
|
|
99
|
-
const currentTime = new Date().getTime();
|
|
100
|
-
|
|
101
|
-
if (this._lastPagePath) {
|
|
102
|
-
if (this._lastPageViewTime) {
|
|
103
|
-
const duration = AnalyticsPluginUtils.getPageViewDurationPresentation(currentTime - this._lastPageViewTime);
|
|
104
|
-
|
|
105
|
-
this._processEvent(`ring-pageview-duration_${this._lastPagePath}`, duration);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
this._lastPageViewTime = currentTime;
|
|
110
|
-
this._lastPagePath = newPagePath;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_addDataToFlushingPack(sendingData) {
|
|
114
|
-
this._data.push(sendingData);
|
|
115
|
-
|
|
116
|
-
if (this._data.length >= this._flushMaxPackSize) {
|
|
117
|
-
this._flush();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get serializeAdditionalInfo() {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export default AnalyticsCustomPlugin;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import AnalyticsPluginUtils from './analytics__plugin-utils.js';
|
|
2
|
-
import '../global/sniffer.js';
|
|
3
|
-
import 'sniffr';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @name AnalyticsFUSPlugin
|
|
7
|
-
*
|
|
8
|
-
* @param * @param {{
|
|
9
|
-
* productId: string,
|
|
10
|
-
* productBuild: string,
|
|
11
|
-
* recorderVersion: string?,
|
|
12
|
-
* isDevelopment: boolean?,
|
|
13
|
-
* groups: object[]?
|
|
14
|
-
* }} config
|
|
15
|
-
* @constructor
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
class AnalyticsFUSPlugin {
|
|
19
|
-
constructor(_ref) {
|
|
20
|
-
let {
|
|
21
|
-
productId,
|
|
22
|
-
productBuild,
|
|
23
|
-
recorderVersion = '1',
|
|
24
|
-
isDevelopment = false,
|
|
25
|
-
groups = []
|
|
26
|
-
} = _ref;
|
|
27
|
-
|
|
28
|
-
if (!productId && !isDevelopment) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
((i, s, o, g, r) => {
|
|
33
|
-
i[r] = i[r] || function addArgumentsToQueueForWaitingTheScriptLoading() {
|
|
34
|
-
(i[r].query = i[r].query || []).push(arguments);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const script = document.createElement(o);
|
|
38
|
-
script.async = true;
|
|
39
|
-
script.src = g;
|
|
40
|
-
const firstScript = document.getElementsByTagName(o)[0];
|
|
41
|
-
firstScript.parentNode.insertBefore(script, firstScript);
|
|
42
|
-
})(window, document, 'script', '//resources.jetbrains.com/storage/fus/api/fus-reporting-api.js', 'fusra');
|
|
43
|
-
/* global fusra */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
fusra('init', {
|
|
47
|
-
recorderCode: productId,
|
|
48
|
-
recorderVersion,
|
|
49
|
-
productCode: productId,
|
|
50
|
-
productBuild,
|
|
51
|
-
internal: true,
|
|
52
|
-
groups,
|
|
53
|
-
useForSubdomains: true
|
|
54
|
-
});
|
|
55
|
-
this._recorderVersion = recorderVersion;
|
|
56
|
-
this._groups = groups;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
trackEvent(category, action, additionalInfo) {
|
|
60
|
-
this._processEvent(category, action, additionalInfo);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
trackPageView(path) {
|
|
64
|
-
if (this._lastPagePath === path) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this._lastPagePath = path;
|
|
69
|
-
|
|
70
|
-
this._processEvent('ring.page.view', 'open', {
|
|
71
|
-
path,
|
|
72
|
-
browser: AnalyticsPluginUtils.getUserAgentPresentation(),
|
|
73
|
-
platform: AnalyticsPluginUtils.npeSaveLowerCase(navigator.platform),
|
|
74
|
-
lang: AnalyticsPluginUtils.npeSaveLowerCase(navigator.language),
|
|
75
|
-
['page-view-duration']: AnalyticsPluginUtils.getPageViewDurationPresentation(),
|
|
76
|
-
['pixel-ratio']: AnalyticsPluginUtils.getDevicePixelRatioPresentation(),
|
|
77
|
-
screen: AnalyticsPluginUtils.getScreenWidthPresentation()
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
get serializeAdditionalInfo() {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
_processEvent(category, action, additionalInfo) {
|
|
86
|
-
const groupId = category.replace(/[-]/g, '.');
|
|
87
|
-
const group = (this._groups || []).filter(currentGroup => currentGroup.id === groupId)[0];
|
|
88
|
-
|
|
89
|
-
if (group && window.fusra) {
|
|
90
|
-
fusra('event', {
|
|
91
|
-
groupId,
|
|
92
|
-
groupVersion: group.version || this._recorderVersion,
|
|
93
|
-
eventId: action,
|
|
94
|
-
eventData: additionalInfo
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default AnalyticsFUSPlugin;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {string?} gaId Google Analytics ID (should be undefined in development)
|
|
4
|
-
* @constructor
|
|
5
|
-
*/
|
|
6
|
-
class AnalyticsGAPlugin {
|
|
7
|
-
constructor(gaId, isDevelopment, domain) {
|
|
8
|
-
if (!gaId && !isDevelopment) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
((i, s, o, g, r) => {
|
|
13
|
-
i.GoogleAnalyticsObject = r;
|
|
14
|
-
|
|
15
|
-
i[r] = i[r] || function addArgumentsToQueueForWaitingTheScriptLoading() {
|
|
16
|
-
(i[r].q = i[r].q || []).push(arguments);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
i[r].l = 1 * new Date();
|
|
20
|
-
const a = s.createElement(o);
|
|
21
|
-
const m = s.getElementsByTagName(o)[0];
|
|
22
|
-
a.async = 1;
|
|
23
|
-
a.src = g;
|
|
24
|
-
m.parentNode.insertBefore(a, m);
|
|
25
|
-
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
|
26
|
-
/**
|
|
27
|
-
* UA-57284711-1 - ga key for development purpose
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const key = gaId || 'UA-57284711-1';
|
|
32
|
-
/* global ga */
|
|
33
|
-
|
|
34
|
-
const gaCookieParams = domain ? {
|
|
35
|
-
cookieDomain: domain
|
|
36
|
-
} : {};
|
|
37
|
-
ga('create', key, !gaId ? {
|
|
38
|
-
cookieDomain: 'none'
|
|
39
|
-
} : gaCookieParams);
|
|
40
|
-
ga('set', 'anonymizeIp', true);
|
|
41
|
-
ga('set', 'allowAdFeatures', false);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
trackEvent(category, action) {
|
|
45
|
-
if (window.ga) {
|
|
46
|
-
const eventOptions = {
|
|
47
|
-
eventCategory: category,
|
|
48
|
-
eventAction: action
|
|
49
|
-
};
|
|
50
|
-
ga('send', 'event', eventOptions);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
trackPageView(path) {
|
|
55
|
-
if (window.ga) {
|
|
56
|
-
ga('send', 'pageview', path);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
get serializeAdditionalInfo() {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default AnalyticsGAPlugin;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import sniffr from '../global/sniffer.js';
|
|
2
|
-
import 'sniffr';
|
|
3
|
-
|
|
4
|
-
const AnalyticsPluginUtils = {};
|
|
5
|
-
const SECOND = 1000;
|
|
6
|
-
const HOUR = 3600;
|
|
7
|
-
/**
|
|
8
|
-
* Statistics server does not accept undefined values and strings containing certain symbols
|
|
9
|
-
* @param value
|
|
10
|
-
* @param isCategory
|
|
11
|
-
* @returns string, where forbidden symbols are replaced with '_'
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
AnalyticsPluginUtils.reformatString = (value, isCategory) => {
|
|
15
|
-
const str = String(value);
|
|
16
|
-
/**
|
|
17
|
-
* Category also cannot contain the '/' character (but an action can)
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const regexp = isCategory ? /[.:;!@#^&*(){}\[\]?,%=+\\\/]+/g : /[.:;!@#^&*(){}\[\]?,%=+\\]+/g;
|
|
21
|
-
return str.replace(regexp, '_');
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
AnalyticsPluginUtils.getPageViewDurationPresentation = durationMs => {
|
|
25
|
-
const duration = durationMs / SECOND;
|
|
26
|
-
|
|
27
|
-
if (duration > HOUR) {
|
|
28
|
-
return 'more-than-hour';
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* rounded duration possible values:
|
|
32
|
-
* less than 1 second: [0, 1)
|
|
33
|
-
* less than 2 seconds: [1, 2)
|
|
34
|
-
* less than 4 seconds: [2, 4)
|
|
35
|
-
* less than 16 seconds: [4, 16)
|
|
36
|
-
* ....
|
|
37
|
-
* n - less than 2^(n + 1) seconds
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let roundedDuration = Math.floor(Math.pow(2, Math.floor(Math.log2(duration)) + 1));
|
|
42
|
-
roundedDuration = roundedDuration > 0 ? roundedDuration : 1;
|
|
43
|
-
return `less-than-${roundedDuration}-sec`;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
AnalyticsPluginUtils.getScreenWidthPresentation = () => {
|
|
47
|
-
/**
|
|
48
|
-
* Sizes were taken from bootstrap's grid (xs, sm, md, lg)
|
|
49
|
-
*/
|
|
50
|
-
// eslint-disable-next-line no-magic-numbers
|
|
51
|
-
const sizes = [0, 768, 992, 1200];
|
|
52
|
-
|
|
53
|
-
for (let i = 1; i < sizes.length; ++i) {
|
|
54
|
-
if (window.innerWidth < sizes[i]) {
|
|
55
|
-
return `[${sizes[i - 1]}px;${sizes[i]}px)`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return '[1200px;inf)';
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
AnalyticsPluginUtils.npeSaveLowerCase = val => (val || 'unknown').toLowerCase();
|
|
63
|
-
|
|
64
|
-
AnalyticsPluginUtils.getUserAgentPresentation = () => {
|
|
65
|
-
const name = AnalyticsPluginUtils.npeSaveLowerCase(sniffr.browser.name || 'unknown');
|
|
66
|
-
const majorVersion = sniffr.browser.version[0];
|
|
67
|
-
const version = majorVersion || 'unknown';
|
|
68
|
-
return `${name}$${version}`;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
AnalyticsPluginUtils.getDevicePixelRatioPresentation = () => {
|
|
72
|
-
if (!window.devicePixelRatio || !window.devicePixelRatio.toFixed) {
|
|
73
|
-
return 'unknown';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return String(window.devicePixelRatio.toFixed(1));
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default AnalyticsPluginUtils;
|