@gravity-ui/page-constructor 4.14.0 → 4.15.0
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnalyticsEvent } from '../models';
|
|
2
|
-
export declare const useAnalytics: (name?: string, target?: string) => (
|
|
2
|
+
export declare const useAnalytics: (name?: string, target?: string) => (e?: AnalyticsEvent | AnalyticsEvent[] | null, additionalContext?: Record<string, string>) => void;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAnalytics = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
5
|
const analyticsContext_1 = require("../context/analyticsContext");
|
|
7
6
|
const blockIdContext_1 = require("../context/blockIdContext");
|
|
8
7
|
const models_1 = require("../models");
|
|
@@ -18,10 +17,10 @@ const useAnalytics = (name = '', target) => {
|
|
|
18
17
|
}
|
|
19
18
|
: undefined, [context, name, target]);
|
|
20
19
|
if (!sendEvents) {
|
|
21
|
-
return (
|
|
20
|
+
return () => { };
|
|
22
21
|
}
|
|
23
22
|
const defaultEvents = defaultEvent && autoEvents ? [defaultEvent] : [];
|
|
24
|
-
return (
|
|
23
|
+
return (e, additionalContext) => {
|
|
25
24
|
let events = defaultEvents;
|
|
26
25
|
if (e) {
|
|
27
26
|
events = Array.isArray(e) ? [...events, ...e] : [...events, e];
|
|
@@ -33,6 +32,6 @@ const useAnalytics = (name = '', target) => {
|
|
|
33
32
|
? events.map((event) => (Object.assign(Object.assign({}, event), additionalContext)))
|
|
34
33
|
: events;
|
|
35
34
|
sendEvents(preparedEvents);
|
|
36
|
-
}
|
|
35
|
+
};
|
|
37
36
|
};
|
|
38
37
|
exports.useAnalytics = useAnalytics;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnalyticsEvent } from '../models';
|
|
2
|
-
export declare const useAnalytics: (name?: string, target?: string) => (
|
|
2
|
+
export declare const useAnalytics: (name?: string, target?: string) => (e?: AnalyticsEvent | AnalyticsEvent[] | null, additionalContext?: Record<string, string>) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { memoize } from 'lodash';
|
|
3
2
|
import { AnalyticsContext } from '../context/analyticsContext';
|
|
4
3
|
import { BlockIdContext } from '../context/blockIdContext';
|
|
5
4
|
import { PredefinedEventTypes } from '../models';
|
|
@@ -15,10 +14,10 @@ export const useAnalytics = (name = '', target) => {
|
|
|
15
14
|
}
|
|
16
15
|
: undefined, [context, name, target]);
|
|
17
16
|
if (!sendEvents) {
|
|
18
|
-
return
|
|
17
|
+
return () => { };
|
|
19
18
|
}
|
|
20
19
|
const defaultEvents = defaultEvent && autoEvents ? [defaultEvent] : [];
|
|
21
|
-
return
|
|
20
|
+
return (e, additionalContext) => {
|
|
22
21
|
let events = defaultEvents;
|
|
23
22
|
if (e) {
|
|
24
23
|
events = Array.isArray(e) ? [...events, ...e] : [...events, e];
|
|
@@ -30,5 +29,5 @@ export const useAnalytics = (name = '', target) => {
|
|
|
30
29
|
? events.map((event) => (Object.assign(Object.assign({}, event), additionalContext)))
|
|
31
30
|
: events;
|
|
32
31
|
sendEvents(preparedEvents);
|
|
33
|
-
}
|
|
32
|
+
};
|
|
34
33
|
};
|