@jetbrains/ring-ui 5.0.100 → 5.0.101

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.
Files changed (47) hide show
  1. package/components/analytics/analytics.d.ts +20 -6
  2. package/components/analytics/analytics.js +19 -24
  3. package/components/analytics/analytics__custom-plugin.d.ts +4 -15
  4. package/components/analytics/analytics__custom-plugin.js +11 -52
  5. package/components/analytics/analytics__fus-plugin.d.ts +15 -25
  6. package/components/analytics/analytics__fus-plugin.js +15 -73
  7. package/components/analytics/analytics__ga-plugin.d.ts +12 -2
  8. package/components/analytics/analytics__ga-plugin.js +35 -5
  9. package/components/analytics/analytics__plugin-utils.d.ts +16 -0
  10. package/components/analytics/analytics__plugin-utils.js +26 -1
  11. package/components/button-ng/button-ng.js +1 -1
  12. package/components/dialog-ng/dialog-ng.js +4 -5
  13. package/components/global/angular-component-factory.js +4 -3
  14. package/components/global/ring-angular-component.js +1 -3
  15. package/components/global/ring-angular-component.test.js +2 -1
  16. package/components/input-ng/input-ng.js +1 -1
  17. package/components/loader-ng/loader-ng.js +1 -1
  18. package/components/promised-click-ng/promised-click-ng.js +1 -1
  19. package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -2
  20. package/components/sidebar-ng/sidebar-ng.js +1 -2
  21. package/components/template-ng/template-ng.js +1 -2
  22. package/dist/analytics/analytics.d.ts +20 -6
  23. package/dist/analytics/analytics.js +21 -25
  24. package/dist/analytics/analytics__custom-plugin.d.ts +4 -15
  25. package/dist/analytics/analytics__custom-plugin.js +15 -51
  26. package/dist/analytics/analytics__fus-plugin.d.ts +15 -25
  27. package/dist/analytics/analytics__fus-plugin.js +15 -86
  28. package/dist/analytics/analytics__ga-plugin.d.ts +12 -2
  29. package/dist/analytics/analytics__ga-plugin.js +39 -5
  30. package/dist/analytics/analytics__plugin-utils.d.ts +16 -0
  31. package/dist/analytics/analytics__plugin-utils.js +26 -1
  32. package/dist/button-ng/button-ng.js +1 -1
  33. package/dist/dialog-ng/dialog-ng.js +3 -3
  34. package/dist/global/angular-component-factory.js +6 -3
  35. package/dist/global/ring-angular-component.js +2 -2
  36. package/dist/input-ng/input-ng.js +1 -1
  37. package/dist/loader-ng/loader-ng.js +1 -1
  38. package/dist/promised-click-ng/promised-click-ng.js +2 -2
  39. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +2 -2
  40. package/dist/sidebar-ng/sidebar-ng.js +2 -2
  41. package/dist/style.css +1 -1
  42. package/dist/template-ng/template-ng.js +1 -1
  43. package/package.json +19 -18
  44. package/components/analytics-ng/analytics-ng.examples.js +0 -61
  45. package/components/analytics-ng/analytics-ng.js +0 -87
  46. package/components/analytics-ng/analytics-ng.test.js +0 -82
  47. package/dist/analytics-ng/analytics-ng.js +0 -89
@@ -2,8 +2,11 @@ type Serializable = string | number | boolean | null | undefined | {
2
2
  [K in string | number]?: Serializable;
3
3
  };
4
4
  export interface AnalyticsPlugin {
5
+ /**
6
+ * @deprecated
7
+ */
5
8
  serializeAdditionalInfo: boolean;
6
- trackEvent(category: string, action: string, additionalData?: Record<string, unknown> | undefined): void;
9
+ trackEvent(category: string, action: string, additionalData?: Record<string, string>): void;
7
10
  trackPageView(path: string): void;
8
11
  }
