@gravity-ui/page-constructor 1.13.0-alpha.0 → 1.14.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/build/cjs/blocks/Banner/schema.d.ts +279 -99
- package/build/cjs/blocks/Media/schema.d.ts +93 -33
- package/build/cjs/blocks/Slider/Slider.d.ts +1 -6
- package/build/cjs/components/Author/Author.js +2 -2
- package/build/cjs/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/cjs/components/Author/__tests__/Author.test.js +49 -0
- package/build/cjs/components/Button/Button.js +6 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +3 -2
- package/build/cjs/components/CardBase/CardBase.js +5 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +5 -2
- package/build/cjs/components/Link/Link.js +5 -2
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/cjs/components/YandexForm/YandexForm.js +13 -2
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
- package/build/cjs/context/analyticsContext/index.d.ts +1 -0
- package/build/cjs/context/analyticsContext/index.js +4 -0
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +7 -2
- package/build/cjs/grid/Grid/Grid.css +16 -16
- package/build/cjs/hooks/useAnalytics.d.ts +2 -0
- package/build/cjs/hooks/useAnalytics.js +15 -0
- package/build/cjs/hooks/useMetrika.d.ts +8 -3
- package/build/cjs/hooks/useMetrika.js +10 -10
- package/build/cjs/models/common.d.ts +31 -4
- package/build/cjs/models/common.js +3 -0
- package/build/cjs/models/constructor-items/common.d.ts +5 -22
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/cjs/schema/validators/common.d.ts +198 -66
- package/build/cjs/schema/validators/common.js +10 -2
- package/build/cjs/schema/validators/event.d.ts +50 -0
- package/build/cjs/schema/validators/event.js +53 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +14 -2
- package/build/esm/blocks/Banner/schema.d.ts +279 -99
- package/build/esm/blocks/Media/schema.d.ts +93 -33
- package/build/esm/blocks/Slider/Slider.d.ts +1 -6
- package/build/esm/components/Author/Author.js +2 -2
- package/build/esm/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/esm/components/Author/__tests__/Author.test.js +46 -0
- package/build/esm/components/Button/Button.js +6 -3
- package/build/esm/components/CardBase/CardBase.d.ts +3 -2
- package/build/esm/components/CardBase/CardBase.js +5 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +5 -2
- package/build/esm/components/Link/Link.js +5 -2
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/esm/components/YandexForm/YandexForm.js +13 -2
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
- package/build/esm/context/analyticsContext/index.d.ts +1 -0
- package/build/esm/context/analyticsContext/index.js +1 -0
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +7 -2
- package/build/esm/grid/Grid/Grid.css +16 -16
- package/build/esm/hooks/useAnalytics.d.ts +2 -0
- package/build/esm/hooks/useAnalytics.js +11 -0
- package/build/esm/hooks/useMetrika.d.ts +8 -3
- package/build/esm/hooks/useMetrika.js +10 -10
- package/build/esm/models/common.d.ts +31 -4
- package/build/esm/models/common.js +3 -0
- package/build/esm/models/constructor-items/common.d.ts +5 -22
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/esm/schema/validators/common.d.ts +198 -66
- package/build/esm/schema/validators/common.js +10 -2
- package/build/esm/schema/validators/event.d.ts +50 -0
- package/build/esm/schema/validators/event.js +50 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +14 -2
- package/package.json +2 -3
- package/server/models/common.d.ts +31 -4
- package/server/models/common.js +3 -0
- package/server/models/constructor-items/common.d.ts +5 -22
- package/server/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/cjs/schema/validators/ga-events.d.ts +0 -47
- package/build/cjs/schema/validators/ga-events.js +0 -50
- package/build/esm/schema/validators/ga-events.d.ts +0 -47
- package/build/esm/schema/validators/ga-events.js +0 -47
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const react_2 = require("@testing-library/react");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
const Author_1 = tslib_1.__importDefault(require("../Author"));
|
|
8
|
+
const testId = 'author';
|
|
9
|
+
const author = {
|
|
10
|
+
firstName: 'John',
|
|
11
|
+
secondName: 'Doe',
|
|
12
|
+
description: 'Web designer',
|
|
13
|
+
avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
|
|
14
|
+
};
|
|
15
|
+
describe('Author', () => {
|
|
16
|
+
test('Render author by default', async () => {
|
|
17
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
18
|
+
const object = react_2.screen.getByTestId(testId);
|
|
19
|
+
expect(object).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
test('Has full name', async () => {
|
|
22
|
+
const name = `${author.firstName} ${author.secondName}`;
|
|
23
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
24
|
+
const object = react_2.screen.getByText(name);
|
|
25
|
+
expect(object).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
test('Has first name only', async () => {
|
|
28
|
+
const name = author.firstName;
|
|
29
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
|
|
30
|
+
const object = react_2.screen.getByText(name);
|
|
31
|
+
expect(object).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
test('Has avatar', async () => {
|
|
34
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
35
|
+
const avatar = react_2.screen.getByRole('img');
|
|
36
|
+
expect(avatar).toBeInTheDocument();
|
|
37
|
+
expect(avatar).toHaveAttribute('src', author.avatar);
|
|
38
|
+
});
|
|
39
|
+
test('Has description', async () => {
|
|
40
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
41
|
+
const object = react_2.screen.getByText(author.description);
|
|
42
|
+
expect(object).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
test.each(new Array(models_1.AuthorType.Column, models_1.AuthorType.Line))('Render with given "%s" type', (type) => {
|
|
45
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId, type: type }));
|
|
46
|
+
const object = react_2.screen.getByTestId(testId);
|
|
47
|
+
expect(object).toHaveClass(`pc-author_type_${type}`);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -7,19 +7,22 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const utils_2 = require("./utils");
|
|
8
8
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
|
+
const useAnalytics_1 = require("../../hooks/useAnalytics");
|
|
10
11
|
const icons_1 = require("../../icons");
|
|
11
12
|
const b = (0, utils_1.block)('button-block');
|
|
12
13
|
const Button = (props) => {
|
|
13
14
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
15
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
14
16
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
15
|
-
const { className, metrikaGoals, pixelEvents,
|
|
17
|
+
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"]);
|
|
16
18
|
const defaultImgPosition = 'left';
|
|
17
19
|
const onClick = (0, react_1.useCallback)(() => {
|
|
18
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
20
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
21
|
+
handleAnalytics(analyticsEvents);
|
|
19
22
|
if (onClickOrigin) {
|
|
20
23
|
onClickOrigin();
|
|
21
24
|
}
|
|
22
|
-
}, [handleMetrika, metrikaGoals, pixelEvents,
|
|
25
|
+
}, [handleMetrika, metrikaGoals, pixelEvents, handleAnalytics, analyticsEvents, onClickOrigin]);
|
|
23
26
|
const buttonImg = img instanceof Object
|
|
24
27
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
25
28
|
: { url: img, position: defaultImgPosition };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
|
|
2
|
-
import { ButtonPixel, CardBaseProps as CardBaseParams,
|
|
2
|
+
import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
|
|
3
|
+
import { AnalyticsEvent } from '../../models/common';
|
|
3
4
|
export interface CardBaseProps extends CardBaseParams {
|
|
4
5
|
className?: string;
|
|
5
6
|
bodyClassName?: string;
|
|
@@ -9,7 +10,7 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
9
10
|
target?: HTMLAttributeAnchorTarget;
|
|
10
11
|
metrikaGoals?: MetrikaGoal;
|
|
11
12
|
pixelEvents?: ButtonPixel;
|
|
12
|
-
|
|
13
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
13
14
|
}
|
|
14
15
|
export interface CardHeaderBaseProps {
|
|
15
16
|
className?: string;
|
|
@@ -7,13 +7,15 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
|
|
8
8
|
const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
|
+
const useAnalytics_1 = require("../../hooks/useAnalytics");
|
|
10
11
|
const b = (0, utils_1.block)('card-base-block');
|
|
11
12
|
const Header = () => null;
|
|
12
13
|
const Content = () => null;
|
|
13
14
|
const Footer = () => null;
|
|
14
15
|
const Layout = (props) => {
|
|
15
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents,
|
|
16
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
16
17
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
18
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
17
19
|
let header, content, footer, image, headerClass, footerClass;
|
|
18
20
|
function handleChild(child) {
|
|
19
21
|
switch (child.type) {
|
|
@@ -45,7 +47,8 @@ const Layout = (props) => {
|
|
|
45
47
|
footer && react_1.default.createElement("div", { className: b('footer', footerClass) }, footer))));
|
|
46
48
|
const fullClassName = b({ border }, className);
|
|
47
49
|
const onClick = () => {
|
|
48
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
50
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
51
|
+
handleAnalytics(analyticsEvents);
|
|
49
52
|
};
|
|
50
53
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
51
54
|
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));
|
|
@@ -4,12 +4,15 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
7
|
+
const useAnalytics_1 = require("../../hooks/useAnalytics");
|
|
7
8
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
8
9
|
function HeaderBreadcrumbs(props) {
|
|
9
|
-
const { items, metrikaGoals, pixelEvents,
|
|
10
|
+
const { items, metrikaGoals, pixelEvents, analyticsEvents, theme = 'light', className } = props;
|
|
10
11
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
12
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
11
13
|
const onClick = () => {
|
|
12
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
14
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
15
|
+
handleAnalytics(analyticsEvents);
|
|
13
16
|
};
|
|
14
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 },
|
|
15
18
|
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -10,6 +10,7 @@ const BackLink_1 = tslib_1.__importDefault(require("../BackLink/BackLink"));
|
|
|
10
10
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
11
11
|
const locationContext_1 = require("../../context/locationContext/locationContext");
|
|
12
12
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
13
|
+
const useAnalytics_1 = require("../../hooks/useAnalytics");
|
|
13
14
|
const b = (0, utils_1.block)('link-block');
|
|
14
15
|
const WORD_JOINER_SYM = '\u200b';
|
|
15
16
|
function getArrowSize(size) {
|
|
@@ -25,14 +26,16 @@ function getArrowSize(size) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const LinkBlock = (props) => {
|
|
28
|
-
const { text, url, arrow, metrikaGoals, pixelEvents,
|
|
29
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
29
30
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
31
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
30
32
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
31
33
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
32
34
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
33
35
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
34
36
|
const onClick = () => {
|
|
35
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
37
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
38
|
+
handleAnalytics(analyticsEvents);
|
|
36
39
|
};
|
|
37
40
|
const getLinkByType = () => {
|
|
38
41
|
switch (theme) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
+
import { AnalyticsEvent } from '../../models/common';
|
|
2
3
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
3
4
|
export interface YandexFormProps {
|
|
4
5
|
id: number | string;
|
|
@@ -14,6 +15,7 @@ export interface YandexFormProps {
|
|
|
14
15
|
onLoad?: () => void;
|
|
15
16
|
metrikaGoals?: string | string[];
|
|
16
17
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
17
19
|
}
|
|
18
20
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
19
21
|
export default YandexForm;
|
|
@@ -8,15 +8,17 @@ 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 useAnalytics_1 = require("../..//hooks/useAnalytics");
|
|
11
12
|
exports.YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
12
13
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
13
14
|
const b = (0, utils_1.block)('yandex-form');
|
|
14
15
|
const YandexForm = (props) => {
|
|
15
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, customFormOrigin, } = props;
|
|
16
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = constants_1.HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, analyticsEvents, customFormOrigin, } = props;
|
|
16
17
|
const formContainerRef = (0, react_1.useRef)(null);
|
|
17
18
|
const iframeRef = (0, react_1.useRef)();
|
|
18
19
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
19
20
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
21
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
20
22
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
21
23
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
22
24
|
const updateFormIframe = (0, react_1.useCallback)((container) => {
|
|
@@ -57,10 +59,19 @@ const YandexForm = (props) => {
|
|
|
57
59
|
window.scrollBy(0, top - headerHeight);
|
|
58
60
|
}
|
|
59
61
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
62
|
+
handleAnalytics(analyticsEvents);
|
|
60
63
|
if (onSubmit) {
|
|
61
64
|
onSubmit();
|
|
62
65
|
}
|
|
63
|
-
}, [
|
|
66
|
+
}, [
|
|
67
|
+
handleMetrika,
|
|
68
|
+
metrikaGoals,
|
|
69
|
+
pixelEvents,
|
|
70
|
+
handleAnalytics,
|
|
71
|
+
analyticsEvents,
|
|
72
|
+
onSubmit,
|
|
73
|
+
headerHeight,
|
|
74
|
+
]);
|
|
64
75
|
const handleMessage = (0, react_1.useCallback)(({ origin, data }) => {
|
|
65
76
|
if (origin !== yaFormOrigin) {
|
|
66
77
|
return;
|
|
@@ -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';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
-
gaInline?: GaInline;
|
|
7
12
|
}
|
|
8
13
|
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -21,64 +21,64 @@
|
|
|
21
21
|
}
|
|
22
22
|
@media only screen and (max-width: 577px) {
|
|
23
23
|
.pc-Grid .container,
|
|
24
|
-
.pc-Grid .container-fluid {
|
|
24
|
+
.pc-Grid .container-fluid {
|
|
25
25
|
padding: 0 16px;
|
|
26
26
|
}
|
|
27
27
|
.pc-Grid .col,
|
|
28
|
-
.pc-Grid .col-sm-auto,
|
|
29
|
-
.pc-Grid .col-auto {
|
|
28
|
+
.pc-Grid .col-sm-auto,
|
|
29
|
+
.pc-Grid .col-auto {
|
|
30
30
|
padding: 0 8px;
|
|
31
31
|
}
|
|
32
32
|
.pc-Grid .col-sm-0,
|
|
33
|
-
.pc-Grid .col-0 {
|
|
33
|
+
.pc-Grid .col-0 {
|
|
34
34
|
padding: 0 8px;
|
|
35
35
|
}
|
|
36
36
|
.pc-Grid .col-sm-1,
|
|
37
|
-
.pc-Grid .col-1 {
|
|
37
|
+
.pc-Grid .col-1 {
|
|
38
38
|
padding: 0 8px;
|
|
39
39
|
}
|
|
40
40
|
.pc-Grid .col-sm-2,
|
|
41
|
-
.pc-Grid .col-2 {
|
|
41
|
+
.pc-Grid .col-2 {
|
|
42
42
|
padding: 0 8px;
|
|
43
43
|
}
|
|
44
44
|
.pc-Grid .col-sm-3,
|
|
45
|
-
.pc-Grid .col-3 {
|
|
45
|
+
.pc-Grid .col-3 {
|
|
46
46
|
padding: 0 8px;
|
|
47
47
|
}
|
|
48
48
|
.pc-Grid .col-sm-4,
|
|
49
|
-
.pc-Grid .col-4 {
|
|
49
|
+
.pc-Grid .col-4 {
|
|
50
50
|
padding: 0 8px;
|
|
51
51
|
}
|
|
52
52
|
.pc-Grid .col-sm-5,
|
|
53
|
-
.pc-Grid .col-5 {
|
|
53
|
+
.pc-Grid .col-5 {
|
|
54
54
|
padding: 0 8px;
|
|
55
55
|
}
|
|
56
56
|
.pc-Grid .col-sm-6,
|
|
57
|
-
.pc-Grid .col-6 {
|
|
57
|
+
.pc-Grid .col-6 {
|
|
58
58
|
padding: 0 8px;
|
|
59
59
|
}
|
|
60
60
|
.pc-Grid .col-sm-7,
|
|
61
|
-
.pc-Grid .col-7 {
|
|
61
|
+
.pc-Grid .col-7 {
|
|
62
62
|
padding: 0 8px;
|
|
63
63
|
}
|
|
64
64
|
.pc-Grid .col-sm-8,
|
|
65
|
-
.pc-Grid .col-8 {
|
|
65
|
+
.pc-Grid .col-8 {
|
|
66
66
|
padding: 0 8px;
|
|
67
67
|
}
|
|
68
68
|
.pc-Grid .col-sm-9,
|
|
69
|
-
.pc-Grid .col-9 {
|
|
69
|
+
.pc-Grid .col-9 {
|
|
70
70
|
padding: 0 8px;
|
|
71
71
|
}
|
|
72
72
|
.pc-Grid .col-sm-10,
|
|
73
|
-
.pc-Grid .col-10 {
|
|
73
|
+
.pc-Grid .col-10 {
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
}
|
|
76
76
|
.pc-Grid .col-sm-11,
|
|
77
|
-
.pc-Grid .col-11 {
|
|
77
|
+
.pc-Grid .col-11 {
|
|
78
78
|
padding: 0 8px;
|
|
79
79
|
}
|
|
80
80
|
.pc-Grid .col-sm-12,
|
|
81
|
-
.pc-Grid .col-12 {
|
|
81
|
+
.pc-Grid .col-12 {
|
|
82
82
|
padding: 0 8px;
|
|
83
83
|
}
|
|
84
84
|
.pc-Grid .row .row {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnalytics = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const analyticsContext_1 = require("../context/analyticsContext");
|
|
6
|
+
const useAnalytics = () => {
|
|
7
|
+
const { sendEvents } = (0, react_1.useContext)(analyticsContext_1.AnalyticsContext);
|
|
8
|
+
return (e) => {
|
|
9
|
+
if (!e) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
sendEvents === null || sendEvents === void 0 ? void 0 : sendEvents(e);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.useAnalytics = useAnalytics;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { ButtonPixel, MetrikaGoal, PixelEvent
|
|
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
|
-
gaEvents?: GAEvents;
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated useMetrika will be deleted
|
|
11
|
+
*/
|
|
12
|
+
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
8
13
|
export {};
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMetrika = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
7
6
|
const models_1 = require("../models");
|
|
8
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
|
+
*/
|
|
9
12
|
function isButtonPixel(pixelEvents) {
|
|
10
13
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
11
14
|
return true;
|
|
12
15
|
}
|
|
13
16
|
return false;
|
|
14
17
|
}
|
|
18
|
+
// eslint-disable-next-line valid-jsdoc
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated useMetrika will be deleted
|
|
21
|
+
*/
|
|
15
22
|
const useMetrika = () => {
|
|
16
|
-
const { metrika, pixel
|
|
17
|
-
return ({ metrikaGoals, pixelEvents
|
|
23
|
+
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
24
|
+
return ({ metrikaGoals, pixelEvents }) => {
|
|
18
25
|
if (metrika && metrikaGoals) {
|
|
19
26
|
if ((0, guards_1.isNewMetrikaFormat)(metrikaGoals)) {
|
|
20
27
|
metrikaGoals.forEach(({ name, isCrossSite }) => metrika.reachGoal(isCrossSite ? 'cross-site' : 'main', name));
|
|
@@ -37,13 +44,6 @@ const useMetrika = () => {
|
|
|
37
44
|
pixel.track(pixelEvents);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
|
-
if (gaInline && gaEvents) {
|
|
41
|
-
const gaEventsArray = Array.isArray(gaEvents) ? gaEvents : [gaEvents];
|
|
42
|
-
gaEventsArray.forEach((_a) => {
|
|
43
|
-
var { eventName } = _a, rest = tslib_1.__rest(_a, ["eventName"]);
|
|
44
|
-
gaInline.event(eventName, rest);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
exports.useMetrika = useMetrika;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { MetrikaGoal } from './';
|
|
3
3
|
export interface Refable<T> {
|
|
4
4
|
ref?: React.Ref<T>;
|
|
5
5
|
}
|
|
@@ -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,20 +45,38 @@ 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;
|
|
47
62
|
}
|
|
48
|
-
export interface GaInline {
|
|
49
|
-
event: (eventName: string, params?: GAEventParams) => void;
|
|
50
|
-
}
|
|
51
63
|
export interface ClassNameProps {
|
|
52
64
|
className?: string;
|
|
53
65
|
}
|
|
54
66
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
|
+
export type AnalyticsParameter = {
|
|
68
|
+
key: string;
|
|
69
|
+
value: string;
|
|
70
|
+
};
|
|
71
|
+
export type AnalyticsEvent = {
|
|
72
|
+
name: string;
|
|
73
|
+
type?: string;
|
|
74
|
+
counters?: {
|
|
75
|
+
include?: string[];
|
|
76
|
+
exclude?: string[];
|
|
77
|
+
};
|
|
78
|
+
category?: string;
|
|
79
|
+
label?: string;
|
|
80
|
+
params?: AnalyticsParameter[];
|
|
81
|
+
};
|
|
55
82
|
export {};
|
|
@@ -6,6 +6,9 @@ var 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";
|
|
@@ -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 { AnalyticsEvent, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -121,7 +121,7 @@ export interface LinkProps extends Stylable {
|
|
|
121
121
|
target?: string;
|
|
122
122
|
metrikaGoals?: MetrikaGoal;
|
|
123
123
|
pixelEvents?: ButtonPixel;
|
|
124
|
-
|
|
124
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
125
125
|
}
|
|
126
126
|
export interface FileLinkProps extends ClassNameProps {
|
|
127
127
|
href: string;
|
|
@@ -140,7 +140,7 @@ export interface ButtonProps {
|
|
|
140
140
|
img?: ButtonImageProps | string;
|
|
141
141
|
metrikaGoals?: MetrikaGoal;
|
|
142
142
|
pixelEvents?: ButtonPixel;
|
|
143
|
-
|
|
143
|
+
analyticsEvents?: AnalyticsEvent[];
|
|
144
144
|
target?: string;
|
|
145
145
|
}
|
|
146
146
|
export interface ButtonImageProps {
|
|
@@ -224,7 +224,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
224
224
|
theme?: TextTheme;
|
|
225
225
|
metrikaGoals?: MetrikaGoal;
|
|
226
226
|
pixelEvents?: ButtonPixel;
|
|
227
|
-
|
|
227
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
228
228
|
}
|
|
229
229
|
export interface PreviewContentItemProps {
|
|
230
230
|
title: string;
|
|
@@ -335,27 +335,10 @@ export interface AuthorProps {
|
|
|
335
335
|
className?: string;
|
|
336
336
|
authorContainerClassName?: string;
|
|
337
337
|
type?: AuthorType;
|
|
338
|
+
dataQa?: string;
|
|
338
339
|
}
|
|
339
340
|
export interface BlockHeaderProps {
|
|
340
341
|
title?: TitleProps | string;
|
|
341
342
|
description?: string;
|
|
342
343
|
}
|
|
343
|
-
export declare type GaParameterValue = string | number | boolean;
|
|
344
|
-
declare type GACommandConfig<T> = T & {
|
|
345
|
-
[key: string]: GaParameterValue;
|
|
346
|
-
};
|
|
347
|
-
declare type GACommonParams = {
|
|
348
|
-
groups?: string | string[];
|
|
349
|
-
sendTo?: string | string[];
|
|
350
|
-
eventTimeout?: number;
|
|
351
|
-
};
|
|
352
|
-
export declare type GAEventParams = GACommandConfig<GACommonParams & {
|
|
353
|
-
eventCategory?: string;
|
|
354
|
-
eventLabel?: string;
|
|
355
|
-
value?: number;
|
|
356
|
-
}>;
|
|
357
|
-
export type GAEvent = GAEventParams & {
|
|
358
|
-
eventName: string;
|
|
359
|
-
};
|
|
360
|
-
export type GAEvents = GAEvent | GAEvent[];
|
|
361
344
|
export {};
|
|
@@ -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 { AnalyticsEvent, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -61,6 +61,7 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
61
61
|
onLoad?: (arg: HubspotEventData) => void;
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
64
65
|
}
|
|
65
66
|
export interface PartnerProps extends CardBaseProps {
|
|
66
67
|
text: string;
|