@gravity-ui/page-constructor 1.14.0 → 1.15.0-alpha.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.
- package/build/cjs/blocks/Banner/schema.d.ts +234 -0
- package/build/cjs/blocks/Media/schema.d.ts +78 -0
- package/build/cjs/components/Button/Button.js +5 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -0
- package/build/cjs/components/CardBase/CardBase.js +4 -1
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
- package/build/cjs/components/Link/Link.js +4 -1
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/Media/Video/Video.js +4 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/cjs/components/YandexForm/YandexForm.js +13 -2
- package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js +3 -1
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
- package/build/cjs/context/analyticsContext/index.d.ts +1 -0
- package/build/cjs/context/analyticsContext/index.js +4 -0
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
- package/build/cjs/hooks/index.d.ts +1 -0
- package/build/cjs/hooks/index.js +1 -0
- package/build/cjs/hooks/useAnalytics.d.ts +2 -0
- package/build/cjs/hooks/useAnalytics.js +18 -0
- package/build/cjs/hooks/useMetrika.d.ts +6 -0
- package/build/cjs/hooks/useMetrika.js +8 -0
- package/build/cjs/models/common.d.ts +36 -0
- package/build/cjs/models/common.js +3 -0
- package/build/cjs/models/constructor-items/common.d.ts +6 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/cjs/schema/validators/common.d.ts +168 -0
- package/build/cjs/schema/validators/common.js +10 -0
- package/build/cjs/schema/validators/event.d.ts +91 -0
- package/build/cjs/schema/validators/event.js +90 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +13 -2
- package/build/esm/blocks/Banner/schema.d.ts +234 -0
- package/build/esm/blocks/Media/schema.d.ts +78 -0
- package/build/esm/components/Button/Button.js +5 -2
- package/build/esm/components/CardBase/CardBase.d.ts +2 -0
- package/build/esm/components/CardBase/CardBase.js +4 -1
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
- package/build/esm/components/Link/Link.js +4 -1
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/Media/Video/Video.js +4 -3
- package/build/esm/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/esm/components/YandexForm/YandexForm.js +13 -2
- package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/esm/containers/PageConstructor/Provider.js +3 -1
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
- package/build/esm/context/analyticsContext/index.d.ts +1 -0
- package/build/esm/context/analyticsContext/index.js +1 -0
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
- package/build/esm/hooks/index.d.ts +1 -0
- package/build/esm/hooks/index.js +1 -0
- package/build/esm/hooks/useAnalytics.d.ts +2 -0
- package/build/esm/hooks/useAnalytics.js +14 -0
- package/build/esm/hooks/useMetrika.d.ts +6 -0
- package/build/esm/hooks/useMetrika.js +8 -0
- package/build/esm/models/common.d.ts +36 -0
- package/build/esm/models/common.js +3 -0
- package/build/esm/models/constructor-items/common.d.ts +6 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/esm/schema/validators/common.d.ts +168 -0
- package/build/esm/schema/validators/common.js +10 -0
- package/build/esm/schema/validators/event.d.ts +91 -0
- package/build/esm/schema/validators/event.js +87 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +14 -3
- package/package.json +4 -1
- package/server/models/common.d.ts +36 -0
- package/server/models/common.js +3 -0
- package/server/models/constructor-items/common.d.ts +6 -1
- package/server/models/constructor-items/sub-blocks.d.ts +2 -1
|
@@ -9,6 +9,7 @@ import { VideoContext } from '../../context/videoContext';
|
|
|
9
9
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
10
10
|
import { MobileContext } from '../../context/mobileContext';
|
|
11
11
|
import { PlayVideo } from '../../icons';
|
|
12
|
+
import { useAnalytics } from '../../hooks';
|
|
12
13
|
import './ReactPlayer.css';
|
|
13
14
|
const b = block('ReactPlayer');
|
|
14
15
|
const FPS = 60;
|
|
@@ -16,7 +17,7 @@ const FPS = 60;
|
|
|
16
17
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
17
18
|
const isMobile = useContext(MobileContext);
|
|
18
19
|
const { metrika } = useContext(MetrikaContext);
|
|
19
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
20
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
20
21
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
21
22
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
22
23
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -31,6 +32,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
31
32
|
const [started, setStarted] = useState(autoPlay);
|
|
32
33
|
const [paused, setPaused] = useState(false);
|
|
33
34
|
const [ended, setEnded] = useState(false);
|
|
35
|
+
const handleAnalytics = useAnalytics();
|
|
34
36
|
useImperativeHandle(originRef, () => ({
|
|
35
37
|
pause: () => setIsPlaying(false),
|
|
36
38
|
}));
|
|
@@ -79,6 +81,8 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
79
81
|
window.removeEventListener('resize', updateSize);
|
|
80
82
|
};
|
|
81
83
|
}, []);
|
|
84
|
+
const playEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'play'), [analyticsEvents]);
|
|
85
|
+
const stopEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'stop'), [analyticsEvents]);
|
|
82
86
|
const playIcon = useMemo(() => {
|
|
83
87
|
let playButtonContent;
|
|
84
88
|
switch (type) {
|
|
@@ -104,12 +108,27 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
104
108
|
metrika.reachGoals(goal, counterName);
|
|
105
109
|
}
|
|
106
110
|
}
|
|
111
|
+
if (handleAnalytics && analyticsEvents) {
|
|
112
|
+
const events = isMuted ? playEvents : stopEvents;
|
|
113
|
+
if (events) {
|
|
114
|
+
handleAnalytics(events);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
107
117
|
if (isMuted) {
|
|
108
118
|
setProps({ playingVideoRef: ref.current });
|
|
109
119
|
}
|
|
110
120
|
// In order to the progress bar to update (equals 0) before displaying
|
|
111
121
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
112
|
-
}, [
|
|
122
|
+
}, [
|
|
123
|
+
playerRef,
|
|
124
|
+
metrika,
|
|
125
|
+
videoMetrika,
|
|
126
|
+
handleAnalytics,
|
|
127
|
+
analyticsEvents,
|
|
128
|
+
playEvents,
|
|
129
|
+
stopEvents,
|
|
130
|
+
setProps,
|
|
131
|
+
]);
|
|
113
132
|
const handleClick = useCallback(() => changeMute(muted), [changeMute, muted]);
|
|
114
133
|
const handleClickPreview = useCallback(() => {
|
|
115
134
|
setIsPlaying(true);
|
|
@@ -120,7 +139,12 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
120
139
|
metrika.reachGoals(play, counterName);
|
|
121
140
|
}
|
|
122
141
|
}
|
|
123
|
-
|
|
142
|
+
if (handleAnalytics && analyticsEvents) {
|
|
143
|
+
if (playEvents) {
|
|
144
|
+
handleAnalytics(playEvents);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, analyticsEvents, playEvents]);
|
|
124
148
|
const onPause = useCallback(() => {
|
|
125
149
|
// For support correct state for youtube
|
|
126
150
|
setIsPlaying(false);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
+
import { AnalyticsEventV2 } from '../../models/common';
|
|
2
3
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
3
4
|
export interface YandexFormProps {
|
|
4
5
|
id: number | string;
|
|
@@ -14,6 +15,7 @@ export interface YandexFormProps {
|
|
|
14
15
|
onLoad?: () => void;
|
|
15
16
|
metrikaGoals?: string | string[];
|
|
16
17
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
17
19
|
}
|
|
18
20
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
19
21
|
export default YandexForm;
|
|
@@ -4,15 +4,17 @@ import { LocaleContext } from '../../context/localeContext';
|
|
|
4
4
|
import { MobileContext } from '../../context/mobileContext';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
6
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
7
|
+
import { useAnalytics } from '../..//hooks';
|
|
7
8
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
8
9
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
9
10
|
const b = block('yandex-form');
|
|
10
11
|
const YandexForm = (props) => {
|
|
11
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, customFormOrigin, } = props;
|
|
12
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, } = props;
|
|
12
13
|
const formContainerRef = useRef(null);
|
|
13
14
|
const iframeRef = useRef();
|
|
14
15
|
const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;
|
|
15
16
|
const handleMetrika = useMetrika();
|
|
17
|
+
const handleAnalytics = useAnalytics();
|
|
16
18
|
const isMobile = useContext(MobileContext);
|
|
17
19
|
const locale = useContext(LocaleContext);
|
|
18
20
|
const updateFormIframe = useCallback((container) => {
|
|
@@ -53,10 +55,19 @@ const YandexForm = (props) => {
|
|
|
53
55
|
window.scrollBy(0, top - headerHeight);
|
|
54
56
|
}
|
|
55
57
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
58
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
56
59
|
if (onSubmit) {
|
|
57
60
|
onSubmit();
|
|
58
61
|
}
|
|
59
|
-
}, [
|
|
62
|
+
}, [
|
|
63
|
+
handleMetrika,
|
|
64
|
+
metrikaGoals,
|
|
65
|
+
pixelEvents,
|
|
66
|
+
handleAnalytics,
|
|
67
|
+
analyticsEvents,
|
|
68
|
+
onSubmit,
|
|
69
|
+
headerHeight,
|
|
70
|
+
]);
|
|
60
71
|
const handleMessage = useCallback(({ origin, data }) => {
|
|
61
72
|
if (origin !== yaFormOrigin) {
|
|
62
73
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MetrikaContextProps } from '../../context/metrikaContext';
|
|
2
|
+
import { AnalyticsContextProps } from '../../context/analyticsContext';
|
|
2
3
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
3
4
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
4
5
|
import { LocaleContextProps } from '../../context/localeContext';
|
|
@@ -13,5 +14,6 @@ export interface PageConstructorProviderProps {
|
|
|
13
14
|
ssrConfig?: SSRContextProps;
|
|
14
15
|
theme?: ConstructorTheme;
|
|
15
16
|
projectSettings?: ProjectSettingsContextProps;
|
|
17
|
+
analytics?: AnalyticsContextProps;
|
|
16
18
|
}
|
|
17
19
|
export declare const PageConstructorProvider: (props: WithChildren<PageConstructorProviderProps>) => JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
3
|
+
import { AnalyticsContext } from '../../context/analyticsContext';
|
|
3
4
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
5
|
import { ProjectSettingsContext, } from '../../context/projectSettingsContext';
|
|
5
6
|
import { SSRContext } from '../../context/ssrContext';
|
|
@@ -8,7 +9,7 @@ import { LocationContext } from '../../context/locationContext';
|
|
|
8
9
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
9
10
|
import { DEFAULT_THEME } from '../../components/constants';
|
|
10
11
|
export const PageConstructorProvider = (props) => {
|
|
11
|
-
const { isMobile, locale = {}, location = {}, metrika = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, } = props;
|
|
12
|
+
const { isMobile, locale = {}, location = {}, metrika = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, } = props;
|
|
12
13
|
/* eslint-disable react/jsx-key */
|
|
13
14
|
const context = [
|
|
14
15
|
React.createElement(ThemeValueContext.Provider, { value: { themeValue: theme } }),
|
|
@@ -17,6 +18,7 @@ export const PageConstructorProvider = (props) => {
|
|
|
17
18
|
React.createElement(LocationContext.Provider, { value: location }),
|
|
18
19
|
React.createElement(MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
19
20
|
React.createElement(MetrikaContext.Provider, { value: metrika }),
|
|
21
|
+
React.createElement(AnalyticsContext.Provider, { value: analytics }),
|
|
20
22
|
React.createElement(SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
21
23
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
|
22
24
|
/* eslint-enable react/jsx-key */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsEventV2 } from '../../models';
|
|
3
|
+
export interface AnalyticsContextProps {
|
|
4
|
+
sendEvents?: (e: AnalyticsEventV2 | AnalyticsEventV2[]) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const AnalyticsContext: React.Context<AnalyticsContextProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analyticsContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analyticsContext';
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Metrika, Pixel } from '../../models';
|
|
3
3
|
export interface MetrikaContextProps {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Metrika will be deleted
|
|
6
|
+
*/
|
|
4
7
|
metrika?: Metrika;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Metrika will be deleted
|
|
10
|
+
*/
|
|
5
11
|
pixel?: Pixel;
|
|
6
12
|
}
|
|
7
13
|
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -2,4 +2,5 @@ export { default as useFocus } from './useFocus';
|
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
3
|
export { useIntersection } from './useIntersection';
|
|
4
4
|
export { default as useMount } from './useMount';
|
|
5
|
+
export * from './useAnalytics';
|
|
5
6
|
export * from './hubspot';
|
package/build/esm/hooks/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { default as useFocus } from './useFocus';
|
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
3
|
export { useIntersection } from './useIntersection';
|
|
4
4
|
export { default as useMount } from './useMount';
|
|
5
|
+
export * from './useAnalytics';
|
|
5
6
|
export * from './hubspot';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { AnalyticsContext } from '../context/analyticsContext';
|
|
3
|
+
export const useAnalytics = () => {
|
|
4
|
+
const { sendEvents } = useContext(AnalyticsContext);
|
|
5
|
+
if (!sendEvents) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
return (e) => {
|
|
9
|
+
if (!e) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
sendEvents(e);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { ButtonPixel, MetrikaGoal, PixelEvent } from '../models';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Metrika will be deleted
|
|
4
|
+
*/
|
|
2
5
|
type UseMetrikaProps = {
|
|
3
6
|
metrikaGoals?: MetrikaGoal;
|
|
4
7
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
5
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated useMetrika will be deleted
|
|
11
|
+
*/
|
|
6
12
|
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
7
13
|
export {};
|
|
@@ -2,12 +2,20 @@ import { useContext } from 'react';
|
|
|
2
2
|
import { MetrikaContext } from '../context/metrikaContext';
|
|
3
3
|
import { PixelEventType } from '../models';
|
|
4
4
|
import { isNewMetrikaFormat } from '../models/guards';
|
|
5
|
+
// eslint-disable-next-line valid-jsdoc
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Metrika will be deleted, which uses this logic
|
|
8
|
+
*/
|
|
5
9
|
function isButtonPixel(pixelEvents) {
|
|
6
10
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
7
11
|
return true;
|
|
8
12
|
}
|
|
9
13
|
return false;
|
|
10
14
|
}
|
|
15
|
+
// eslint-disable-next-line valid-jsdoc
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated useMetrika will be deleted
|
|
18
|
+
*/
|
|
11
19
|
export const useMetrika = () => {
|
|
12
20
|
const { metrika, pixel } = useContext(MetrikaContext);
|
|
13
21
|
return ({ metrikaGoals, pixelEvents }) => {
|
|
@@ -7,12 +7,21 @@ export declare enum Theme {
|
|
|
7
7
|
Light = "light",
|
|
8
8
|
Dark = "dark"
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Pixel will be deleted
|
|
12
|
+
*/
|
|
10
13
|
type PixelCommand = 'track' | 'trackCustom';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Pixel will be deleted
|
|
16
|
+
*/
|
|
11
17
|
export interface PixelEvent {
|
|
12
18
|
command: PixelCommand;
|
|
13
19
|
event: PixelEventType | string;
|
|
14
20
|
data?: Object;
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Pixel will be deleted from package
|
|
24
|
+
*/
|
|
16
25
|
export declare enum PixelEventType {
|
|
17
26
|
AddPaymentInfo = "AddPaymentInfo",
|
|
18
27
|
AddToCart = "AddToCart",
|
|
@@ -36,11 +45,17 @@ export declare enum PixelEventType {
|
|
|
36
45
|
export type Modifiers = {
|
|
37
46
|
[name: string]: string | boolean | undefined;
|
|
38
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Pixel will be deleted
|
|
50
|
+
*/
|
|
39
51
|
export interface Pixel<TEvent = string> {
|
|
40
52
|
trackStandard: (event: TEvent, data?: Object) => void;
|
|
41
53
|
trackCustom: (event: string, data?: Object) => void;
|
|
42
54
|
track: (trackEvents: string | string[] | PixelEvent[] | PixelEvent) => void;
|
|
43
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Metrika will be deleted
|
|
58
|
+
*/
|
|
44
59
|
export interface Metrika {
|
|
45
60
|
reachGoal: (counterName: string, ...args: any) => void;
|
|
46
61
|
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
@@ -49,4 +64,25 @@ export interface ClassNameProps {
|
|
|
49
64
|
className?: string;
|
|
50
65
|
}
|
|
51
66
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
|
+
export type AnalyticsParameter = {
|
|
68
|
+
key: string;
|
|
69
|
+
value: string | number | boolean;
|
|
70
|
+
};
|
|
71
|
+
export type AnalyticsCounters = {
|
|
72
|
+
include?: string[];
|
|
73
|
+
exclude?: string[];
|
|
74
|
+
};
|
|
75
|
+
export type AnalyticsEvent = {
|
|
76
|
+
name: string;
|
|
77
|
+
type?: string;
|
|
78
|
+
counters?: AnalyticsCounters;
|
|
79
|
+
category?: string;
|
|
80
|
+
label?: string;
|
|
81
|
+
params?: AnalyticsParameter[];
|
|
82
|
+
};
|
|
83
|
+
export type AnalyticsEventV2<T = {}> = T & {
|
|
84
|
+
name: string;
|
|
85
|
+
type?: string;
|
|
86
|
+
counters?: AnalyticsCounters;
|
|
87
|
+
};
|
|
52
88
|
export {};
|
|
@@ -3,6 +3,9 @@ export var Theme;
|
|
|
3
3
|
Theme["Light"] = "light";
|
|
4
4
|
Theme["Dark"] = "dark";
|
|
5
5
|
})(Theme || (Theme = {}));
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Pixel will be deleted from package
|
|
8
|
+
*/
|
|
6
9
|
export var PixelEventType;
|
|
7
10
|
(function (PixelEventType) {
|
|
8
11
|
PixelEventType["AddPaymentInfo"] = "AddPaymentInfo";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonView } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
|
-
import { ClassNameProps, PixelEventType } from '../common';
|
|
4
|
+
import { AnalyticsEventV2, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -110,6 +110,7 @@ export interface MediaVideoProps {
|
|
|
110
110
|
playButton?: PlayButtonProps;
|
|
111
111
|
controls?: MediaVideoControlsType;
|
|
112
112
|
metrika?: MetrikaVideo;
|
|
113
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
113
114
|
}
|
|
114
115
|
export interface LinkProps extends Stylable {
|
|
115
116
|
url: string;
|
|
@@ -121,6 +122,7 @@ export interface LinkProps extends Stylable {
|
|
|
121
122
|
target?: string;
|
|
122
123
|
metrikaGoals?: MetrikaGoal;
|
|
123
124
|
pixelEvents?: ButtonPixel;
|
|
125
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
124
126
|
}
|
|
125
127
|
export interface FileLinkProps extends ClassNameProps {
|
|
126
128
|
href: string;
|
|
@@ -139,6 +141,7 @@ export interface ButtonProps {
|
|
|
139
141
|
img?: ButtonImageProps | string;
|
|
140
142
|
metrikaGoals?: MetrikaGoal;
|
|
141
143
|
pixelEvents?: ButtonPixel;
|
|
144
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
142
145
|
target?: string;
|
|
143
146
|
}
|
|
144
147
|
export interface ButtonImageProps {
|
|
@@ -167,6 +170,7 @@ export interface MediaComponentVideoProps {
|
|
|
167
170
|
video: MediaVideoProps;
|
|
168
171
|
height?: number;
|
|
169
172
|
metrika?: MetrikaVideo;
|
|
173
|
+
analyticsEvents?: AnalyticsEventV2[];
|
|
170
174
|
previewImg?: string;
|
|
171
175
|
}
|
|
172
176
|
export interface MediaComponentYoutubeProps {
|
|
@@ -222,6 +226,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
222
226
|
theme?: TextTheme;
|
|
223
227
|
metrikaGoals?: MetrikaGoal;
|
|
224
228
|
pixelEvents?: ButtonPixel;
|
|
229
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
225
230
|
}
|
|
226
231
|
export interface PreviewContentItemProps {
|
|
227
232
|
title: string;
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import { PixelEvent } from '../common';
|
|
6
|
+
import { AnalyticsEventV2, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -61,6 +61,7 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
61
61
|
onLoad?: (arg: HubspotEventData) => void;
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
64
65
|
}
|
|
65
66
|
export interface PartnerProps extends CardBaseProps {
|
|
66
67
|
text: string;
|
|
@@ -414,6 +414,9 @@ export declare const ButtonProps: {
|
|
|
414
414
|
};
|
|
415
415
|
})[];
|
|
416
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* @deprecated Metrika will be deleted
|
|
419
|
+
*/
|
|
417
420
|
metrikaGoals: {
|
|
418
421
|
anyOf: ({
|
|
419
422
|
type: string;
|
|
@@ -443,6 +446,9 @@ export declare const ButtonProps: {
|
|
|
443
446
|
};
|
|
444
447
|
})[];
|
|
445
448
|
};
|
|
449
|
+
/**
|
|
450
|
+
* @deprecated Pixel will be deleted
|
|
451
|
+
*/
|
|
446
452
|
pixelEvents: {
|
|
447
453
|
type: string;
|
|
448
454
|
items: {
|
|
@@ -499,6 +505,84 @@ export declare const ButtonProps: {
|
|
|
499
505
|
};
|
|
500
506
|
};
|
|
501
507
|
};
|
|
508
|
+
analyticsEvents: {
|
|
509
|
+
anyOf: ({
|
|
510
|
+
type: string;
|
|
511
|
+
propertyNames: {
|
|
512
|
+
type: string;
|
|
513
|
+
};
|
|
514
|
+
additionalProperty: {
|
|
515
|
+
type: string;
|
|
516
|
+
};
|
|
517
|
+
required: string[];
|
|
518
|
+
properties: {
|
|
519
|
+
name: {
|
|
520
|
+
type: string;
|
|
521
|
+
};
|
|
522
|
+
type: {
|
|
523
|
+
type: string;
|
|
524
|
+
};
|
|
525
|
+
counters: {
|
|
526
|
+
type: string;
|
|
527
|
+
additionalProperties: boolean;
|
|
528
|
+
required: never[];
|
|
529
|
+
properties: {
|
|
530
|
+
include: {
|
|
531
|
+
type: string;
|
|
532
|
+
items: {
|
|
533
|
+
type: string;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
exclude: {
|
|
537
|
+
type: string;
|
|
538
|
+
items: {
|
|
539
|
+
type: string;
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
} | {
|
|
546
|
+
type: string;
|
|
547
|
+
items: {
|
|
548
|
+
type: string;
|
|
549
|
+
propertyNames: {
|
|
550
|
+
type: string;
|
|
551
|
+
};
|
|
552
|
+
additionalProperty: {
|
|
553
|
+
type: string;
|
|
554
|
+
};
|
|
555
|
+
required: string[];
|
|
556
|
+
properties: {
|
|
557
|
+
name: {
|
|
558
|
+
type: string;
|
|
559
|
+
};
|
|
560
|
+
type: {
|
|
561
|
+
type: string;
|
|
562
|
+
};
|
|
563
|
+
counters: {
|
|
564
|
+
type: string;
|
|
565
|
+
additionalProperties: boolean;
|
|
566
|
+
required: never[];
|
|
567
|
+
properties: {
|
|
568
|
+
include: {
|
|
569
|
+
type: string;
|
|
570
|
+
items: {
|
|
571
|
+
type: string;
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
exclude: {
|
|
575
|
+
type: string;
|
|
576
|
+
items: {
|
|
577
|
+
type: string;
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
})[];
|
|
585
|
+
};
|
|
502
586
|
target: {
|
|
503
587
|
type: string;
|
|
504
588
|
enum: string[];
|
|
@@ -629,6 +713,9 @@ export declare const ButtonBlock: {
|
|
|
629
713
|
};
|
|
630
714
|
})[];
|
|
631
715
|
};
|
|
716
|
+
/**
|
|
717
|
+
* @deprecated Metrika will be deleted
|
|
718
|
+
*/
|
|
632
719
|
metrikaGoals: {
|
|
633
720
|
anyOf: ({
|
|
634
721
|
type: string;
|
|
@@ -658,6 +745,9 @@ export declare const ButtonBlock: {
|
|
|
658
745
|
};
|
|
659
746
|
})[];
|
|
660
747
|
};
|
|
748
|
+
/**
|
|
749
|
+
* @deprecated Pixel will be deleted
|
|
750
|
+
*/
|
|
661
751
|
pixelEvents: {
|
|
662
752
|
type: string;
|
|
663
753
|
items: {
|
|
@@ -714,6 +804,84 @@ export declare const ButtonBlock: {
|
|
|
714
804
|
};
|
|
715
805
|
};
|
|
716
806
|
};
|
|
807
|
+
analyticsEvents: {
|
|
808
|
+
anyOf: ({
|
|
809
|
+
type: string;
|
|
810
|
+
propertyNames: {
|
|
811
|
+
type: string;
|
|
812
|
+
};
|
|
813
|
+
additionalProperty: {
|
|
814
|
+
type: string;
|
|
815
|
+
};
|
|
816
|
+
required: string[];
|
|
817
|
+
properties: {
|
|
818
|
+
name: {
|
|
819
|
+
type: string;
|
|
820
|
+
};
|
|
821
|
+
type: {
|
|
822
|
+
type: string;
|
|
823
|
+
};
|
|
824
|
+
counters: {
|
|
825
|
+
type: string;
|
|
826
|
+
additionalProperties: boolean;
|
|
827
|
+
required: never[];
|
|
828
|
+
properties: {
|
|
829
|
+
include: {
|
|
830
|
+
type: string;
|
|
831
|
+
items: {
|
|
832
|
+
type: string;
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
exclude: {
|
|
836
|
+
type: string;
|
|
837
|
+
items: {
|
|
838
|
+
type: string;
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
} | {
|
|
845
|
+
type: string;
|
|
846
|
+
items: {
|
|
847
|
+
type: string;
|
|
848
|
+
propertyNames: {
|
|
849
|
+
type: string;
|
|
850
|
+
};
|
|
851
|
+
additionalProperty: {
|
|
852
|
+
type: string;
|
|
853
|
+
};
|
|
854
|
+
required: string[];
|
|
855
|
+
properties: {
|
|
856
|
+
name: {
|
|
857
|
+
type: string;
|
|
858
|
+
};
|
|
859
|
+
type: {
|
|
860
|
+
type: string;
|
|
861
|
+
};
|
|
862
|
+
counters: {
|
|
863
|
+
type: string;
|
|
864
|
+
additionalProperties: boolean;
|
|
865
|
+
required: never[];
|
|
866
|
+
properties: {
|
|
867
|
+
include: {
|
|
868
|
+
type: string;
|
|
869
|
+
items: {
|
|
870
|
+
type: string;
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
exclude: {
|
|
874
|
+
type: string;
|
|
875
|
+
items: {
|
|
876
|
+
type: string;
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
};
|
|
883
|
+
})[];
|
|
884
|
+
};
|
|
717
885
|
target: {
|
|
718
886
|
type: string;
|
|
719
887
|
enum: string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pixelEvents } from './pixel';
|
|
2
2
|
import { Theme } from '../../models';
|
|
3
3
|
import { ImageProps, urlPattern } from '../../components/Image/schema';
|
|
4
|
+
import { AnalyticsEventV2Schema } from './event';
|
|
4
5
|
export const mediaDirection = ['media-content', 'content-media'];
|
|
5
6
|
export const textSize = ['s', 'm', 'l'];
|
|
6
7
|
export const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -306,6 +307,9 @@ export const ButtonProps = {
|
|
|
306
307
|
},
|
|
307
308
|
],
|
|
308
309
|
},
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated Metrika will be deleted
|
|
312
|
+
*/
|
|
309
313
|
metrikaGoals: {
|
|
310
314
|
anyOf: [
|
|
311
315
|
{ type: 'string' },
|
|
@@ -328,7 +332,13 @@ export const ButtonProps = {
|
|
|
328
332
|
},
|
|
329
333
|
],
|
|
330
334
|
},
|
|
335
|
+
/**
|
|
336
|
+
* @deprecated Pixel will be deleted
|
|
337
|
+
*/
|
|
331
338
|
pixelEvents,
|
|
339
|
+
analyticsEvents: {
|
|
340
|
+
anyOf: [AnalyticsEventV2Schema, { type: 'array', items: AnalyticsEventV2Schema }],
|
|
341
|
+
},
|
|
332
342
|
target: {
|
|
333
343
|
type: 'string',
|
|
334
344
|
enum: ['_self', '_blank', '_parent', '_top'],
|