9
12
  /**
@@ -13,12 +16,23 @@ export declare class Analytics {
13
16
  private _plugins;
14
17
  constructor();
15
18
  config(plugins: readonly AnalyticsPlugin[]): void;
16
- track(rawTrackingData: string, additionalData?: Record<string, unknown> | undefined): void;
19
+ /**
20
+ * @deprecated
21
+ */
22
+ track(rawTrackingData: string, additionalData: Record<string, string>): void;
23
+ /**
24
+ * @deprecated
25
+ */
17
26
  trackPageView(path: string): void;
18
- trackEvent(category: string, action: string, additionalData?: Record<string, unknown> | undefined): void;
19
- trackShortcutEvent(category: string, action: string, additionalData?: Record<string, unknown> | undefined): void;
20
- trackEntityProperties(entityName: string, entity: Serializable, propertiesNames: readonly string[], additionalData?: Record<string, unknown> | undefined): void;
21
- private _buildSuffix;
27
+ trackEvent(category: string, action: string, additionalData?: Record<string, string>): void;
28
+ /**
29
+ * @deprecated
30
+ */
31
+ trackShortcutEvent(category: string, action: string, additionalData: Record<string, string>): void;
32
+ /**
33
+ * @deprecated
34
+ */
35
+ trackEntityProperties(entityName: string, entity: Serializable, propertiesNames: readonly string[], additionalData?: Record<string, string>): void;
22
36
  }
23
37
  declare const _default: Analytics;
24
38
  export default _default;
@@ -1,3 +1,5 @@
1
+ import deprecate from 'util-deprecate';
2
+ const warnOnDeprecationOfAnalyticsMethod = (methodName) => deprecate(() => { }, `Method analytics::${methodName} is deprecated, use analytics::trackEvent instead`)();
1
3
  /**
2
4
  * @name Analytics
3
5
  */
