@gravity-ui/page-constructor 1.19.0 → 1.20.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/CHANGELOG.md +14 -0
- package/README.md +79 -6
- package/build/cjs/blocks/Banner/schema.d.ts +234 -0
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +81 -0
- package/build/cjs/blocks/Header/schema.d.ts +3 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/cjs/blocks/Icons/schema.d.ts +6 -0
- package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
- package/build/cjs/blocks/Map/schema.d.ts +129 -34
- package/build/cjs/blocks/Media/schema.d.ts +162 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- package/build/cjs/blocks/Share/Share.js +5 -1
- package/build/cjs/blocks/Simple/schema.d.ts +3 -0
- package/build/cjs/blocks/Slider/schema.d.ts +3 -0
- package/build/cjs/blocks/Table/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +81 -0
- package/build/cjs/components/BackLink/BackLink.js +5 -1
- package/build/cjs/components/Button/Button.js +6 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -1
- package/build/cjs/components/CardBase/CardBase.js +5 -1
- package/build/cjs/components/Link/Link.js +5 -1
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/Media/Video/Video.js +3 -2
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +16 -3
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -1
- package/build/cjs/components/YandexForm/YandexForm.js +14 -2
- package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js +3 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +7 -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/blockIdContext/blockIdContext.d.ts +3 -0
- package/build/cjs/context/blockIdContext/blockIdContext.js +6 -0
- package/build/cjs/context/blockIdContext/index.d.ts +1 -0
- package/build/cjs/context/blockIdContext/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 +35 -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 +45 -0
- package/build/cjs/models/common.js +22 -1
- package/build/cjs/models/constructor-items/common.d.ts +5 -5
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +5 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
- package/build/cjs/schema/validators/common.d.ts +309 -43
- package/build/cjs/schema/validators/common.js +39 -18
- package/build/cjs/schema/validators/event.d.ts +37 -0
- package/build/cjs/schema/validators/event.js +38 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +15 -2
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +13 -0
- package/build/cjs/sub-blocks/Quote/Quote.js +4 -1
- package/build/cjs/utils/analytics.d.ts +2 -0
- package/build/cjs/utils/analytics.js +17 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/esm/blocks/Banner/schema.d.ts +234 -0
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +81 -0
- package/build/esm/blocks/Header/schema.d.ts +3 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/esm/blocks/Icons/schema.d.ts +6 -0
- package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
- package/build/esm/blocks/Map/schema.d.ts +129 -34
- package/build/esm/blocks/Media/schema.d.ts +162 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- package/build/esm/blocks/Share/Share.js +6 -2
- package/build/esm/blocks/Simple/schema.d.ts +3 -0
- package/build/esm/blocks/Slider/schema.d.ts +3 -0
- package/build/esm/blocks/Table/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/schema.d.ts +81 -0
- package/build/esm/components/BackLink/BackLink.js +5 -1
- package/build/esm/components/Button/Button.js +6 -2
- package/build/esm/components/CardBase/CardBase.d.ts +2 -1
- package/build/esm/components/CardBase/CardBase.js +5 -1
- package/build/esm/components/Link/Link.js +5 -1
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/Media/Video/Video.js +3 -2
- package/build/esm/components/ReactPlayer/ReactPlayer.js +17 -4
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -1
- package/build/esm/components/YandexForm/YandexForm.js +14 -2
- package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/esm/containers/PageConstructor/Provider.js +3 -1
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +7 -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/blockIdContext/blockIdContext.d.ts +3 -0
- package/build/esm/context/blockIdContext/blockIdContext.js +2 -0
- package/build/esm/context/blockIdContext/index.d.ts +1 -0
- package/build/esm/context/blockIdContext/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 +31 -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 +45 -0
- package/build/esm/models/common.js +21 -0
- package/build/esm/models/constructor-items/common.d.ts +5 -5
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
- package/build/esm/schema/validators/common.d.ts +309 -43
- package/build/esm/schema/validators/common.js +39 -18
- package/build/esm/schema/validators/event.d.ts +37 -0
- package/build/esm/schema/validators/event.js +35 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +16 -3
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +13 -0
- package/build/esm/sub-blocks/Quote/Quote.js +6 -3
- package/build/esm/utils/analytics.d.ts +2 -0
- package/build/esm/utils/analytics.js +13 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/package.json +1 -1
- package/server/models/common.d.ts +45 -0
- package/server/models/common.js +22 -1
- package/server/models/constructor-items/common.d.ts +5 -5
- package/server/models/constructor-items/sub-blocks.d.ts +2 -2
- package/server/utils/analytics.d.ts +2 -0
- package/server/utils/analytics.js +17 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
|
@@ -4,12 +4,14 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
const models_1 = require("../../models");
|
|
7
8
|
const icons_1 = require("../../icons");
|
|
8
9
|
const FileLink_1 = tslib_1.__importDefault(require("../FileLink/FileLink"));
|
|
9
10
|
const BackLink_1 = tslib_1.__importDefault(require("../BackLink/BackLink"));
|
|
10
11
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
11
12
|
const locationContext_1 = require("../../context/locationContext/locationContext");
|
|
12
13
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
14
|
+
const hooks_1 = require("../../hooks");
|
|
13
15
|
const b = (0, utils_1.block)('link-block');
|
|
14
16
|
const WORD_JOINER_SYM = '\u200b';
|
|
15
17
|
function getArrowSize(size) {
|
|
@@ -25,14 +27,16 @@ function getArrowSize(size) {
|
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
const LinkBlock = (props) => {
|
|
28
|
-
const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
30
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
29
31
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
32
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Link, url);
|
|
30
33
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
31
34
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
32
35
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
33
36
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
34
37
|
const onClick = () => {
|
|
35
38
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
39
|
+
handleAnalytics(analyticsEvents);
|
|
36
40
|
};
|
|
37
41
|
const getLinkByType = () => {
|
|
38
42
|
switch (theme) {
|
|
@@ -10,7 +10,7 @@ const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
|
|
|
10
10
|
const VideoBlock_1 = tslib_1.__importDefault(require("../VideoBlock/VideoBlock"));
|
|
11
11
|
const b = (0, utils_1.block)('Media');
|
|
12
12
|
const Media = (props) => {
|
|
13
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, } = props;
|
|
13
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, analyticsEvents, } = props;
|
|
14
14
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
15
15
|
const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
|
|
16
16
|
const content = (0, react_1.useMemo)(() => {
|
|
@@ -19,7 +19,7 @@ const Media = (props) => {
|
|
|
19
19
|
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
20
20
|
}
|
|
21
21
|
if (video) {
|
|
22
|
-
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
22
|
+
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
23
23
|
}
|
|
24
24
|
if (youtube) {
|
|
25
25
|
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullScreen: fullScreen }));
|
|
@@ -40,6 +40,7 @@ const Media = (props) => {
|
|
|
40
40
|
hasVideoFallback,
|
|
41
41
|
videoClassName,
|
|
42
42
|
metrika,
|
|
43
|
+
analyticsEvents,
|
|
43
44
|
playVideo,
|
|
44
45
|
previewImg,
|
|
45
46
|
playButton,
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("./utils");
|
|
|
8
8
|
const utils_2 = require("../../../utils");
|
|
9
9
|
const b = (0, utils_2.block)('media-component-video');
|
|
10
10
|
const Video = (props) => {
|
|
11
|
-
const { video, height, metrika, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
11
|
+
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
12
12
|
const ref = (0, react_1.useRef)(null);
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
14
14
|
if (ref && ref.current) {
|
|
@@ -31,7 +31,7 @@ const Video = (props) => {
|
|
|
31
31
|
}, [playVideo, video, setHasVideoFallback]);
|
|
32
32
|
const reactPlayerBlock = (0, react_1.useMemo)(() => {
|
|
33
33
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
34
|
-
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
|
|
34
|
+
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height }));
|
|
35
35
|
}, [
|
|
36
36
|
video,
|
|
37
37
|
height,
|
|
@@ -41,6 +41,7 @@ const Video = (props) => {
|
|
|
41
41
|
commonPlayButton,
|
|
42
42
|
customBarControlsClassName,
|
|
43
43
|
metrika,
|
|
44
|
+
analyticsEvents,
|
|
44
45
|
]);
|
|
45
46
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
46
47
|
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -12,6 +12,7 @@ const CustomBarControls_1 = tslib_1.__importDefault(require("./CustomBarControls
|
|
|
12
12
|
const videoContext_1 = require("../../context/videoContext");
|
|
13
13
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
14
14
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
15
|
+
const hooks_1 = require("../../hooks");
|
|
15
16
|
const icons_1 = require("../../icons");
|
|
16
17
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
17
18
|
const FPS = 60;
|
|
@@ -19,7 +20,7 @@ const FPS = 60;
|
|
|
19
20
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
20
21
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
21
22
|
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
22
|
-
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
23
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
23
24
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
24
25
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
25
26
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -34,6 +35,13 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
34
35
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
35
36
|
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
36
37
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
38
|
+
const eventsArray = (0, react_1.useMemo)(() => {
|
|
39
|
+
if (analyticsEvents) {
|
|
40
|
+
return Array.isArray(analyticsEvents) ? analyticsEvents : [analyticsEvents];
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}, [analyticsEvents]);
|
|
44
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.ReactPlayerControls);
|
|
37
45
|
(0, react_1.useImperativeHandle)(originRef, () => ({
|
|
38
46
|
pause: () => setIsPlaying(false),
|
|
39
47
|
}));
|
|
@@ -82,6 +90,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
82
90
|
window.removeEventListener('resize', updateSize);
|
|
83
91
|
};
|
|
84
92
|
}, []);
|
|
93
|
+
const playEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Play), [eventsArray]);
|
|
94
|
+
const stopEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Stop), [eventsArray]);
|
|
85
95
|
const playIcon = (0, react_1.useMemo)(() => {
|
|
86
96
|
let playButtonContent;
|
|
87
97
|
switch (type) {
|
|
@@ -107,12 +117,14 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
107
117
|
metrika.reachGoals(goal, counterName);
|
|
108
118
|
}
|
|
109
119
|
}
|
|
120
|
+
const events = isMuted ? playEvents : stopEvents;
|
|
121
|
+
handleAnalytics(events);
|
|
110
122
|
if (isMuted) {
|
|
111
123
|
setProps({ playingVideoRef: ref.current });
|
|
112
124
|
}
|
|
113
125
|
// In order to the progress bar to update (equals 0) before displaying
|
|
114
126
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
115
|
-
}, [playerRef,
|
|
127
|
+
}, [playerRef, metrika, videoMetrika, handleAnalytics, playEvents, stopEvents, setProps]);
|
|
116
128
|
const handleClick = (0, react_1.useCallback)(() => changeMute(muted), [changeMute, muted]);
|
|
117
129
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
118
130
|
setIsPlaying(true);
|
|
@@ -123,7 +135,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
123
135
|
metrika.reachGoals(play, counterName);
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
|
-
|
|
138
|
+
handleAnalytics(playEvents);
|
|
139
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
127
140
|
const onPause = (0, react_1.useCallback)(() => {
|
|
128
141
|
// For support correct state for youtube
|
|
129
142
|
setIsPlaying(false);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
+
import { AnalyticsEventsBase } from '../../models/common';
|
|
2
3
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
3
|
-
export interface YandexFormProps {
|
|
4
|
+
export interface YandexFormProps extends AnalyticsEventsBase {
|
|
4
5
|
id: number | string;
|
|
5
6
|
containerId?: string;
|
|
6
7
|
theme?: string;
|
|
@@ -7,16 +7,19 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
const localeContext_1 = require("../../context/localeContext");
|
|
8
8
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
|
+
const common_1 = require("../../models/common");
|
|
10
11
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
12
|
+
const hooks_1 = require("../../hooks");
|
|
11
13
|
exports.YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
12
14
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
13
15
|
const b = (0, utils_1.block)('yandex-form');
|
|
14
16
|
const YandexForm = (props) => {
|
|
15
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, customFormOrigin, } = props;
|
|
17
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, } = props;
|
|
16
18
|
const formContainerRef = (0, react_1.useRef)(null);
|
|
17
19
|
const iframeRef = (0, react_1.useRef)();
|
|
18
20
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
19
21
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
22
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.YandexFormSubmit);
|
|
20
23
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
21
24
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
22
25
|
const updateFormIframe = (0, react_1.useCallback)((container) => {
|
|
@@ -57,10 +60,19 @@ const YandexForm = (props) => {
|
|
|
57
60
|
window.scrollBy(0, top - headerHeight);
|
|
58
61
|
}
|
|
59
62
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
63
|
+
handleAnalytics(analyticsEvents);
|
|
60
64
|
if (onSubmit) {
|
|
61
65
|
onSubmit();
|
|
62
66
|
}
|
|
63
|
-
}, [
|
|
67
|
+
}, [
|
|
68
|
+
handleMetrika,
|
|
69
|
+
metrikaGoals,
|
|
70
|
+
pixelEvents,
|
|
71
|
+
handleAnalytics,
|
|
72
|
+
analyticsEvents,
|
|
73
|
+
onSubmit,
|
|
74
|
+
headerHeight,
|
|
75
|
+
]);
|
|
64
76
|
const handleMessage = (0, react_1.useCallback)(({ origin, data }) => {
|
|
65
77
|
if (origin !== yaFormOrigin) {
|
|
66
78
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MetrikaContextProps } from '../../context/metrikaContext';
|
|
2
|
+
import { AnalyticsContextProps } from '../../context/analyticsContext';
|
|
2
3
|
import { MapsContextType } from '../../context/mapsContext/mapsContext';
|
|
3
4
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
4
5
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
@@ -15,5 +16,6 @@ export interface PageConstructorProviderProps {
|
|
|
15
16
|
theme?: ConstructorTheme;
|
|
16
17
|
mapsContext?: MapsContextType;
|
|
17
18
|
projectSettings?: ProjectSettingsContextProps;
|
|
19
|
+
analytics?: AnalyticsContextProps;
|
|
18
20
|
}
|
|
19
21
|
export declare const PageConstructorProvider: (props: WithChildren<PageConstructorProviderProps>) => JSX.Element;
|
|
@@ -4,6 +4,7 @@ exports.PageConstructorProvider = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
7
|
+
const analyticsContext_1 = require("../../context/analyticsContext");
|
|
7
8
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
8
9
|
const mapsContext_1 = require("../../context/mapsContext/mapsContext");
|
|
9
10
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
@@ -13,7 +14,7 @@ const locationContext_1 = require("../../context/locationContext");
|
|
|
13
14
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
14
15
|
const constants_1 = require("../../components/constants");
|
|
15
16
|
const PageConstructorProvider = (props) => {
|
|
16
|
-
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, metrika = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, } = props;
|
|
17
|
+
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, metrika = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, } = props;
|
|
17
18
|
/* eslint-disable react/jsx-key */
|
|
18
19
|
const context = [
|
|
19
20
|
react_1.default.createElement(ThemeValueContext_1.ThemeValueContext.Provider, { value: { themeValue: theme } }),
|
|
@@ -23,6 +24,7 @@ const PageConstructorProvider = (props) => {
|
|
|
23
24
|
react_1.default.createElement(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
24
25
|
react_1.default.createElement(mapsContext_1.MapsContext.Provider, { value: mapsContext }),
|
|
25
26
|
react_1.default.createElement(metrikaContext_1.MetrikaContext.Provider, { value: metrika }),
|
|
27
|
+
react_1.default.createElement(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
|
|
26
28
|
react_1.default.createElement(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
27
29
|
].reduceRight((prev, provider) => react_1.default.cloneElement(provider, {}, prev), children);
|
|
28
30
|
/* eslint-enable react/jsx-key */
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -6,18 +6,20 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
|
6
6
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
7
|
const utils_1 = require("../../../../utils");
|
|
8
8
|
const innerContext_1 = require("../../../../context/innerContext");
|
|
9
|
+
const blockIdContext_1 = require("../../../../context/blockIdContext");
|
|
9
10
|
const ConstructorLoadable_1 = require("../ConstructorLoadable");
|
|
10
11
|
const ConstructorItem_1 = require("../ConstructorItem");
|
|
11
12
|
const ConstructorBlock_1 = require("../ConstructorBlock/ConstructorBlock");
|
|
12
13
|
const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
13
14
|
const { blockTypes, loadables, itemMap } = (0, react_1.useContext)(innerContext_1.InnerContext);
|
|
14
|
-
const renderer = (item, index) => {
|
|
15
|
+
const renderer = (parentId = '', item, index) => {
|
|
15
16
|
if (!itemMap[item.type]) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
let children;
|
|
19
20
|
let itemElement;
|
|
20
21
|
const key = (0, utils_1.getBlockKey)(item, index);
|
|
22
|
+
const blockId = parentId ? `${parentId}_${key}` : key;
|
|
21
23
|
if (shouldRenderBlock && !shouldRenderBlock(item, key)) {
|
|
22
24
|
return null;
|
|
23
25
|
}
|
|
@@ -31,12 +33,13 @@ const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
31
33
|
}
|
|
32
34
|
else {
|
|
33
35
|
if ('children' in item && item.children) {
|
|
34
|
-
children = item.children.map(renderer);
|
|
36
|
+
children = item.children.map(renderer.bind(null, blockId));
|
|
35
37
|
}
|
|
36
|
-
itemElement = (react_1.default.createElement(
|
|
38
|
+
itemElement = (react_1.default.createElement(blockIdContext_1.BlockIdContext.Provider, { value: blockId },
|
|
39
|
+
react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: item, key: key }, children)));
|
|
37
40
|
}
|
|
38
41
|
return blockTypes.includes(item.type) ? (react_1.default.createElement(ConstructorBlock_1.ConstructorBlock, { data: item, key: key, Component: itemElement })) : (itemElement);
|
|
39
42
|
};
|
|
40
|
-
return react_1.default.createElement(react_1.Fragment, null, items.map(renderer));
|
|
43
|
+
return react_1.default.createElement(react_1.Fragment, null, items.map(renderer.bind(null, '')));
|
|
41
44
|
};
|
|
42
45
|
exports.ConstructorBlocks = ConstructorBlocks;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsEvent } from '../../models';
|
|
3
|
+
export interface AnalyticsContextProps {
|
|
4
|
+
sendEvents?: (events: AnalyticsEvent[]) => void;
|
|
5
|
+
autoEvents?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AnalyticsContext: React.Context<AnalyticsContextProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyticsContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
exports.AnalyticsContext = react_1.default.createContext({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analyticsContext';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockIdContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
exports.BlockIdContext = react_1.default.createContext('');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './blockIdContext';
|
|
@@ -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/cjs/hooks/index.js
CHANGED
|
@@ -10,4 +10,5 @@ var useIntersection_1 = require("./useIntersection");
|
|
|
10
10
|
Object.defineProperty(exports, "useIntersection", { enumerable: true, get: function () { return useIntersection_1.useIntersection; } });
|
|
11
11
|
var useMount_1 = require("./useMount");
|
|
12
12
|
Object.defineProperty(exports, "useMount", { enumerable: true, get: function () { return tslib_1.__importDefault(useMount_1).default; } });
|
|
13
|
+
tslib_1.__exportStar(require("./useAnalytics"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./hubspot"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnalytics = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const blockIdContext_1 = require("../context/blockIdContext");
|
|
7
|
+
const analyticsContext_1 = require("../context/analyticsContext");
|
|
8
|
+
const models_1 = require("../models");
|
|
9
|
+
const useAnalytics = (name = '', target) => {
|
|
10
|
+
const { sendEvents, autoEvents } = (0, react_1.useContext)(analyticsContext_1.AnalyticsContext);
|
|
11
|
+
const context = (0, react_1.useContext)(blockIdContext_1.BlockIdContext);
|
|
12
|
+
const defaultEvent = (0, react_1.useMemo)(() => name
|
|
13
|
+
? {
|
|
14
|
+
name,
|
|
15
|
+
context,
|
|
16
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
17
|
+
target: target,
|
|
18
|
+
}
|
|
19
|
+
: undefined, [context, name, target]);
|
|
20
|
+
if (!sendEvents) {
|
|
21
|
+
return (0, lodash_1.memoize)(() => { });
|
|
22
|
+
}
|
|
23
|
+
const defaultEvents = defaultEvent && autoEvents ? [defaultEvent] : [];
|
|
24
|
+
return (0, lodash_1.memoize)((e) => {
|
|
25
|
+
let events = defaultEvents;
|
|
26
|
+
if (e) {
|
|
27
|
+
events = Array.isArray(e) ? [...events, ...e] : [...events, e];
|
|
28
|
+
}
|
|
29
|
+
if (!events) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
sendEvents(events);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.useAnalytics = useAnalytics;
|
|
@@ -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 {};
|
|
@@ -5,12 +5,20 @@ const react_1 = require("react");
|
|
|
5
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
6
6
|
const models_1 = require("../models");
|
|
7
7
|
const guards_1 = require("../models/guards");
|
|
8
|
+
// eslint-disable-next-line valid-jsdoc
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Metrika will be deleted, which uses this logic
|
|
11
|
+
*/
|
|
8
12
|
function isButtonPixel(pixelEvents) {
|
|
9
13
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
10
14
|
return true;
|
|
11
15
|
}
|
|
12
16
|
return false;
|
|
13
17
|
}
|
|
18
|
+
// eslint-disable-next-line valid-jsdoc
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated useMetrika will be deleted
|
|
21
|
+
*/
|
|
14
22
|
const useMetrika = () => {
|
|
15
23
|
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
16
24
|
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,34 @@ export interface ClassNameProps {
|
|
|
49
64
|
className?: string;
|
|
50
65
|
}
|
|
51
66
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
|
+
export declare enum PredefinedEventTypes {
|
|
68
|
+
Default = "default-event",
|
|
69
|
+
Play = "play",
|
|
70
|
+
Stop = "stop"
|
|
71
|
+
}
|
|
72
|
+
export declare enum DefaultEventNames {
|
|
73
|
+
ShareButton = "share-button-click",
|
|
74
|
+
Button = "button-click",
|
|
75
|
+
CardBase = "card-base-click",
|
|
76
|
+
Link = "link-click",
|
|
77
|
+
ReactPlayerControls = "react-player-controls-click",
|
|
78
|
+
YandexFormSubmit = "yandex-form-submit",
|
|
79
|
+
HubspotFormSubmit = "hubspot-form-submit",
|
|
80
|
+
QuoteButton = "quote-button-click",
|
|
81
|
+
BackLink = "back-link-click"
|
|
82
|
+
}
|
|
83
|
+
export type AnalyticsCounters = {
|
|
84
|
+
include?: string[];
|
|
85
|
+
exclude?: string[];
|
|
86
|
+
};
|
|
87
|
+
export type AnalyticsEvent<T = {}> = T & {
|
|
88
|
+
name: string;
|
|
89
|
+
type?: string;
|
|
90
|
+
counters?: AnalyticsCounters;
|
|
91
|
+
context?: string;
|
|
92
|
+
target?: string;
|
|
93
|
+
};
|
|
94
|
+
export interface AnalyticsEventsBase {
|
|
95
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
96
|
+
}
|
|
52
97
|
export {};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PixelEventType = exports.Theme = void 0;
|
|
3
|
+
exports.DefaultEventNames = exports.PredefinedEventTypes = exports.PixelEventType = exports.Theme = void 0;
|
|
4
4
|
var Theme;
|
|
5
5
|
(function (Theme) {
|
|
6
6
|
Theme["Light"] = "light";
|
|
7
7
|
Theme["Dark"] = "dark";
|
|
8
8
|
})(Theme = exports.Theme || (exports.Theme = {}));
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Pixel will be deleted from package
|
|
11
|
+
*/
|
|
9
12
|
var PixelEventType;
|
|
10
13
|
(function (PixelEventType) {
|
|
11
14
|
PixelEventType["AddPaymentInfo"] = "AddPaymentInfo";
|
|
@@ -27,3 +30,21 @@ var PixelEventType;
|
|
|
27
30
|
PixelEventType["Subscribe"] = "Subscribe";
|
|
28
31
|
PixelEventType["ViewContent"] = "ViewContent";
|
|
29
32
|
})(PixelEventType = exports.PixelEventType || (exports.PixelEventType = {}));
|
|
33
|
+
var PredefinedEventTypes;
|
|
34
|
+
(function (PredefinedEventTypes) {
|
|
35
|
+
PredefinedEventTypes["Default"] = "default-event";
|
|
36
|
+
PredefinedEventTypes["Play"] = "play";
|
|
37
|
+
PredefinedEventTypes["Stop"] = "stop";
|
|
38
|
+
})(PredefinedEventTypes = exports.PredefinedEventTypes || (exports.PredefinedEventTypes = {}));
|
|
39
|
+
var DefaultEventNames;
|
|
40
|
+
(function (DefaultEventNames) {
|
|
41
|
+
DefaultEventNames["ShareButton"] = "share-button-click";
|
|
42
|
+
DefaultEventNames["Button"] = "button-click";
|
|
43
|
+
DefaultEventNames["CardBase"] = "card-base-click";
|
|
44
|
+
DefaultEventNames["Link"] = "link-click";
|
|
45
|
+
DefaultEventNames["ReactPlayerControls"] = "react-player-controls-click";
|
|
46
|
+
DefaultEventNames["YandexFormSubmit"] = "yandex-form-submit";
|
|
47
|
+
DefaultEventNames["HubspotFormSubmit"] = "hubspot-form-submit";
|
|
48
|
+
DefaultEventNames["QuoteButton"] = "quote-button-click";
|
|
49
|
+
DefaultEventNames["BackLink"] = "back-link-click";
|
|
50
|
+
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|
|
@@ -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 { AnalyticsEventsBase, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -100,7 +100,7 @@ export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, P
|
|
|
100
100
|
imageClassName?: string;
|
|
101
101
|
hide?: boolean;
|
|
102
102
|
}
|
|
103
|
-
export interface MediaVideoProps {
|
|
103
|
+
export interface MediaVideoProps extends AnalyticsEventsBase {
|
|
104
104
|
src: string[];
|
|
105
105
|
type?: MediaVideoType;
|
|
106
106
|
loop?: LoopProps | boolean;
|
|
@@ -111,7 +111,7 @@ export interface MediaVideoProps {
|
|
|
111
111
|
controls?: MediaVideoControlsType;
|
|
112
112
|
metrika?: MetrikaVideo;
|
|
113
113
|
}
|
|
114
|
-
export interface LinkProps extends Stylable {
|
|
114
|
+
export interface LinkProps extends AnalyticsEventsBase, Stylable {
|
|
115
115
|
url: string;
|
|
116
116
|
text?: string;
|
|
117
117
|
textSize?: TextSize;
|
|
@@ -130,7 +130,7 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
130
130
|
theme?: ContentTheme;
|
|
131
131
|
onClick?: () => void;
|
|
132
132
|
}
|
|
133
|
-
export interface ButtonProps {
|
|
133
|
+
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
134
|
text: string;
|
|
135
135
|
url: string;
|
|
136
136
|
primary?: boolean;
|
|
@@ -163,7 +163,7 @@ export interface MediaVideoProps {
|
|
|
163
163
|
metrika?: MetrikaVideo;
|
|
164
164
|
}
|
|
165
165
|
export type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;
|
|
166
|
-
export interface MediaComponentVideoProps {
|
|
166
|
+
export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
167
167
|
video: MediaVideoProps;
|
|
168
168
|
height?: number;
|
|
169
169
|
metrika?: MetrikaVideo;
|
|
@@ -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 { AnalyticsEventsBase, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -38,7 +38,7 @@ export interface DividerProps {
|
|
|
38
38
|
size?: DividerSize;
|
|
39
39
|
border?: boolean;
|
|
40
40
|
}
|
|
41
|
-
export interface HubspotFormProps extends HubspotEventHandlers {
|
|
41
|
+
export interface HubspotFormProps extends HubspotEventHandlers, AnalyticsEventsBase {
|
|
42
42
|
className?: string;
|
|
43
43
|
theme?: ContentTheme;
|
|
44
44
|
isMobile?: boolean;
|
|
@@ -4,10 +4,12 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const SocialIcon_1 = tslib_1.__importDefault(require("../SocialIcon/SocialIcon"));
|
|
7
|
+
const blockIdContext_1 = require("../../../context/blockIdContext");
|
|
7
8
|
const NavigationButton_1 = require("./components/NavigationButton/NavigationButton");
|
|
8
9
|
const NavigationDropdown_1 = require("./components/NavigationDropdown/NavigationDropdown");
|
|
9
10
|
const NavigationLink_1 = require("./components/NavigationLink/NavigationLink");
|
|
10
11
|
const GithubStars_1 = require("./components/GithubStars/GithubStars");
|
|
12
|
+
const ANALYTICS_ID = 'navigation';
|
|
11
13
|
//todo: add types support form component in map
|
|
12
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
15
|
const NavigationItemsMap = {
|
|
@@ -22,6 +24,8 @@ const NavigationItem = (_a) => {
|
|
|
22
24
|
const { type = models_1.NavigationItemType.Link } = data;
|
|
23
25
|
const Component = NavigationItemsMap[type];
|
|
24
26
|
const componentProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({ className }, data), props)), [className, data, props]);
|
|
25
|
-
return react_1.default.createElement(
|
|
27
|
+
return (react_1.default.createElement(blockIdContext_1.BlockIdContext.Provider, { value: ANALYTICS_ID },
|
|
28
|
+
react_1.default.createElement(Component, Object.assign({}, componentProps)),
|
|
29
|
+
";"));
|
|
26
30
|
};
|
|
27
31
|
exports.default = NavigationItem;
|