@gravity-ui/page-constructor 1.15.0-alpha.2 → 1.15.0-alpha.21
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/README.md +110 -5
- package/build/cjs/blocks/Banner/schema.d.ts +27 -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/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/cjs/blocks/Header/schema.d.ts +159 -0
- package/build/cjs/blocks/Header/schema.js +4 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/cjs/blocks/Icons/schema.d.ts +6 -0
- 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/schema.d.ts +9 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/cjs/blocks/Preview/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/schema.js +3 -1
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- 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.js +12 -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 +3 -0
- package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
- package/build/cjs/components/BackLink/BackLink.js +12 -2
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +15 -2
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +11 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -11
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +12 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +28 -0
- package/build/cjs/components/Link/Link.js +11 -2
- package/build/cjs/components/Media/Video/Video.js +1 -1
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +21 -25
- package/build/cjs/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/cjs/components/YandexForm/YandexForm.js +11 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +5 -4
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +2 -1
- package/build/cjs/context/blockPositionContext/blockPositionContext.d.ts +3 -0
- package/build/cjs/context/blockPositionContext/blockPositionContext.js +6 -0
- package/build/cjs/context/blockPositionContext/index.d.ts +1 -0
- package/build/cjs/context/blockPositionContext/index.js +4 -0
- package/build/cjs/hooks/useAnalytics.d.ts +1 -1
- package/build/cjs/hooks/useAnalytics.js +13 -7
- package/build/cjs/models/common.d.ts +7 -4
- package/build/cjs/models/common.js +7 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +10 -0
- package/build/cjs/models/constructor-items/common.d.ts +9 -4
- 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 +15 -0
- package/build/cjs/schema/validators/common.js +2 -0
- package/build/cjs/schema/validators/event.d.ts +3 -0
- package/build/cjs/schema/validators/event.js +3 -0
- 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/HubspotForm/index.js +10 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +12 -1
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/schema.js +3 -1
- package/build/cjs/utils/blocks.d.ts +7 -0
- package/build/cjs/utils/blocks.js +5 -1
- package/build/esm/blocks/Banner/schema.d.ts +27 -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/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/esm/blocks/Header/schema.d.ts +159 -0
- package/build/esm/blocks/Header/schema.js +4 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/esm/blocks/Icons/schema.d.ts +6 -0
- 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/schema.d.ts +9 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/esm/blocks/Preview/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/schema.js +3 -1
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- 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.js +13 -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 +3 -0
- package/build/esm/components/BackLink/BackLink.d.ts +1 -0
- package/build/esm/components/BackLink/BackLink.js +12 -2
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +16 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +12 -3
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -11
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +13 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +25 -0
- package/build/esm/components/Link/Link.js +12 -3
- package/build/esm/components/Media/Video/Video.js +1 -1
- package/build/esm/components/ReactPlayer/ReactPlayer.js +22 -26
- package/build/esm/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/esm/components/YandexForm/YandexForm.js +12 -4
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +6 -5
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +2 -1
- package/build/esm/context/blockPositionContext/blockPositionContext.d.ts +3 -0
- package/build/esm/context/blockPositionContext/blockPositionContext.js +2 -0
- package/build/esm/context/blockPositionContext/index.d.ts +1 -0
- package/build/esm/context/blockPositionContext/index.js +1 -0
- package/build/esm/hooks/useAnalytics.d.ts +1 -1
- package/build/esm/hooks/useAnalytics.js +13 -7
- package/build/esm/models/common.d.ts +7 -4
- package/build/esm/models/common.js +6 -0
- package/build/esm/models/constructor-items/blocks.d.ts +10 -0
- package/build/esm/models/constructor-items/common.d.ts +9 -4
- 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 +15 -0
- package/build/esm/schema/validators/common.js +2 -0
- package/build/esm/schema/validators/event.d.ts +3 -0
- package/build/esm/schema/validators/event.js +3 -0
- 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/HubspotForm/index.js +10 -2
- package/build/esm/sub-blocks/Quote/Quote.js +14 -3
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/schema.js +3 -1
- package/build/esm/utils/blocks.d.ts +7 -0
- package/build/esm/utils/blocks.js +3 -0
- package/package.json +1 -1
- package/server/models/common.d.ts +7 -4
- package/server/models/common.js +7 -1
- package/server/models/constructor-items/blocks.d.ts +10 -0
- package/server/models/constructor-items/common.d.ts +9 -4
- package/server/models/constructor-items/sub-blocks.d.ts +4 -1
- package/server/utils/blocks.d.ts +7 -0
- package/server/utils/blocks.js +5 -1
|
@@ -4,8 +4,11 @@ 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 locationContext_1 = require("../../context/locationContext");
|
|
9
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
8
10
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
11
|
+
const hooks_1 = require("../../hooks");
|
|
9
12
|
const Facebook_1 = require("../../icons/Facebook");
|
|
10
13
|
const Twitter_1 = require("../../icons/Twitter");
|
|
11
14
|
const Linkedin_1 = require("../../icons/Linkedin");
|
|
@@ -21,13 +24,21 @@ const icons = {
|
|
|
21
24
|
const b = (0, utils_1.block)('share-block');
|
|
22
25
|
const Share = ({ items, title }) => {
|
|
23
26
|
const { pathname, hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
27
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
28
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
29
|
+
name: 'share-button-click',
|
|
30
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
31
|
+
context,
|
|
32
|
+
}), [context]);
|
|
33
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
34
|
+
const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
|
|
24
35
|
return (react_1.default.createElement("div", { className: b() },
|
|
25
36
|
react_1.default.createElement("h5", { className: b('title') }, title || (0, i18n_1.default)('constructor-share')),
|
|
26
37
|
react_1.default.createElement("div", { className: b('items') }, items.map((type) => {
|
|
27
38
|
const url = (0, utils_1.getAbsolutePath)(hostname, pathname);
|
|
28
39
|
const socialUrl = (0, utils_1.getShareLink)(url, type);
|
|
29
40
|
const icon = icons[type];
|
|
30
|
-
return (react_1.default.createElement(uikit_1.Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }) }, icon && react_1.default.createElement(uikit_1.Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
41
|
+
return (react_1.default.createElement(uikit_1.Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }), onClick: handleButtonClick }, icon && react_1.default.createElement(uikit_1.Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
31
42
|
}))));
|
|
32
43
|
};
|
|
33
44
|
exports.default = Share;
|
|
@@ -5,10 +5,20 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const icons_1 = require("../../icons");
|
|
7
7
|
const locationContext_1 = require("../../context/locationContext");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const models_1 = require("../../models");
|
|
10
|
+
const COMPONENT_NAME = 'backlink';
|
|
8
11
|
function BackLink(props) {
|
|
9
12
|
const { history } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
10
|
-
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, } = props;
|
|
13
|
+
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, context = COMPONENT_NAME, } = props;
|
|
14
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
15
|
+
name: 'back-link-click',
|
|
16
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
17
|
+
context: context,
|
|
18
|
+
target: url,
|
|
19
|
+
});
|
|
11
20
|
const backActionHandler = (0, react_1.useCallback)(async () => {
|
|
21
|
+
handleAnalytics();
|
|
12
22
|
if (!history) {
|
|
13
23
|
return;
|
|
14
24
|
}
|
|
@@ -21,7 +31,7 @@ function BackLink(props) {
|
|
|
21
31
|
else {
|
|
22
32
|
history.push({ pathname: url });
|
|
23
33
|
}
|
|
24
|
-
}, [history, onClick, url]);
|
|
34
|
+
}, [handleAnalytics, history, onClick, url]);
|
|
25
35
|
return (react_1.default.createElement(uikit_1.Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
|
|
26
36
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.ArrowSidebar, size: 24 }),
|
|
27
37
|
react_1.default.createElement("span", null, title)));
|
|
@@ -4,21 +4,34 @@ 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 utils_2 = require("./utils");
|
|
8
9
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
9
10
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
11
|
const hooks_1 = require("../../hooks");
|
|
11
12
|
const icons_1 = require("../../icons");
|
|
13
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
14
|
+
const COMPONENT_NAME = 'button';
|
|
12
15
|
const b = (0, utils_1.block)('button-block');
|
|
13
16
|
const Button = (props) => {
|
|
14
17
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
15
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
16
18
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
17
19
|
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
20
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
18
21
|
const defaultImgPosition = 'left';
|
|
22
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
23
|
+
name: 'button-click',
|
|
24
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
25
|
+
context: context || COMPONENT_NAME,
|
|
26
|
+
target: url,
|
|
27
|
+
}), [context, url]);
|
|
28
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
29
|
+
const blockPosition = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.log({ blockPosition }, props);
|
|
19
32
|
const onClick = (0, react_1.useCallback)(() => {
|
|
20
33
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
21
|
-
handleAnalytics
|
|
34
|
+
handleAnalytics(analyticsEvents);
|
|
22
35
|
if (onClickOrigin) {
|
|
23
36
|
onClickOrigin();
|
|
24
37
|
}
|
|
@@ -11,6 +11,7 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
11
11
|
metrikaGoals?: MetrikaGoal;
|
|
12
12
|
pixelEvents?: ButtonPixel;
|
|
13
13
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
14
|
+
context?: string;
|
|
14
15
|
}
|
|
15
16
|
export interface CardHeaderBaseProps {
|
|
16
17
|
className?: string;
|
|
@@ -4,9 +4,11 @@ exports.Layout = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
7
8
|
const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
|
|
8
9
|
const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
|
|
9
10
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
11
|
+
const common_1 = require("../../models/common");
|
|
10
12
|
const hooks_1 = require("../../hooks");
|
|
11
13
|
const b = (0, utils_1.block)('card-base-block');
|
|
12
14
|
const Header = () => null;
|
|
@@ -15,7 +17,14 @@ const Footer = () => null;
|
|
|
15
17
|
const Layout = (props) => {
|
|
16
18
|
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
17
19
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
18
|
-
const
|
|
20
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
21
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
22
|
+
name: 'card-base-click',
|
|
23
|
+
type: common_1.PredefinedEventTypes.Default,
|
|
24
|
+
context,
|
|
25
|
+
target: url,
|
|
26
|
+
}), [context, url]);
|
|
27
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
19
28
|
let header, content, footer, image, headerClass, footerClass;
|
|
20
29
|
function handleChild(child) {
|
|
21
30
|
switch (child.type) {
|
|
@@ -48,7 +57,7 @@ const Layout = (props) => {
|
|
|
48
57
|
const fullClassName = b({ border }, className);
|
|
49
58
|
const onClick = () => {
|
|
50
59
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
51
|
-
handleAnalytics
|
|
60
|
+
handleAnalytics(analyticsEvents);
|
|
52
61
|
};
|
|
53
62
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
54
63
|
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
@charset "UTF-8";
|
|
2
|
-
/* use this for style redefinitions to awoid problems with
|
|
3
|
-
unpredictable css rules order in build */
|
|
4
1
|
.pc-header-breadcrumbs {
|
|
5
2
|
z-index: 11;
|
|
6
3
|
}
|
|
7
|
-
.pc-header-breadcrumbs__item {
|
|
8
|
-
display: inline-block;
|
|
9
|
-
}
|
|
10
|
-
.pc-header-breadcrumbs__text {
|
|
11
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
12
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
13
|
-
outline: none;
|
|
14
|
-
color: var(--yc-color-text-link);
|
|
15
|
-
text-decoration: none;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
color: var(--yc-color-text-secondary);
|
|
18
|
-
}
|
|
19
|
-
.utilityfocus .pc-header-breadcrumbs__text:focus {
|
|
20
|
-
outline: 2px solid #ffdb4d;
|
|
21
|
-
}
|
|
22
|
-
.pc-header-breadcrumbs__text:hover, .pc-header-breadcrumbs__text:active {
|
|
23
|
-
--pc-text-header-color: var(--yc-color-text-link-hover);
|
|
24
|
-
color: var(--yc-color-text-link-hover);
|
|
25
|
-
}
|
|
26
|
-
.pc-header-breadcrumbs__text:after {
|
|
27
|
-
content: " / ";
|
|
28
|
-
margin: 0 8px 0 6px;
|
|
29
|
-
color: var(--yc-color-text-secondary);
|
|
30
|
-
}
|
|
31
|
-
.pc-header-breadcrumbs__text:hover {
|
|
32
|
-
color: var(--yc-color-text-primary);
|
|
33
|
-
}
|
|
34
4
|
.pc-header-breadcrumbs_theme_dark .pc-header-breadcrumbs__text {
|
|
35
5
|
color: var(--yc-color-text-light-secondary);
|
|
36
6
|
}
|
|
@@ -3,18 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const
|
|
7
|
-
const hooks_1 = require("../../hooks");
|
|
6
|
+
const HeaderBreadcrumbsItem_1 = tslib_1.__importDefault(require("./HeaderBreadcrumbsItem"));
|
|
8
7
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
9
8
|
function HeaderBreadcrumbs(props) {
|
|
10
|
-
const { items, metrikaGoals, pixelEvents,
|
|
11
|
-
|
|
12
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
13
|
-
const onClick = () => {
|
|
14
|
-
handleMetrika({ metrikaGoals, pixelEvents });
|
|
15
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
16
|
-
};
|
|
17
|
-
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement("div", { className: b('item'), key: item.url },
|
|
18
|
-
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
9
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
|
|
10
|
+
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement(HeaderBreadcrumbsItem_1.default, { key: item.url, url: item.url, text: item.text, metrikaGoals: metrikaGoals, pixelEvents: pixelEvents, analyticsEvents: item.analyticsEvents })))));
|
|
19
11
|
}
|
|
20
12
|
exports.default = HeaderBreadcrumbs;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* use this for style redefinitions to awoid problems with
|
|
3
|
+
unpredictable css rules order in build */
|
|
4
|
+
.pc-header-breadcrumbs-item__item {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
.pc-header-breadcrumbs-item__text {
|
|
8
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
9
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
10
|
+
outline: none;
|
|
11
|
+
color: var(--yc-color-text-link);
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
color: var(--yc-color-text-secondary);
|
|
15
|
+
}
|
|
16
|
+
.utilityfocus .pc-header-breadcrumbs-item__text:focus {
|
|
17
|
+
outline: 2px solid #ffdb4d;
|
|
18
|
+
}
|
|
19
|
+
.pc-header-breadcrumbs-item__text:hover, .pc-header-breadcrumbs-item__text:active {
|
|
20
|
+
--pc-text-header-color: var(--yc-color-text-link-hover);
|
|
21
|
+
color: var(--yc-color-text-link-hover);
|
|
22
|
+
}
|
|
23
|
+
.pc-header-breadcrumbs-item__text:after {
|
|
24
|
+
content: " / ";
|
|
25
|
+
margin: 0 8px 0 6px;
|
|
26
|
+
color: var(--yc-color-text-secondary);
|
|
27
|
+
}
|
|
28
|
+
.pc-header-breadcrumbs-item__text:hover {
|
|
29
|
+
color: var(--yc-color-text-primary);
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsEvent, ButtonPixel, MetrikaGoal } from '../../models';
|
|
3
|
+
type HeaderBreadcrumbsItemProps = {
|
|
4
|
+
url: string;
|
|
5
|
+
text: ReactNode;
|
|
6
|
+
metrikaGoals?: MetrikaGoal;
|
|
7
|
+
pixelEvents?: ButtonPixel;
|
|
8
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
9
|
+
context?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function HeaderBreadcrumbsItem({ url, text, metrikaGoals, pixelEvents, analyticsEvents, }: HeaderBreadcrumbsItemProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
10
|
+
const b = (0, utils_1.block)('header-breadcrumbs-item');
|
|
11
|
+
function HeaderBreadcrumbsItem({ url, text, metrikaGoals, pixelEvents, analyticsEvents, }) {
|
|
12
|
+
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
13
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
14
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
15
|
+
name: 'header-breadcrumbs-click',
|
|
16
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
17
|
+
context: context,
|
|
18
|
+
target: url,
|
|
19
|
+
}), [context, url]);
|
|
20
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
23
|
+
handleAnalytics(analyticsEvents);
|
|
24
|
+
};
|
|
25
|
+
return (react_1.default.createElement("div", { className: b('item'), key: url },
|
|
26
|
+
react_1.default.createElement("a", { href: url, className: b('text'), onClick: onClick }, text)));
|
|
27
|
+
}
|
|
28
|
+
exports.default = HeaderBreadcrumbsItem;
|
|
@@ -4,6 +4,7 @@ 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"));
|
|
@@ -11,6 +12,7 @@ const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
|
11
12
|
const locationContext_1 = require("../../context/locationContext/locationContext");
|
|
12
13
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
13
14
|
const hooks_1 = require("../../hooks");
|
|
15
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
14
16
|
const b = (0, utils_1.block)('link-block');
|
|
15
17
|
const WORD_JOINER_SYM = '\u200b';
|
|
16
18
|
function getArrowSize(size) {
|
|
@@ -28,14 +30,21 @@ function getArrowSize(size) {
|
|
|
28
30
|
const LinkBlock = (props) => {
|
|
29
31
|
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
30
32
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
31
|
-
const
|
|
33
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
34
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
35
|
+
name: 'link-click',
|
|
36
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
37
|
+
context,
|
|
38
|
+
target: url,
|
|
39
|
+
}), [context, url]);
|
|
40
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
32
41
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
33
42
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
34
43
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
35
44
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
36
45
|
const onClick = () => {
|
|
37
46
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
38
|
-
handleAnalytics
|
|
47
|
+
handleAnalytics(analyticsEvents);
|
|
39
48
|
};
|
|
40
49
|
const getLinkByType = () => {
|
|
41
50
|
switch (theme) {
|
|
@@ -34,6 +34,7 @@ const Video = (props) => {
|
|
|
34
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
|
+
height,
|
|
37
38
|
videoClassName,
|
|
38
39
|
previewImg,
|
|
39
40
|
playVideo,
|
|
@@ -41,7 +42,6 @@ const Video = (props) => {
|
|
|
41
42
|
customBarControlsClassName,
|
|
42
43
|
metrika,
|
|
43
44
|
analyticsEvents,
|
|
44
|
-
height,
|
|
45
45
|
]);
|
|
46
46
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
47
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 blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
15
16
|
const icons_1 = require("../../icons");
|
|
16
17
|
const hooks_1 = require("../../hooks");
|
|
17
18
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
@@ -35,7 +36,19 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
35
36
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
36
37
|
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
37
38
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
38
|
-
const
|
|
39
|
+
const eventsArray = (0, react_1.useMemo)(() => {
|
|
40
|
+
if (analyticsEvents) {
|
|
41
|
+
return Array.isArray(analyticsEvents) ? analyticsEvents : [analyticsEvents];
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}, [analyticsEvents]);
|
|
45
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
46
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
47
|
+
name: 'react-player-controls-click',
|
|
48
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
49
|
+
context: context,
|
|
50
|
+
}), [context]);
|
|
51
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
39
52
|
(0, react_1.useImperativeHandle)(originRef, () => ({
|
|
40
53
|
pause: () => setIsPlaying(false),
|
|
41
54
|
}));
|
|
@@ -84,8 +97,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
84
97
|
window.removeEventListener('resize', updateSize);
|
|
85
98
|
};
|
|
86
99
|
}, []);
|
|
87
|
-
const playEvents = (0, react_1.useMemo)(() =>
|
|
88
|
-
const stopEvents = (0, react_1.useMemo)(() =>
|
|
100
|
+
const playEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Play), [eventsArray]);
|
|
101
|
+
const stopEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Stop), [eventsArray]);
|
|
89
102
|
const playIcon = (0, react_1.useMemo)(() => {
|
|
90
103
|
let playButtonContent;
|
|
91
104
|
switch (type) {
|
|
@@ -111,27 +124,14 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
111
124
|
metrika.reachGoals(goal, counterName);
|
|
112
125
|
}
|
|
113
126
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (events) {
|
|
117
|
-
handleAnalytics(events);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
127
|
+
const events = isMuted ? playEvents : stopEvents;
|
|
128
|
+
handleAnalytics(events);
|
|
120
129
|
if (isMuted) {
|
|
121
130
|
setProps({ playingVideoRef: ref.current });
|
|
122
131
|
}
|
|
123
132
|
// In order to the progress bar to update (equals 0) before displaying
|
|
124
133
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
125
|
-
}, [
|
|
126
|
-
playerRef,
|
|
127
|
-
metrika,
|
|
128
|
-
videoMetrika,
|
|
129
|
-
handleAnalytics,
|
|
130
|
-
analyticsEvents,
|
|
131
|
-
playEvents,
|
|
132
|
-
stopEvents,
|
|
133
|
-
setProps,
|
|
134
|
-
]);
|
|
134
|
+
}, [playerRef, metrika, videoMetrika, handleAnalytics, playEvents, stopEvents, setProps]);
|
|
135
135
|
const handleClick = (0, react_1.useCallback)(() => changeMute(muted), [changeMute, muted]);
|
|
136
136
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
137
137
|
setIsPlaying(true);
|
|
@@ -142,12 +142,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
142
142
|
metrika.reachGoals(play, counterName);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
handleAnalytics(playEvents);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, analyticsEvents, playEvents]);
|
|
145
|
+
handleAnalytics(playEvents);
|
|
146
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
151
147
|
const onPause = (0, react_1.useCallback)(() => {
|
|
152
148
|
// For support correct state for youtube
|
|
153
149
|
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
|
+
context?: string;
|
|
19
20
|
}
|
|
20
21
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
21
22
|
export default YandexForm;
|
|
@@ -8,7 +8,9 @@ const localeContext_1 = require("../../context/localeContext");
|
|
|
8
8
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
11
|
-
const
|
|
11
|
+
const common_1 = require("../../models/common");
|
|
12
|
+
const hooks_1 = require("../../hooks");
|
|
13
|
+
const blockPositionContext_1 = require("../../context/blockPositionContext");
|
|
12
14
|
exports.YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
13
15
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
14
16
|
const b = (0, utils_1.block)('yandex-form');
|
|
@@ -18,7 +20,13 @@ const YandexForm = (props) => {
|
|
|
18
20
|
const iframeRef = (0, react_1.useRef)();
|
|
19
21
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
20
22
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
21
|
-
const
|
|
23
|
+
const context = (0, react_1.useContext)(blockPositionContext_1.BlockPositionContext);
|
|
24
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
25
|
+
name: 'yndex-form-submit',
|
|
26
|
+
type: common_1.PredefinedEventTypes.Default,
|
|
27
|
+
context: context,
|
|
28
|
+
}), [context]);
|
|
29
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
22
30
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
23
31
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
24
32
|
const updateFormIframe = (0, react_1.useCallback)((container) => {
|
|
@@ -59,7 +67,7 @@ const YandexForm = (props) => {
|
|
|
59
67
|
window.scrollBy(0, top - headerHeight);
|
|
60
68
|
}
|
|
61
69
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
62
|
-
handleAnalytics
|
|
70
|
+
handleAnalytics(analyticsEvents);
|
|
63
71
|
if (onSubmit) {
|
|
64
72
|
onSubmit();
|
|
65
73
|
}
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -11,13 +11,14 @@ const ConstructorItem_1 = require("../ConstructorItem");
|
|
|
11
11
|
const ConstructorBlock_1 = require("../ConstructorBlock/ConstructorBlock");
|
|
12
12
|
const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
13
13
|
const { blockTypes, loadables, itemMap } = (0, react_1.useContext)(innerContext_1.InnerContext);
|
|
14
|
-
const renderer = (item, index) => {
|
|
14
|
+
const renderer = (parentContext = '', item, index) => {
|
|
15
15
|
if (!itemMap[item.type]) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
let children;
|
|
19
19
|
let itemElement;
|
|
20
20
|
const key = (0, utils_1.getBlockKey)(item, index);
|
|
21
|
+
const context = (0, utils_1.getBlockContext)({ parentContext, block: item, index });
|
|
21
22
|
if (shouldRenderBlock && !shouldRenderBlock(item, key)) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -31,12 +32,12 @@ const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
if ('children' in item && item.children) {
|
|
34
|
-
children = item.children.map(renderer);
|
|
35
|
+
children = item.children.map(renderer.bind(null, context));
|
|
35
36
|
}
|
|
36
|
-
itemElement = (react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: item, key: key }, children));
|
|
37
|
+
itemElement = (react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: item, key: key, context: context }, children));
|
|
37
38
|
}
|
|
38
39
|
return blockTypes.includes(item.type) ? (react_1.default.createElement(ConstructorBlock_1.ConstructorBlock, { data: item, key: key, Component: itemElement })) : (itemElement);
|
|
39
40
|
};
|
|
40
|
-
return react_1.default.createElement(react_1.Fragment, null, items.map(renderer));
|
|
41
|
+
return react_1.default.createElement(react_1.Fragment, null, items.map(renderer.bind(null, '')));
|
|
41
42
|
};
|
|
42
43
|
exports.ConstructorBlocks = ConstructorBlocks;
|
package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConstructorItem as ConstructorItemType, WithChildren } from '../../../../models';
|
|
2
2
|
export interface ConstructorItemProps {
|
|
3
3
|
data: ConstructorItemType;
|
|
4
|
+
context?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const ConstructorItem: ({ data, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
|
|
6
|
+
export declare const ConstructorItem: ({ data, children, context }: WithChildren<ConstructorItemProps>) => JSX.Element;
|
|
6
7
|
export declare const ConstructorHeader: ({ data }: Pick<ConstructorItemProps, 'data'>) => JSX.Element;
|