@@ -9,10 +11,14 @@ export class Analytics {
9
11
  config(plugins) {
10
12
  this._plugins = plugins;
11
13
  }
14
+ /**
15
+ * @deprecated
16
+ */
12
17
  track(rawTrackingData, additionalData) {
13
18
  if (!rawTrackingData) {
14
19
  return;
15
20
  }
21
+ warnOnDeprecationOfAnalyticsMethod('track');
16
22
  let splitIdx = rawTrackingData.indexOf(':');
17
23
  if (splitIdx < 0) {
18
24
  splitIdx = rawTrackingData.indexOf('_');
@@ -24,30 +30,32 @@ export class Analytics {
24
30
  const subcategory = rawTrackingData.substr(splitIdx + 1);
25
31
  this.trackEvent(category, subcategory, additionalData);
26
32
  }
33
+ /**
34
+ * @deprecated
35
+ */
27
36
  trackPageView(path) {
37
+ warnOnDeprecationOfAnalyticsMethod('trackPageView');
28
38
  this._plugins.forEach(plugin => {
29
39
  plugin.trackPageView(path);
30
40
  });
31
41
  }
32
42
  trackEvent(category, action, additionalData) {
33
- const subaction = additionalData ? action + this._buildSuffix(additionalData) : null;
34
43
  this._plugins.forEach(plugin => {
35
- if (plugin.serializeAdditionalInfo) {
36
- plugin.trackEvent(category, action);
37
- if (subaction) {
38
- plugin.trackEvent(category, subaction);
39
- }
40
- }
41
- else {
42
- plugin.trackEvent(category, action, additionalData);
43
- }
44
+ plugin.trackEvent(category, action, additionalData);
44
45
  });
45
46
  }
47
+ /**
48
+ * @deprecated
49
+ */
46
50
  trackShortcutEvent(category, action, additionalData) {
51
+ warnOnDeprecationOfAnalyticsMethod('trackShortcutEvent');
47
52
  this.trackEvent(category, action, additionalData);
48
- this.trackEvent('ring-shortcut', `${category}$${action}`, additionalData);
49
53
  }
54
+ /**
55
+ * @deprecated
56
+ */
50
57
  trackEntityProperties(entityName, entity, propertiesNames, additionalData) {
58
+ warnOnDeprecationOfAnalyticsMethod('trackEntityProperties');
51
59
  for (let i = 0; i < propertiesNames.length; ++i) {
52
60
  const keys = propertiesNames[i].split('.');
53
61
  let value = entity;
@@ -70,18 +78,5 @@ export class Analytics {
70
78
  this.trackEvent(entityName, resultAction, additionalData);
71
79
  }
72
80
  }
73
- _buildSuffix(additionalData) {
74
- if (!additionalData) {
75
- return '';
76
- }
77
- let suffix = '';
78
- let key;
79
- for (key in additionalData) {
80
- if (additionalData.hasOwnProperty(key)) {
81
- suffix += `__${key}$${additionalData[key]}`;
82
- }
83
- }
84
- return suffix;
85
- }
86
81
  }
87
82
  export default new Analytics();
@@ -2,12 +2,12 @@ import { AnalyticsPlugin } from './analytics';
2
2
  export interface AnalyticsCustomPluginData {
3
3
  category: string;
4
4
  action: string;
5
+ data?: Record<string, string>;
5
6
  }
6
7
  export interface AnalyticsCustomPluginConfig {
7
8
  send: (data: AnalyticsCustomPluginData[]) => void;
8
9
  isDevelopment?: boolean | undefined;
9
10
  flushInterval?: number | undefined;
10
- flushingAllowedChecker?: (() => boolean) | undefined;
11
11
  flushMaxPackSize?: number | undefined;
12
12
  }
13
13
  export default class AnalyticsCustomPlugin implements AnalyticsPlugin {
@@ -16,24 +16,13 @@ export default class AnalyticsCustomPlugin implements AnalyticsPlugin {
16
16
  private _isDevelopment?;
17
17
  private _flushInterval?;
18
18
  private _flushMaxPackSize?;
19
- private _lastPagePath?;
20
19
  private _hasSendSchedule?;
21
- private _lastPageViewTime?;
22
- constructor(send: AnalyticsCustomPluginConfig['send'], isDevelopment?: AnalyticsCustomPluginConfig['isDevelopment'], flushInterval?: AnalyticsCustomPluginConfig['flushInterval'], flushingAllowedChecker?: AnalyticsCustomPluginConfig['flushingAllowedChecker']);
23
- /**
24
- * @param config
25
- * @property {function} config.send
26
- * @property {boolean} config.isDevelopment
27
- * @property {number} config.flushInterval
28
- * @property {function} config.flushingAllowedChecker
29
- * @property {number} config.flushMaxPackSize
30
- */
20
+ constructor(send: AnalyticsCustomPluginConfig['send'], isDevelopment?: AnalyticsCustomPluginConfig['isDevelopment'], flushInterval?: AnalyticsCustomPluginConfig['flushInterval']);
31
21
  config(config: AnalyticsCustomPluginConfig): void;
32
- trackEvent(category: string, action: string): void;
33
- trackPageView(path: string): void;
22
+ trackEvent(category: string, action: string, additionalData?: Record<string, string>): void;
23
+ trackPageView(path: string, data?: Record<string, string>): void;
34
24
  private _initSendSchedule;
35
25
  private _processEvent;
36
- private _trackPageViewAdditionalInfo;
37
26
  private _addDataToFlushingPack;
38
27
  get serializeAdditionalInfo(): boolean;
39
28
  }
@@ -1,4 +1,3 @@
1
- import AnalyticsPluginUtils from './analytics__plugin-utils';
2
1
  const DEFAULT_FLUSH_INTERVAL = 10000;
3
2
  const DEFAULT_FLUSH_MAX_PACK_SIZE = 100;
4
3
  export default class AnalyticsCustomPlugin {
@@ -7,32 +6,18 @@ export default class AnalyticsCustomPlugin {
7
6
  _isDevelopment;
8
7
  _flushInterval;
9
8
  _flushMaxPackSize;
10
- _lastPagePath;
11
9
  _hasSendSchedule;
12
- _lastPageViewTime;
13
- constructor(send, isDevelopment, flushInterval, flushingAllowedChecker) {
10
+ constructor(send, isDevelopment, flushInterval) {
14
11
  this._data = [];
15
12
  this.config({
16
13
  send,
17
14
  isDevelopment,
18
- flushInterval,
19
- flushingAllowedChecker
15
+ flushInterval
20
16
  });
21
17
  }
22
- /**
23
- * @param config
24
- * @property {function} config.send
25
- * @property {boolean} config.isDevelopment
26
- * @property {number} config.flushInterval
27
- * @property {function} config.flushingAllowedChecker
28
- * @property {number} config.flushMaxPackSize
29
- */
30
18
  config(config) {
31
- const checkFlushingAllowed = typeof config.flushingAllowedChecker === 'function'
32
- ? config.flushingAllowedChecker
33
- : () => true;
34
19
  this._flush = () => {
35
- if (this._data.length > 0 && checkFlushingAllowed()) {
20
+ if (this._data.length > 0) {
36
21
  config.send(this._data);
37
22
  this._data = [];
38
23
  }
@@ -41,53 +26,27 @@ export default class AnalyticsCustomPlugin {
41
26
  this._flushInterval = config.flushInterval || DEFAULT_FLUSH_INTERVAL;
42
27
  this._flushMaxPackSize = config.flushMaxPackSize || DEFAULT_FLUSH_MAX_PACK_SIZE;
43
28
  }
44
- trackEvent(category, action) {
45
- this._processEvent(category, action);
29
+ trackEvent(category, action, additionalData) {
30
+ this._processEvent(category, action, additionalData);
46
31
  }
47
- trackPageView(path) {
48
- if (this._lastPagePath === path) {
49
- return;
50
- }
51
- this._trackPageViewAdditionalInfo(path);
52
- this._processEvent('ring-page', path);
53
- this._processEvent('ring-navigator_user-agent', AnalyticsPluginUtils.getUserAgentPresentation());
54
- this._processEvent('ring-navigator_platform', AnalyticsPluginUtils.npeSaveLowerCase(navigator.platform));
55
- this._processEvent('ring-navigator_lang', AnalyticsPluginUtils.npeSaveLowerCase(navigator.language));
56
- this._processEvent('ring-device-pixel-ratio', AnalyticsPluginUtils.getDevicePixelRatioPresentation());
57
- this._processEvent('ring-screen-width', AnalyticsPluginUtils.getScreenWidthPresentation());
32
+ trackPageView(path, data) {
33
+ this._processEvent('page', 'view', data);
58
34
  }
59
35
  _initSendSchedule() {
60
- window.addEventListener('beforeunload', () => {
61
- this._trackPageViewAdditionalInfo();
62
- return this._flush?.();
63
- });
36
+ window.addEventListener('beforeunload', () => this._flush?.());
64
37
  if (this._flush != null) {
65
38
  setInterval(this._flush, this._flushInterval);
66
39
  }
67
40
  this._hasSendSchedule = true;
68
41
  }
69
- _processEvent(rawCategory, rawAction) {
42
+ _processEvent(category, action, data) {
70
43
  if (!this._hasSendSchedule && this._flush) {
71
44
  this._initSendSchedule();
72
45
  }
73
- const category = AnalyticsPluginUtils.reformatString(rawCategory, true);
74
- const action = AnalyticsPluginUtils.reformatString(rawAction);
75
46
  if (this._isDevelopment) {
76
- console.log('TRACKING DATA = ', category, action); // eslint-disable-line no-console
77
- }
78
- this._addDataToFlushingPack({ category, action });
79
- }
80
- _trackPageViewAdditionalInfo(newPagePath) {
81
- const currentTime = (new Date()).getTime();
82
- if (this._lastPagePath) {
83
- if (this._lastPageViewTime) {
84
- const duration = AnalyticsPluginUtils.
85
- getPageViewDurationPresentation(currentTime - this._lastPageViewTime);
86
- this._processEvent(`ring-pageview-duration_${this._lastPagePath}`, duration);
87
- }
47
+ console.log('TRACKING DATA = ', category, action, data); // eslint-disable-line no-console
88
48
  }
89
- this._lastPageViewTime = currentTime;
90
- this._lastPagePath = newPagePath;
49
+ this._addDataToFlushingPack(data ? { category, action, data } : { category, action });
91
50
  }
92
51
  _addDataToFlushingPack(sendingData) {
93
52
  this._data.push(sendingData);
@@ -4,13 +4,6 @@ export interface AnalyticsFUSPluginGroup {
4
4
  version: string;
5
5
  baseline: string;
6
6
  }
7
- export interface AnalyticsFUSPluginConfig {
8
- productId?: string | undefined;
9
- productBuild?: string | undefined;
10
- recorderVersion?: number | string | undefined;
11
- isDevelopment?: boolean | undefined;
12
- groups?: readonly AnalyticsFUSPluginGroup[] | undefined;
13
- }
14
7
  interface FusraInitParams {
15
8
  recorderCode?: string | undefined;
16
9
  recorderVersion: number | string;
@@ -38,25 +31,22 @@ declare global {
38
31
  }
39
32
  }
40
33
  /**
34
+ * @deprecated
41
35
  * @name AnalyticsFUSPlugin
42
- *
43
- * @param * @param {{
44
- * productId: string,
45
- * productBuild: string,
46
- * recorderVersion: string?,
47
- * isDevelopment: boolean?,
48
- * groups: object[]?
49
- * }} config
50
- * @constructor
51
36
  */
52
- export default class AnalyticsFUSPlugin implements AnalyticsPlugin {
53
- private _recorderVersion?;
54
- private _lastPagePath?;
55
- private _groups;
56
- constructor({ productId, productBuild, recorderVersion, isDevelopment, groups }: AnalyticsFUSPluginConfig);
57
- trackEvent(category: string, action: string, additionalInfo?: Record<string, unknown>): void;
58
- trackPageView(path: string): void;
37
+ declare class AnalyticsFUSPlugin implements AnalyticsPlugin {
38
+ /**
39
+ * @deprecated
40
+ */
41
+ trackEvent(): void;
42
+ /**
43
+ * @deprecated
44
+ */
45
+ trackPageView(): void;
46
+ /**
47
+ * @deprecated
48
+ */
59
49
  get serializeAdditionalInfo(): boolean;
60
- private _processEvent;
61
50
  }
62
- export {};
51
+ declare const _default: typeof AnalyticsFUSPlugin;
52
+ export default _default;
@@ -1,80 +1,22 @@
1
- import AnalyticsPluginUtils from './analytics__plugin-utils';
1
+ import deprecate from 'util-deprecate';
2
2
  /**
3
+ * @deprecated
3
4
  * @name AnalyticsFUSPlugin
4
- *
5
- * @param * @param {{
6
- * productId: string,
7
- * productBuild: string,
8
- * recorderVersion: string?,
9
- * isDevelopment: boolean?,
10
- * groups: object[]?
11
- * }} config
12
- * @constructor
13
5
  */
14
- export default class AnalyticsFUSPlugin {
15
- _recorderVersion;
16
- _lastPagePath;
17
- _groups;
18
- constructor({ productId, productBuild, recorderVersion = '1', isDevelopment = false, groups = [] }) {
19
- if (!productId && !isDevelopment) {
20
- return;
21
- }
22
- ((i, s, o, g, r) => {
23
- i[r] = i[r] || function addArgumentsToQueueForWaitingTheScriptLoading(...args) {
24
- const fn = i[r];
25
- if (fn != null) {
26
- (fn.query = fn.query || []).push(args);
27
- }
28
- };
29
- const script = document.createElement(o);
30
- script.async = true;
31
- script.src = g;
32
- const firstScript = document.getElementsByTagName(o)[0];
33
- firstScript.parentNode?.insertBefore(script, firstScript);
34
- })(window, document, 'script', '//resources.jetbrains.com/storage/fus/api/fus-reporting-api.js', 'fusra');
35
- window.fusra?.('init', {
36
- recorderCode: productId,
37
- recorderVersion,
38
- productCode: productId,
39
- productBuild,
40
- internal: isDevelopment,
41
- groups,
42
- useForSubdomains: true
43
- });
44
- this._recorderVersion = recorderVersion;
45
- this._groups = groups;
46
- }
47
- trackEvent(category, action, additionalInfo) {
48
- this._processEvent(category, action, additionalInfo);
49
- }
50
- trackPageView(path) {
51
- if (this._lastPagePath === path) {
52
- return;
53
- }
54
- this._lastPagePath = path;
55
- this._processEvent('ring.page.view', 'open', {
56
- path,
57
- browser: AnalyticsPluginUtils.getUserAgentPresentation(),
58
- platform: AnalyticsPluginUtils.npeSaveLowerCase(navigator.platform),
59
- lang: AnalyticsPluginUtils.npeSaveLowerCase(navigator.language),
60
- ['page-view-duration']: AnalyticsPluginUtils.getPageViewDurationPresentation(),
61
- ['pixel-ratio']: AnalyticsPluginUtils.getDevicePixelRatioPresentation(),
62
- screen: AnalyticsPluginUtils.getScreenWidthPresentation()
63
- });
64
- }
6
+ class AnalyticsFUSPlugin {
7
+ /**
8
+ * @deprecated
9
+ */
10
+ trackEvent() { }
11
+ /**
12
+ * @deprecated
13
+ */
14
+ trackPageView() { }
15
+ /**
16
+ * @deprecated
17
+ */
65
18
  get serializeAdditionalInfo() {
66
19
  return false;
67
20
  }
68
- _processEvent(category, action, additionalInfo) {
69
- const groupId = category.replace(/[-]/g, '.');
70
- const group = (this._groups || []).filter(currentGroup => currentGroup.id === groupId)[0];
71
- if (group && window.fusra) {
72
- window.fusra('event', {
73
- groupId,
74
- groupVersion: group.version || this._recorderVersion,
75
- eventId: action,
76
- eventData: additionalInfo
77
- });
78
- }
79
- }
80
21
  }
22
+ export default deprecate(AnalyticsFUSPlugin, 'AnalyticsFUSPlugin is deprecated, use AnalyticsCustomPlugin instead');
@@ -5,13 +5,23 @@ declare global {
5
5
  }
6
6
  }
7
7
  /**
8
- *
8
+ * @deprecated
9
9
  * @param {string?} gaId Google Analytics ID (should be undefined in development)
10
10
  * @constructor
11
11
  */
12
12
  export default class AnalyticsGAPlugin implements AnalyticsPlugin {
13
13
  constructor(gaId?: string | undefined, isDevelopment?: boolean | undefined, domain?: string, cookielessUserIdentifier?: string | undefined);
14
- trackEvent(category: string, action: string): void;
14
+ /**
15
+ * @deprecated
16
+ */
17
+ trackEvent(rawCategory: string, rawAction: string, additionalData?: Record<string, string>): void;
18
+ /**
19
+ * @deprecated
20
+ */
15
21
  trackPageView(path: string): void;
22
+ /**
23
+ * @deprecated
24
+ */
16
25
  get serializeAdditionalInfo(): boolean;
26
+ private _buildSuffix;
17
27
  }
@@ -1,5 +1,6 @@
1
+ import AnalyticsPluginUtils from './analytics__plugin-utils';
1
2
  /**
2
- *
3
+ * @deprecated
3
4
  * @param {string?} gaId Google Analytics ID (should be undefined in development)
4
5
  * @constructor
5
6
  */
@@ -39,21 +40,50 @@ export default class AnalyticsGAPlugin {
39
40
  ga('set', 'location', domain || '/');
40
41
  ga('set', 'allowAdFeatures', false);
41
42
  }
42
- trackEvent(category, action) {
43
+ /**
44
+ * @deprecated
45
+ */
46
+ trackEvent(rawCategory, rawAction, additionalData) {
43
47
  if (window.ga != null) {
44
- const eventOptions = {
48
+ const category = AnalyticsPluginUtils.reformatString(rawCategory, true);
49
+ const action = AnalyticsPluginUtils.reformatString(rawAction);
50
+ ga('send', 'event', {
45
51
  eventCategory: category,
46
52
  eventAction: action
47
- };
48
- ga('send', 'event', eventOptions);
53
+ });
54
+ if (additionalData) {
55
+ ga('send', 'event', {
56
+ eventCategory: category,
57
+ eventAction: action + this._buildSuffix(additionalData)
58
+ });
59
+ }
49
60
  }
50
61
  }
62
+ /**
63
+ * @deprecated
64
+ */
51
65
  trackPageView(path) {
52
66
  if (window.ga != null) {
53
67
  ga('send', 'pageview', path);
54
68
  }
55
69
  }
70
+ /**
71
+ * @deprecated
72
+ */
56
73
  get serializeAdditionalInfo() {
57
74
  return true;
58
75
  }
76
+ _buildSuffix(additionalData) {
77
+ if (!additionalData) {
78
+ return '';
79
+ }
80
+ let suffix = '';
81
+ let key;
82
+ for (key in additionalData) {
83
+ if (additionalData.hasOwnProperty(key)) {
84
+ suffix += `__${key}$${additionalData[key]}`;
85
+ }
86
+ }
87
+ return suffix;
88
+ }
59
89
  }
@@ -1,15 +1,31 @@
1
1
  declare const AnalyticsPluginUtils: {
2
2
  /**
3
+ * @deprecated
3
4
  * Statistics server does not accept undefined values and strings containing certain symbols
4
5
  * @param value
5
6
  * @param isCategory
6
7
  * @returns string, where forbidden symbols are replaced with '_'
7
8
  */
8
9
  reformatString: (value: unknown, isCategory?: boolean) => string;
10
+ /**
11
+ * @deprecated
12
+ */
9
13
  getPageViewDurationPresentation: (durationMs?: number) => string;
14
+ /**
15
+ * @deprecated
16
+ */
10
17
  getScreenWidthPresentation: () => string;
18
+ /**
19
+ * @deprecated
20
+ */
11
21
  npeSaveLowerCase: (val: string | null | undefined) => string;
22
+ /**
23
+ * @deprecated
24
+ */
12
25
  getUserAgentPresentation: () => string;
26
+ /**
27
+ * @deprecated
28
+ */
13
29
  getDevicePixelRatioPresentation: () => string;
14
30
  };
15
31
  export default AnalyticsPluginUtils;
@@ -1,8 +1,11 @@
1
+ import deprecate from 'util-deprecate';
1
2
  import sniffer from '../global/sniffer';
3
+ const warnOnDeprecationOfAnalyticsUtilsMethod = (methodName) => deprecate(() => { }, `Method AnalyticsPluginUtils::${methodName} is deprecated and will be removed soon`)();
2
4
  const SECOND = 1000;
3
5
  const HOUR = 3600;
4
6
  const AnalyticsPluginUtils = {
5
7
  /**
8
+ * @deprecated
6
9
  * Statistics server does not accept undefined values and strings containing certain symbols
7
10
  * @param value
8
11
  * @param isCategory
@@ -16,7 +19,11 @@ const AnalyticsPluginUtils = {
16
19
  const regexp = isCategory ? /[.:;!@#^&*(){}\[\]?,%=+\\\/]+/g : /[.:;!@#^&*(){}\[\]?,%=+\\]+/g;
17
20
  return str.replace(regexp, '_');
18
21
  },
22
+ /**
23
+ * @deprecated
24
+ */
19
25
  getPageViewDurationPresentation: (durationMs) => {
26
+ warnOnDeprecationOfAnalyticsUtilsMethod('getPageViewDurationPresentation');
20
27
  if (durationMs == null) {
21
28
  return 'less-than-1-sec';
22
29
  }
@@ -37,7 +44,11 @@ const AnalyticsPluginUtils = {
37
44
  roundedDuration = (roundedDuration > 0) ? roundedDuration : 1;
38
45
  return `less-than-${roundedDuration}-sec`;
39
46
  },
47
+ /**
48
+ * @deprecated
49
+ */
40
50
  getScreenWidthPresentation: () => {
51
+ warnOnDeprecationOfAnalyticsUtilsMethod('getScreenWidthPresentation');
41
52
  /**
42
53
  * Sizes were taken from bootstrap's grid (xs, sm, md, lg)
43
54
  */
@@ -50,14 +61,28 @@ const AnalyticsPluginUtils = {
50
61
  }
51
62
  return '[1200px;inf)';
52
63
  },
53
- npeSaveLowerCase: (val) => (val || 'unknown').toLowerCase(),
64
+ /**
65
+ * @deprecated
66
+ */
67
+ npeSaveLowerCase: (val) => {
68
+ warnOnDeprecationOfAnalyticsUtilsMethod('npeSaveLowerCase');
69
+ return (val || 'unknown').toLowerCase();
70
+ },
71
+ /**
72
+ * @deprecated
73
+ */
54
74
  getUserAgentPresentation: () => {
75
+ warnOnDeprecationOfAnalyticsUtilsMethod('getUserAgentPresentation');
55
76
  const name = AnalyticsPluginUtils.npeSaveLowerCase(sniffer.browser.name || 'unknown');
56
77
  const majorVersion = sniffer.browser.version[0];
57
78
  const version = majorVersion || 'unknown';
58
79
  return `${name}$${version}`;
59
80
  },
81
+ /**
82
+ * @deprecated
83
+ */
60
84
  getDevicePixelRatioPresentation: () => {
85
+ warnOnDeprecationOfAnalyticsUtilsMethod('getDevicePixelRatioPresentation');
61
86
  if (!window.devicePixelRatio || !window.devicePixelRatio.toFixed) {
62
87
  return 'unknown';
63
88
  }
@@ -31,7 +31,6 @@ const buttonClassesMap = Object.values({...styles, ...overrides}).
31
31
  export const LOADER_BACKGROUND_SELECTOR = '.js-button-loader';
32
32
 
33
33
  class ButtonController extends RingAngularComponent {
34
- static $inject = ['$element', '$attrs', '$scope', '$compile', '$log'];
35
34
 
36
35
  constructor(...args) {
37
36
  super(...args);
@@ -166,6 +165,7 @@ class ButtonController extends RingAngularComponent {
166
165
  $compile(icon)($scope);
167
166
  };
168
167
  }
168
+ ButtonController.$inject = ['$element', '$attrs', '$scope', '$compile', '$log'];
169
169
 
170
170
  function createButtonDirective(tagName) {
171
171
  return () => ({
@@ -26,8 +26,6 @@ const angularModule = angular.module(
26
26
  );
27
27
 
28
28
  class DialogController extends RingAngularComponent {
29
- static $inject = ['$scope', '$q', 'dialog', '$element', 'dialogInSidebar', '$compile',
30
- '$injector', '$controller', 'rgCompiler', '$sce'];
31
29
 
32
30
  constructor(...args) {
33
31
  super(...args);
@@ -333,9 +331,9 @@ class DialogController extends RingAngularComponent {
333
331
  };
334
332
  }
335
333
  }
336
-
334
+ DialogController.$inject = ['$scope', '$q', 'dialog', '$element', 'dialogInSidebar', '$compile',
335
+ '$injector', '$controller', 'rgCompiler', '$sce'];
337
336
  class DialogService extends RingAngularComponent {
338
- static $inject = ['$log'];
339
337
 
340
338
  DIALOG_NAMESPACE = 'ring-dialog';
341
339
  fallbackDialog = null;
@@ -366,9 +364,9 @@ class DialogService extends RingAngularComponent {
366
364
  Reflect.deleteProperty(this, 'ctrl');
367
365
  };
368
366
  }
367
+ DialogService.$inject = ['$log'];
369
368
 
370
369
  class DialogInSidebarService extends DialogService {
371
- static $inject = [...DialogService.$inject, 'dialog'];
372
370
 
373
371
  DIALOG_NAMESPACE = 'ring-dialog-in-sidebar';
374
372
 
@@ -377,6 +375,7 @@ class DialogInSidebarService extends DialogService {
377
375
  this.fallbackDialog = this.$inject.dialog;
378
376
  }
379
377
  }
378
+ DialogInSidebarService.$inject = [...DialogService.$inject, 'dialog'];
380
379
 
381
380
  function rgDialogDirective($timeout) {
382
381
  function link(scope, iElement, iAttrs, dialogCtrl) {