@gravity-ui/page-constructor 1.15.0-alpha.3 → 1.15.0-alpha.5
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/Banner.js +3 -2
- package/build/cjs/blocks/Banner/schema.d.ts +9 -0
- package/build/cjs/blocks/Banner/schema.js +3 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/cjs/blocks/Header/Header.js +6 -5
- 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/Info/Info.js +4 -3
- package/build/cjs/blocks/Info/schema.d.ts +3 -0
- package/build/cjs/blocks/Info/schema.js +2 -0
- package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/Media.js +3 -2
- package/build/cjs/blocks/Media/MediaContent.js +3 -2
- package/build/cjs/blocks/Media/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/cjs/blocks/Preview/Preview.js +3 -2
- package/build/cjs/blocks/Preview/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/schema.js +3 -1
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/Questions.js +3 -2
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/Security.js +3 -2
- package/build/cjs/blocks/Security/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/schema.js +3 -1
- package/build/cjs/blocks/Share/Share.d.ts +1 -1
- package/build/cjs/blocks/Share/Share.js +10 -2
- 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/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +5 -4
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
- package/build/cjs/components/BackLink/BackLink.js +10 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +12 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +5 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +3 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +7 -2
- package/build/cjs/components/Link/Link.js +4 -3
- package/build/cjs/components/Media/Media.js +4 -2
- package/build/cjs/components/Media/Video/Video.js +4 -2
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +14 -7
- package/build/cjs/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/cjs/components/YandexForm/YandexForm.js +8 -2
- package/build/cjs/constructor-items.d.ts +5 -5
- package/build/cjs/models/constructor-items/blocks.d.ts +11 -0
- package/build/cjs/models/constructor-items/common.d.ts +4 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/cjs/schema/validators/common.d.ts +3 -0
- package/build/cjs/schema/validators/common.js +2 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/cjs/sub-blocks/Content/Content.js +4 -3
- package/build/cjs/sub-blocks/HubspotForm/index.js +8 -2
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +9 -2
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/schema.js +3 -1
- package/build/esm/blocks/Banner/Banner.js +3 -2
- package/build/esm/blocks/Banner/schema.d.ts +9 -0
- package/build/esm/blocks/Banner/schema.js +3 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
- package/build/esm/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/esm/blocks/Header/Header.js +6 -5
- 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/Info/Info.js +4 -3
- package/build/esm/blocks/Info/schema.d.ts +3 -0
- package/build/esm/blocks/Info/schema.js +2 -0
- package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
- package/build/esm/blocks/Media/Media.js +3 -2
- package/build/esm/blocks/Media/MediaContent.js +3 -2
- package/build/esm/blocks/Media/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/esm/blocks/Preview/Preview.js +3 -2
- package/build/esm/blocks/Preview/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/schema.js +3 -1
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/Questions.js +3 -2
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- package/build/esm/blocks/Security/Security.js +3 -2
- package/build/esm/blocks/Security/schema.d.ts +3 -0
- package/build/esm/blocks/Security/schema.js +3 -1
- package/build/esm/blocks/Share/Share.d.ts +1 -1
- package/build/esm/blocks/Share/Share.js +11 -3
- 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/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +5 -4
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/BackLink/BackLink.d.ts +1 -0
- package/build/esm/components/BackLink/BackLink.js +10 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +12 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.js +5 -2
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +3 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +7 -2
- package/build/esm/components/Link/Link.js +4 -3
- package/build/esm/components/Media/Media.js +4 -2
- package/build/esm/components/Media/Video/Video.js +4 -2
- package/build/esm/components/ReactPlayer/ReactPlayer.js +14 -7
- package/build/esm/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/esm/components/YandexForm/YandexForm.js +8 -2
- package/build/esm/constructor-items.d.ts +5 -5
- package/build/esm/models/constructor-items/blocks.d.ts +11 -0
- package/build/esm/models/constructor-items/common.d.ts +4 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/esm/schema/validators/common.d.ts +3 -0
- package/build/esm/schema/validators/common.js +2 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/esm/sub-blocks/Content/Content.js +4 -3
- package/build/esm/sub-blocks/HubspotForm/index.js +8 -2
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/esm/sub-blocks/Quote/Quote.js +11 -4
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/schema.js +3 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +11 -0
- package/server/models/constructor-items/common.d.ts +4 -0
- package/server/models/constructor-items/sub-blocks.d.ts +4 -1
|
@@ -8,20 +8,29 @@ import { useMetrika } from '../../hooks/useMetrika';
|
|
|
8
8
|
import { useAnalytics } from '../../hooks';
|
|
9
9
|
import { Github } from '../../icons';
|
|
10
10
|
import './Button.css';
|
|
11
|
+
const COMPONENT_NAME = 'button';
|
|
11
12
|
const b = block('button-block');
|
|
12
13
|
const Button = (props) => {
|
|
13
14
|
const handleMetrika = useMetrika();
|
|
14
15
|
const handleAnalytics = useAnalytics();
|
|
15
16
|
const { lang, tld } = useContext(LocaleContext);
|
|
16
|
-
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
17
|
+
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text, blockName = COMPONENT_NAME } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text", "blockName"]);
|
|
17
18
|
const defaultImgPosition = 'left';
|
|
18
19
|
const onClick = useCallback(() => {
|
|
19
20
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
20
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, { type: 'button', block:
|
|
21
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, { name: 'default', type: 'button', block: blockName });
|
|
21
22
|
if (onClickOrigin) {
|
|
22
23
|
onClickOrigin();
|
|
23
24
|
}
|
|
24
|
-
}, [
|
|
25
|
+
}, [
|
|
26
|
+
handleMetrika,
|
|
27
|
+
metrikaGoals,
|
|
28
|
+
pixelEvents,
|
|
29
|
+
handleAnalytics,
|
|
30
|
+
analyticsEvents,
|
|
31
|
+
blockName,
|
|
32
|
+
onClickOrigin,
|
|
33
|
+
]);
|
|
25
34
|
const buttonImg = img instanceof Object
|
|
26
35
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
27
36
|
: { url: img, position: defaultImgPosition };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import { Button } from '../index';
|
|
4
|
+
import { useAnalytics } from '../../hooks';
|
|
4
5
|
import './ButtonTabs.css';
|
|
5
6
|
const b = block('button-tabs');
|
|
6
7
|
const ButtonTabs = (props) => {
|
|
7
|
-
const { className, items, activeTab, onSelectTab } = props;
|
|
8
|
+
const { className, items, activeTab, onSelectTab, blockName = '' } = props;
|
|
9
|
+
const handleAnalytics = useAnalytics();
|
|
8
10
|
const activeTabId = useMemo(() => {
|
|
9
11
|
if (activeTab) {
|
|
10
12
|
return activeTab;
|
|
@@ -12,10 +14,11 @@ const ButtonTabs = (props) => {
|
|
|
12
14
|
return items[0].id;
|
|
13
15
|
}, [activeTab, items]);
|
|
14
16
|
const handleClick = useCallback((tabId) => {
|
|
17
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics([], { name: 'default', type: 'button', block: blockName });
|
|
15
18
|
if (onSelectTab) {
|
|
16
19
|
onSelectTab(tabId);
|
|
17
20
|
}
|
|
18
|
-
}, [onSelectTab]);
|
|
21
|
+
}, [blockName, handleAnalytics, onSelectTab]);
|
|
19
22
|
return (React.createElement("div", { className: b(null, className) }, items.map((item) => {
|
|
20
23
|
const isActive = item.id === activeTabId;
|
|
21
24
|
return (React.createElement(Button, { text: item.title, className: b('item', { active: isActive }), key: item.title, size: 'l', onClick: () => handleClick(item.id), theme: isActive ? 'monochrome' : 'normal' }));
|
|
@@ -12,6 +12,7 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
12
12
|
metrikaGoals?: MetrikaGoal;
|
|
13
13
|
pixelEvents?: ButtonPixel;
|
|
14
14
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
15
|
+
blockName?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface CardHeaderBaseProps {
|
|
17
18
|
className?: string;
|
|
@@ -5,12 +5,13 @@ import RouterLink from '../RouterLink/RouterLink';
|
|
|
5
5
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
6
6
|
import { useAnalytics } from '../../hooks';
|
|
7
7
|
import './CardBase.css';
|
|
8
|
+
const COMPONENT_NAME = 'card-base';
|
|
8
9
|
const b = block('card-base-block');
|
|
9
10
|
const Header = () => null;
|
|
10
11
|
const Content = () => null;
|
|
11
12
|
const Footer = () => null;
|
|
12
13
|
export const Layout = (props) => {
|
|
13
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
14
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', blockName = COMPONENT_NAME, } = props;
|
|
14
15
|
const handleMetrika = useMetrika();
|
|
15
16
|
const handleAnalytics = useAnalytics();
|
|
16
17
|
let header, content, footer, image, headerClass, footerClass;
|
|
@@ -45,7 +46,7 @@ export const Layout = (props) => {
|
|
|
45
46
|
const fullClassName = b({ border }, className);
|
|
46
47
|
const onClick = () => {
|
|
47
48
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
48
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
49
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, { name: 'default', type: 'card', block: blockName });
|
|
49
50
|
};
|
|
50
51
|
return url ? (React.createElement(RouterLink, { href: url },
|
|
51
52
|
React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (React.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -4,13 +4,18 @@ import { useMetrika } from '../../hooks/useMetrika';
|
|
|
4
4
|
import { useAnalytics } from '../../hooks';
|
|
5
5
|
import './HeaderBreadcrumbs.css';
|
|
6
6
|
const b = block('header-breadcrumbs');
|
|
7
|
+
const COMPONENT_NAME = 'header-breadcrumbs';
|
|
7
8
|
export default function HeaderBreadcrumbs(props) {
|
|
8
|
-
const { items, metrikaGoals, pixelEvents, analyticsEvents, theme = 'light', className } = props;
|
|
9
|
+
const { items, metrikaGoals, pixelEvents, analyticsEvents, theme = 'light', blockName = COMPONENT_NAME, className, } = props;
|
|
9
10
|
const handleMetrika = useMetrika();
|
|
10
11
|
const handleAnalytics = useAnalytics();
|
|
11
12
|
const onClick = () => {
|
|
12
13
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
13
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents
|
|
14
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, {
|
|
15
|
+
name: 'default',
|
|
16
|
+
type: 'header-breadcrumbs',
|
|
17
|
+
block: blockName,
|
|
18
|
+
});
|
|
14
19
|
};
|
|
15
20
|
return (React.createElement("div", { className: b({ theme }, className) }, items.map((item) => (React.createElement("div", { className: b('item'), key: item.url },
|
|
16
21
|
React.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -11,6 +11,7 @@ import { useAnalytics } from '../../hooks';
|
|
|
11
11
|
import './Link.css';
|
|
12
12
|
const b = block('link-block');
|
|
13
13
|
const WORD_JOINER_SYM = '\u200b';
|
|
14
|
+
const COMPONENT_NAME = 'link';
|
|
14
15
|
function getArrowSize(size) {
|
|
15
16
|
switch (size) {
|
|
16
17
|
case 'l':
|
|
@@ -24,7 +25,7 @@ function getArrowSize(size) {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
const LinkBlock = (props) => {
|
|
27
|
-
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
28
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, blockName = COMPONENT_NAME, } = props;
|
|
28
29
|
const handleMetrika = useMetrika();
|
|
29
30
|
const handleAnalytics = useAnalytics();
|
|
30
31
|
const { hostname } = useContext(LocationContext);
|
|
@@ -33,12 +34,12 @@ const LinkBlock = (props) => {
|
|
|
33
34
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
34
35
|
const onClick = () => {
|
|
35
36
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
36
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
37
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, { name: 'default', type: 'link', block: blockName });
|
|
37
38
|
};
|
|
38
39
|
const getLinkByType = () => {
|
|
39
40
|
switch (theme) {
|
|
40
41
|
case 'back':
|
|
41
|
-
return React.createElement(BackLink, { title: children || text, url: href, onClick: onClick });
|
|
42
|
+
return (React.createElement(BackLink, { title: children || text, url: href, onClick: onClick, blockName: blockName }));
|
|
42
43
|
case 'file-link':
|
|
43
44
|
case 'underline':
|
|
44
45
|
return (React.createElement(FileLink, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick }));
|
|
@@ -6,9 +6,10 @@ import Video from './Video/Video';
|
|
|
6
6
|
import YoutubeBlock from '../VideoBlock/VideoBlock';
|
|
7
7
|
import './Media.css';
|
|
8
8
|
const b = block('Media');
|
|
9
|
+
const COMPONENT_NAME = 'media-component';
|
|
9
10
|
export const Media = (props) => {
|
|
10
11
|
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, analyticsEvents, } = props;
|
|
11
|
-
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
12
|
+
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, blockName = COMPONENT_NAME, } = props;
|
|
12
13
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
14
|
const content = useMemo(() => {
|
|
14
15
|
let result = [];
|
|
@@ -16,7 +17,7 @@ export const Media = (props) => {
|
|
|
16
17
|
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
17
18
|
}
|
|
18
19
|
if (video) {
|
|
19
|
-
result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
20
|
+
result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback, blockName: blockName }));
|
|
20
21
|
}
|
|
21
22
|
if (youtube) {
|
|
22
23
|
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
@@ -42,6 +43,7 @@ export const Media = (props) => {
|
|
|
42
43
|
previewImg,
|
|
43
44
|
playButton,
|
|
44
45
|
customBarControlsClassName,
|
|
46
|
+
blockName,
|
|
45
47
|
youtubeClassName,
|
|
46
48
|
]);
|
|
47
49
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
@@ -5,8 +5,9 @@ import { getVideoTypesWithPriority } from './utils';
|
|
|
5
5
|
import { block } from '../../../utils';
|
|
6
6
|
import './Video.css';
|
|
7
7
|
const b = block('media-component-video');
|
|
8
|
+
const COMPONENT_NAME = 'media-video';
|
|
8
9
|
const Video = (props) => {
|
|
9
|
-
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
10
|
+
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, blockName = COMPONENT_NAME, } = props;
|
|
10
11
|
const ref = useRef(null);
|
|
11
12
|
useEffect(() => {
|
|
12
13
|
if (ref && ref.current) {
|
|
@@ -29,7 +30,7 @@ const Video = (props) => {
|
|
|
29
30
|
}, [playVideo, video, setHasVideoFallback]);
|
|
30
31
|
const reactPlayerBlock = useMemo(() => {
|
|
31
32
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
32
|
-
return (React.createElement(ReactPlayerBlock, { 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 }));
|
|
33
|
+
return (React.createElement(ReactPlayerBlock, { 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, blockName: blockName }));
|
|
33
34
|
}, [
|
|
34
35
|
video,
|
|
35
36
|
videoClassName,
|
|
@@ -40,6 +41,7 @@ const Video = (props) => {
|
|
|
40
41
|
metrika,
|
|
41
42
|
analyticsEvents,
|
|
42
43
|
height,
|
|
44
|
+
blockName,
|
|
43
45
|
]);
|
|
44
46
|
const defaultVideoBlock = useMemo(() => {
|
|
45
47
|
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -13,11 +13,12 @@ import { useAnalytics } from '../../hooks';
|
|
|
13
13
|
import './ReactPlayer.css';
|
|
14
14
|
const b = block('ReactPlayer');
|
|
15
15
|
const FPS = 60;
|
|
16
|
+
const COMPONENT_NAME = 'react-player';
|
|
16
17
|
// eslint-disable-next-line react/display-name
|
|
17
18
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
18
19
|
const isMobile = useContext(MobileContext);
|
|
19
20
|
const { metrika } = useContext(MetrikaContext);
|
|
20
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
21
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, blockName = COMPONENT_NAME, } = props;
|
|
21
22
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
22
23
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
23
24
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -108,10 +109,13 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
108
109
|
metrika.reachGoals(goal, counterName);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
if (handleAnalytics
|
|
112
|
+
if (handleAnalytics) {
|
|
112
113
|
const events = isMuted ? playEvents : stopEvents;
|
|
113
114
|
if (events) {
|
|
114
|
-
handleAnalytics(events
|
|
115
|
+
handleAnalytics(events, {
|
|
116
|
+
type: 'react-player-change-mute',
|
|
117
|
+
block: blockName,
|
|
118
|
+
});
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
if (isMuted) {
|
|
@@ -124,9 +128,9 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
124
128
|
metrika,
|
|
125
129
|
videoMetrika,
|
|
126
130
|
handleAnalytics,
|
|
127
|
-
analyticsEvents,
|
|
128
131
|
playEvents,
|
|
129
132
|
stopEvents,
|
|
133
|
+
blockName,
|
|
130
134
|
setProps,
|
|
131
135
|
]);
|
|
132
136
|
const handleClick = useCallback(() => changeMute(muted), [changeMute, muted]);
|
|
@@ -139,12 +143,15 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
139
143
|
metrika.reachGoals(play, counterName);
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
if (handleAnalytics
|
|
146
|
+
if (handleAnalytics) {
|
|
143
147
|
if (playEvents) {
|
|
144
|
-
handleAnalytics(playEvents
|
|
148
|
+
handleAnalytics(playEvents, {
|
|
149
|
+
type: 'react-player-preview',
|
|
150
|
+
block: blockName,
|
|
151
|
+
});
|
|
145
152
|
}
|
|
146
153
|
}
|
|
147
|
-
}, [onClickPreview, metrika, videoMetrika, handleAnalytics,
|
|
154
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents, blockName]);
|
|
148
155
|
const onPause = useCallback(() => {
|
|
149
156
|
// For support correct state for youtube
|
|
150
157
|
setIsPlaying(false);
|
|
@@ -16,6 +16,7 @@ export interface YandexFormProps {
|
|
|
16
16
|
metrikaGoals?: string | string[];
|
|
17
17
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
18
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
19
|
+
blockName?: string;
|
|
19
20
|
}
|
|
20
21
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
21
22
|
export default YandexForm;
|
|
@@ -7,9 +7,10 @@ import { useMetrika } from '../../hooks/useMetrika';
|
|
|
7
7
|
import { useAnalytics } from '../..//hooks';
|
|
8
8
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
9
9
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
10
|
+
const COMPONENT_NAME = 'yandex-form';
|
|
10
11
|
const b = block('yandex-form');
|
|
11
12
|
const YandexForm = (props) => {
|
|
12
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, } = props;
|
|
13
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, blockName = COMPONENT_NAME, } = props;
|
|
13
14
|
const formContainerRef = useRef(null);
|
|
14
15
|
const iframeRef = useRef();
|
|
15
16
|
const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;
|
|
@@ -55,7 +56,11 @@ const YandexForm = (props) => {
|
|
|
55
56
|
window.scrollBy(0, top - headerHeight);
|
|
56
57
|
}
|
|
57
58
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
58
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents
|
|
59
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents, {
|
|
60
|
+
name: 'default',
|
|
61
|
+
type: 'yandex-form',
|
|
62
|
+
block: blockName,
|
|
63
|
+
});
|
|
59
64
|
if (onSubmit) {
|
|
60
65
|
onSubmit();
|
|
61
66
|
}
|
|
@@ -65,6 +70,7 @@ const YandexForm = (props) => {
|
|
|
65
70
|
pixelEvents,
|
|
66
71
|
handleAnalytics,
|
|
67
72
|
analyticsEvents,
|
|
73
|
+
blockName,
|
|
68
74
|
onSubmit,
|
|
69
75
|
headerHeight,
|
|
70
76
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const blockMap: {
|
|
2
2
|
"slider-block": (props: import("./models").WithChildren<import("./blocks/Slider/Slider").SliderProps>) => JSX.Element;
|
|
3
3
|
"simple-block": (props: import("./models").WithChildren<import("./models").SimpleBlockProps>) => JSX.Element;
|
|
4
|
-
"extended-features-block": ({ title, description, items, colSizes, animated, }: import("./models").ExtendedFeaturesProps) => JSX.Element;
|
|
4
|
+
"extended-features-block": ({ title, description, items, colSizes, animated, blockName, }: import("./models").ExtendedFeaturesProps) => JSX.Element;
|
|
5
5
|
"promo-features-block": (props: import("./models").PromoFeaturesProps) => JSX.Element;
|
|
6
6
|
"questions-block": (props: import("./models").QuestionsProps) => JSX.Element;
|
|
7
7
|
"banner-block": (props: import("./models").BannerBlockProps) => JSX.Element;
|
|
@@ -11,14 +11,14 @@ export declare const blockMap: {
|
|
|
11
11
|
"info-block": (props: import("./models").InfoBlockProps) => JSX.Element;
|
|
12
12
|
"security-block": (props: import("./models").SecurityBlockProps) => JSX.Element;
|
|
13
13
|
"table-block": (props: import("./models").TableBlockProps) => JSX.Element;
|
|
14
|
-
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
14
|
+
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, blockName, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
15
15
|
"link-table-block": ({ items, title, description, linkTheme }: import("./models").LinkTableBlockProps) => JSX.Element;
|
|
16
16
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
17
17
|
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
18
18
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
19
19
|
"card-layout-block": ({ title, description, animated, colSizes, children, }: import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps) => JSX.Element;
|
|
20
20
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
21
|
-
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
21
|
+
"share-block": ({ items, title, blockName }: import("./models").ShareBlockProps) => JSX.Element;
|
|
22
22
|
};
|
|
23
23
|
export declare const subBlockMap: {
|
|
24
24
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -31,10 +31,10 @@ export declare const subBlockMap: {
|
|
|
31
31
|
*/
|
|
32
32
|
partner: ({ text, logo, url, border }: import("./models").PartnerProps) => JSX.Element;
|
|
33
33
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
34
|
-
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
34
|
+
"media-card": ({ border, blockName, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
35
35
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
36
36
|
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
37
|
-
"card-with-image": ({ title, description, image, disableCompress, links, border, fullScreen, className, additionalInfo, buttons, }: import("./models").CardWithImageProps) => JSX.Element;
|
|
37
|
+
"card-with-image": ({ title, description, image, disableCompress, links, border, fullScreen, className, additionalInfo, buttons, blockName, }: import("./models").CardWithImageProps) => JSX.Element;
|
|
38
38
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
39
39
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
40
40
|
content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
|
|
@@ -109,6 +109,7 @@ export interface HeaderBlockProps {
|
|
|
109
109
|
verticalOffset?: 's' | 'm' | 'l' | 'xl';
|
|
110
110
|
breadcrumbs?: HeaderBreadCrumbsProps;
|
|
111
111
|
status?: JSX.Element;
|
|
112
|
+
blockName?: string;
|
|
112
113
|
}
|
|
113
114
|
export type CalculatorProps = Animatable;
|
|
114
115
|
export interface SimpleBlockProps extends Animatable, Childable {
|
|
@@ -127,6 +128,7 @@ export interface ExtendedFeaturesProps extends Animatable {
|
|
|
127
128
|
title?: TitleProps | string;
|
|
128
129
|
description?: string;
|
|
129
130
|
colSizes?: GridColumnSizesType;
|
|
131
|
+
blockName?: string;
|
|
130
132
|
}
|
|
131
133
|
export interface PromoFeaturesItem {
|
|
132
134
|
title: string;
|
|
@@ -139,6 +141,7 @@ export interface PromoFeaturesProps extends Animatable {
|
|
|
139
141
|
title?: TitleProps | string;
|
|
140
142
|
description?: string;
|
|
141
143
|
theme?: 'grey' | 'default';
|
|
144
|
+
blockName?: string;
|
|
142
145
|
}
|
|
143
146
|
export interface QuestionItem {
|
|
144
147
|
title: string;
|
|
@@ -163,6 +166,7 @@ export interface MediaContentProps {
|
|
|
163
166
|
links?: LinkProps[];
|
|
164
167
|
buttons?: ButtonProps[];
|
|
165
168
|
size?: ContentSize;
|
|
169
|
+
blockName?: string;
|
|
166
170
|
}
|
|
167
171
|
export interface MediaBlockProps extends Animatable, MediaContentProps {
|
|
168
172
|
media: ThemeSupporting<MediaProps>;
|
|
@@ -180,6 +184,7 @@ export interface PreviewBlockProps extends Animatable {
|
|
|
180
184
|
ratioMediaContent?: PreviewRatioMediaContent;
|
|
181
185
|
stopVideo?: boolean;
|
|
182
186
|
showImmediately?: boolean;
|
|
187
|
+
blockName?: string;
|
|
183
188
|
}
|
|
184
189
|
export interface InfoBlockProps {
|
|
185
190
|
theme?: TextTheme;
|
|
@@ -194,6 +199,7 @@ export interface InfoBlockProps {
|
|
|
194
199
|
links?: Pick<LinkProps, 'text' | 'url'>[];
|
|
195
200
|
leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
196
201
|
rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
202
|
+
blockName?: string;
|
|
197
203
|
}
|
|
198
204
|
export interface SecurityBlockPoint {
|
|
199
205
|
img: string;
|
|
@@ -209,6 +215,7 @@ export interface SecurityBlockProps extends Animatable {
|
|
|
209
215
|
title: string;
|
|
210
216
|
points?: SecurityBlockPoint[];
|
|
211
217
|
media: MediaProps;
|
|
218
|
+
blockName?: string;
|
|
212
219
|
}
|
|
213
220
|
export interface TableProps {
|
|
214
221
|
content: string[][];
|
|
@@ -235,6 +242,7 @@ export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
|
235
242
|
centered?: boolean;
|
|
236
243
|
direction?: MediaDirection;
|
|
237
244
|
items: TabsBlockItem[];
|
|
245
|
+
blockName?: string;
|
|
238
246
|
}
|
|
239
247
|
export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
240
248
|
items: LinkProps[][];
|
|
@@ -264,6 +272,7 @@ export interface ContentLayoutBlockProps {
|
|
|
264
272
|
};
|
|
265
273
|
textContent: ContentBlockProps;
|
|
266
274
|
fileContent?: FileLinkProps[];
|
|
275
|
+
blockName?: string;
|
|
267
276
|
}
|
|
268
277
|
export interface ContentBlockProps {
|
|
269
278
|
title?: TitleBaseProps | string;
|
|
@@ -275,6 +284,7 @@ export interface ContentBlockProps {
|
|
|
275
284
|
colSizes?: GridColumnSizesType;
|
|
276
285
|
centered?: boolean;
|
|
277
286
|
theme?: ContentTheme;
|
|
287
|
+
blockName?: string;
|
|
278
288
|
}
|
|
279
289
|
export declare enum PCShareSocialNetwork {
|
|
280
290
|
Vk = "vk",
|
|
@@ -286,6 +296,7 @@ export declare enum PCShareSocialNetwork {
|
|
|
286
296
|
export interface ShareBlockProps {
|
|
287
297
|
items: PCShareSocialNetwork[];
|
|
288
298
|
title?: string;
|
|
299
|
+
blockName?: string;
|
|
289
300
|
}
|
|
290
301
|
export type HeaderBlockModel = {
|
|
291
302
|
type: BlockType.HeaderBlock;
|
|
@@ -111,6 +111,7 @@ export interface MediaVideoProps {
|
|
|
111
111
|
controls?: MediaVideoControlsType;
|
|
112
112
|
metrika?: MetrikaVideo;
|
|
113
113
|
analyticsEvents?: AnalyticsEvent[];
|
|
114
|
+
blockName?: string;
|
|
114
115
|
}
|
|
115
116
|
export interface LinkProps extends Stylable {
|
|
116
117
|
url: string;
|
|
@@ -123,6 +124,7 @@ export interface LinkProps extends Stylable {
|
|
|
123
124
|
metrikaGoals?: MetrikaGoal;
|
|
124
125
|
pixelEvents?: ButtonPixel;
|
|
125
126
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
127
|
+
blockName?: string;
|
|
126
128
|
}
|
|
127
129
|
export interface FileLinkProps extends ClassNameProps {
|
|
128
130
|
href: string;
|
|
@@ -171,6 +173,7 @@ export interface MediaComponentVideoProps {
|
|
|
171
173
|
height?: number;
|
|
172
174
|
metrika?: MetrikaVideo;
|
|
173
175
|
analyticsEvents?: AnalyticsEvent[];
|
|
176
|
+
blockName?: string;
|
|
174
177
|
previewImg?: string;
|
|
175
178
|
}
|
|
176
179
|
export interface MediaComponentYoutubeProps {
|
|
@@ -227,6 +230,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
227
230
|
metrikaGoals?: MetrikaGoal;
|
|
228
231
|
pixelEvents?: ButtonPixel;
|
|
229
232
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
233
|
+
blockName?: string;
|
|
230
234
|
}
|
|
231
235
|
export interface PreviewContentItemProps {
|
|
232
236
|
title: string;
|
|
@@ -62,6 +62,7 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
64
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
65
|
+
blockName?: string;
|
|
65
66
|
}
|
|
66
67
|
export interface PartnerProps extends CardBaseProps {
|
|
67
68
|
text: string;
|
|
@@ -77,6 +78,7 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
77
78
|
author?: AuthorItem;
|
|
78
79
|
buttonText?: string;
|
|
79
80
|
theme?: TextTheme;
|
|
81
|
+
blockName?: string;
|
|
80
82
|
}
|
|
81
83
|
export interface NewsCardData {
|
|
82
84
|
id: number;
|
|
@@ -111,6 +113,7 @@ export interface BannerCardProps {
|
|
|
111
113
|
color?: ThemeSupporting<string>;
|
|
112
114
|
theme?: TextTheme;
|
|
113
115
|
button: Pick<ButtonProps, 'text' | 'url' | 'target'>;
|
|
116
|
+
blockName?: string;
|
|
114
117
|
}
|
|
115
118
|
export interface MediaCardProps extends MediaProps, CardBaseProps {
|
|
116
119
|
}
|
|
@@ -118,7 +121,7 @@ export interface CardWithImageLinkProps extends Omit<LinkProps, 'text' | 'url'>
|
|
|
118
121
|
title: string;
|
|
119
122
|
link: string;
|
|
120
123
|
}
|
|
121
|
-
export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockProps, 'title' | 'additionalInfo' | 'buttons' | 'theme'> {
|
|
124
|
+
export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockProps, 'title' | 'additionalInfo' | 'buttons' | 'theme' | 'blockName'> {
|
|
122
125
|
image: string;
|
|
123
126
|
description?: string;
|
|
124
127
|
disableCompress?: boolean;
|
|
@@ -9,6 +9,7 @@ import SocialIcon from '../SocialIcon/SocialIcon';
|
|
|
9
9
|
import { getMediaImage } from '../../../components/Media/Image/utils';
|
|
10
10
|
import './NavigationItem.css';
|
|
11
11
|
const b = block('navigation-item');
|
|
12
|
+
const BLOCK_NAME = 'navigation';
|
|
12
13
|
const Content = ({ text, icon }) => (React.createElement(Fragment, null,
|
|
13
14
|
icon && typeof icon !== 'string' && React.createElement(Image, Object.assign({ className: b('icon') }, icon)),
|
|
14
15
|
React.createElement("span", { className: b('text') }, text)));
|
|
@@ -37,8 +38,8 @@ const NavigationLink = (props) => {
|
|
|
37
38
|
};
|
|
38
39
|
const NavigationButton = (props) => {
|
|
39
40
|
const { url, target } = props;
|
|
40
|
-
return target ? (React.createElement(Button, Object.assign({}, props, { url: url }))) : (React.createElement(RouterLink, { href: url },
|
|
41
|
-
React.createElement(Button, Object.assign({}, props, { url: url }))));
|
|
41
|
+
return target ? (React.createElement(Button, Object.assign({}, props, { url: url, blockName: BLOCK_NAME }))) : (React.createElement(RouterLink, { href: url },
|
|
42
|
+
React.createElement(Button, Object.assign({}, props, { url: url, blockName: BLOCK_NAME }))));
|
|
42
43
|
};
|
|
43
44
|
//todo: add types support form component in map
|
|
44
45
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -386,6 +386,8 @@ export const BlockBaseProps = Object.assign(Object.assign({}, BaseProps), { anch
|
|
|
386
386
|
enum: containerSizesArray,
|
|
387
387
|
}, resetPaddings: {
|
|
388
388
|
type: 'boolean',
|
|
389
|
+
}, blockName: {
|
|
390
|
+
type: 'string',
|
|
389
391
|
} });
|
|
390
392
|
export const TitleProps = {
|
|
391
393
|
type: 'object',
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
3
|
import { CardBase, BackgroundImage } from '../../components/';
|
|
4
|
+
import { SubBlockType } from '../../models';
|
|
4
5
|
import Content from '../Content/Content';
|
|
5
6
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
6
7
|
import './BackgroundCard.css';
|
|
7
8
|
const b = block('background-card');
|
|
8
9
|
const BackgroundCard = (props) => {
|
|
9
|
-
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, } = props;
|
|
10
|
+
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, blockName = SubBlockType.BackgroundCard, } = props;
|
|
10
11
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
11
12
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
12
13
|
const link = hasBackgroundColor || border === 'line' ? undefined : url;
|
|
@@ -14,6 +15,6 @@ const BackgroundCard = (props) => {
|
|
|
14
15
|
return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: link, border: borderType },
|
|
15
16
|
React.createElement(CardBase.Content, null,
|
|
16
17
|
React.createElement(BackgroundImage, Object.assign({ className: b('image') }, getThemedValue(background, theme), { style: { backgroundColor } })),
|
|
17
|
-
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))));
|
|
18
|
+
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, blockName: blockName }))));
|
|
18
19
|
};
|
|
19
20
|
export default BackgroundCard;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
|
+
import { SubBlockType } from '../../models';
|
|
3
4
|
import { Button, YFMWrapper, BackgroundImage, HTML } from '../../components';
|
|
4
5
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
5
6
|
import './BannerCard.css';
|
|
6
7
|
const b = block('banner-card');
|
|
7
8
|
export const BannerCard = (props) => {
|
|
8
|
-
const { title, subtitle, button: { url, text, target }, color, theme: textTheme = 'light', image, disableCompress, } = props;
|
|
9
|
+
const { title, subtitle, button: { url, text, target }, color, theme: textTheme = 'light', image, disableCompress, blockName = SubBlockType.BannerCard, } = props;
|
|
9
10
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
10
11
|
const contentStyle = {};
|
|
11
12
|
if (color) {
|
|
@@ -18,7 +19,7 @@ export const BannerCard = (props) => {
|
|
|
18
19
|
React.createElement("h2", { className: b('title') },
|
|
19
20
|
React.createElement(HTML, null, title)),
|
|
20
21
|
subtitle && (React.createElement(YFMWrapper, { className: b('subtitle'), content: subtitle, modifiers: { constructor: true } }))),
|
|
21
|
-
React.createElement(Button, { className: b('button'), theme: "raised", size: "xl", text: text, url: url, target: target })),
|
|
22
|
+
React.createElement(Button, { className: b('button'), theme: "raised", size: "xl", text: text, url: url, target: target, blockName: blockName })),
|
|
22
23
|
React.createElement(BackgroundImage, { className: b('image'), src: getThemedValue(image, theme), disableCompress: disableCompress }))));
|
|
23
24
|
};
|
|
24
25
|
export default BannerCard;
|